Repository navigation
Add cppia? - #1127
Add cppia?#1127HEIHUAa wants to merge 22 commits into
Conversation
|
Unless there's something I don't exactly understand about CPPIA here, perhaps this could be done instead by extending the |
Extending the Script class is something I have indeed thought about. I think this is also a feature it should ultimately have, but the current implementation approach may still need discussion. |
|
cppia could be like scripts too me thinks, but gets preloaded once when the mod first loads in MainState |
After testing, it can be loaded anywhere in real time, but once loaded, it stays in memory forever and seemingly cannot be cleared. However, the memory used by JIT is not large and can be ignored. Also, some places may still reference certain code within the cppia, so clearing it directly from memory could cause a crash. I just tested that cppia can be replaced in real time and new cppia can be loaded. |
|
I roughly know how to write scriptable cppia now. I might add a CppiaMacro to convert things like the script-like Parent. Also, Script.onCall can directly call the corresponding function in cppia, which would support all the call triggers supported by hscript scripts, except this operation requires one reflection. |
|
After more accurate testing, I found that cppia is actually not close to native speed at all — it is nearly 10–50 times slower than native. Still, I think it's worth it, since it's much faster than hscript, which is 150–500 times slower. |
|
Would be a good addition to CNE if it works really well compared to CNE's hscript-improved |
|
I'm not sure yet but can cppia implement custom classes, typedefs, etc? and would it be comfortable for you if we move the branch to CodenameCrew's? |
Previous tests:
The so-called JIT in For Compared to native:
In actual testing, it supports almost all native operations. Except for If there is one downside, it might be EXE bloat: it will inflate the current ~67 MB EXE file to nearly ~98 MB. You can actually see this from the files in the Actions of my repo. |
|
Oof, it might not be really helpful in this case then if it only does a little of performance and requires more of a headache to work with, and a bloat... especially with the hscript-improved still getting a performance upgrades later on |
In practice, I think one of the more useful things about cppia is that you can compile almost an entire library—one that does not include |
|
I searched around and it seems I found a repository that can compile Hx to cppia in real time (https://github.com/MeguminBOT/hxscript). I think it might be worth taking a look at that one. |
|
This is a good project that we have seen actually in the development discord server, but unfortunately this creator doesn't really like our project and they probably don't allow us to use this. |
|
That's a shame — it really is a good project. |
|
Until I find a way to use cppia without increasing the binary size, I think it's highly likely that I won't be making any more updates. |
Given that no one replied to the previous issue at #1106, I tried to do some work on it first.
The currently implemented content is as follows:
DiscordUtil is compatible with scriptable
hscript can normally load cppia from the path mods//source/Class.cppia via import
That's right, only these. I currently don't know how to handle the entire compilation process for cppia.
It is also planned to add support for directly loading and using
.cppiafiles inmods/<mod>/data/states/.