Skip to main content

News

Topic: neoSphere 5.9.2 (Read 539109 times) previous topic - next topic

0 Members and 26 Guests are viewing this topic.
  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1965
I got JSAL almost 100% functional, I can push and pop values, execute JS code (even ES6 stuff like arrow functions!), call JS functions, define native calls, etc.  Once I finish working all the kinks out I'll replace all the Duktape calls with their JSAL equivalents and see if everything blows up in my face  :P
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1966
I got JSAL almost 100% functional, I can push and pop values, execute JS code (even ES6 stuff like arrow functions!), call JS functions, define native calls, etc.  Once I finish working all the kinks out I'll replace all the Duktape calls with their JSAL equivalents and see if everything blows up in my face  :P

Good work.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1967
miniSphere is actually the easy part of the upgrade: With a different JS engine in use, SSj will need to be rewritten pretty much from the ground up since the debug interface will be different.  CC *does* have a debugging API at least, which is something I made sure to check before I started. :)
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1968
With cell for mac I've got it to find itself but it dies later trying to build a path for cellscript.mjs.

I can't see what input it's using but it seems to be getting to the bottom of path_rebase where it calls path_collapse but passing a null pointer to path_collapse,

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1969
Is there any way you could build Cell with debug symbols (-g switch) so you could get a stack trace with function names?
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1970
I managed to emulate Duktape's exception model, where JS errors can be thrown directly from C code.  Here's a test function:

Code: (JS) [Select]
static int
js_foo(int num_args, bool is_ctor)
{
const char* str;
int         num;

printf("foo() called with %d args\n", num_args);
str = jsal_require_string(1);
num = jsal_require_int(2);
printf("%s %d\n", str, num);
return 0;
}

Code: (JS) [Select]
jsal_init();
jsal_push_global_object();
jsal_push_function(js_foo, "foo", 0);
jsal_set_named_property(-2, "foo");
jsal_pop(1);
jsal_push_eval("foo('pigs!', '812');");
jsal_uninit();

Output:
Code: [Select]
foo() called with 2 args
JSAL exception thrown from unguarded C code!
-> TypeError: '812' is not a number

The second printf in foo() is not reached because jsal_require_int(2) throws an error first.  This will make it possible to just plug in JSAL calls in place of Duktape ones with very little refactoring.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1971
So JSAL = JavaScript Abstraction Layer?

I'm not sure if I like the idea of a stack machine myself but good work getting it going nonetheless.

Regarding my attempts to build cell:
Debug symbols was on the whole time but seemingly not working - I assumed this was due to xcode and apple debugging not playing nice with unix-style apps (i.e. ones without a  bundle.

BUT then I realised that "strip symbols" was also on, xcode has too many defaults.

THe trace is overly large so here are the highlights in reverse order:
13: inside int main:
if (!build_eval(build, "Cellscript.mjs") && !build_eval(build, "Cellscript.js"))
12: inside bool build_eval:
duk_get_prop_string(build->js_context, -1, "fileName");
11: duk_get_prop_string
10: duk_get_prob
9: duk_hobject_getprop
8: duk_err_handle_getprop
7: duk_err_handle_error_fmt
6: duk_err_longjmp
5: duk_uncaught_error_aware
3: duk_fatal_raw
2: abort

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1972
Yep, JavaScript Abstraction Layer.

That's interesting, it's an uncaught JS exception that's crashing it.

As for the stack machine: It wasn't my first choice, but I decided it was ultimately better to do it that way since I won't have to restructure all the JS-related calls, it can remain mostly as-is and I just have to rename the functions.  Otherwise I have to do a ton of refactoring to the entire Vanilla and Pegasus API implementations and surely create lots of bugs in the process.  Any bugs I create this way would be in JSAL itself and therefore easier to track down.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1973
It looks like the same bug that I just fixed in miniSphere: it's trying to get the filename and line number of an error but fails because the thing on top of the stack isn't an object.  I have no clue why that would happen though...
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1974
I keep thinking I'm done with JSAL and then realizing I need more object manipulation functions... :P

I think I'm going to try converting Cell to use JSAL (and by extension CC) first, before tackling miniSphere.  Cell has a much smaller API than Sphere, so there's a lot less surface area to test and it'll give me a good idea of how dramatic the performance boost is, as building Specs involves transpilation.

One feature of Duktape that I can't figure out how to replicate is being able to store "hidden" properties on an object which can be accessed from native code but not in JS.  I've seen a few mentions of "internal properties" in the CC documentation, but haven't found any APIs to work with them...
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1975
One feature of Duktape that I can't figure out how to replicate is being able to store "hidden" properties on an object which can be accessed from native code but not in JS.  I've seen a few mentions of "internal properties" in the CC documentation, but haven't found any APIs to work with them...
I've had a look and can't find anything either.

The internal properties information I found seemed to me to relate to specific internal chakra core data not anything you could create via their runtime.

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1976
Had a thought, not for the near future but if we want to push Sphere to being more flexible/more powerful - particularly if full 3d support comes in...

Possible extra feature: Multi-threading - with CC you can create multiple runtimes which will run in multiple threads, and then you can create a couple of functions to pass information between them.

(Maybe for version 6.0....)

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1977
After spending pretty much all day working on it, I'm so close to having Cell working with CC I can feel it. :D

There are a few weird errors being thrown that make no sense, I suspect my stack handling in JSAL is buggy.  For example `require()` fails with an error "can't set __esModule on undefined or null".  But the fact I got that far means it successfully gets through parsing the Cellscript and is trying to run it.  This is awesome!
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1978
After spending pretty much all day working on it, I'm so close to having Cell working with CC I can feel it. :D

There are a few weird errors being thrown that make no sense, I suspect my stack handling in JSAL is buggy.  For example `require()` fails with an error "can't set __esModule on undefined or null".  But the fact I got that far means it successfully gets through parsing the Cellscript and is trying to run it.  This is awesome!
Sounding good.

I should really get the existing cell to compile on macOS so I can build CC Cell when it's ready...

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1979
Code: [Select]
C:\src\spectacles-i>cell -rd
Cell X.X.X Sphere packaging compiler (x64)
the JavaScript-powered build engine for Sphere
(c) 2015-2017 Fat Cerberus

setting up Cellscript environment...
evaluating 'Cellscript.mjs'...
   W: no existing files match 'lib/*.js'
building targets...
   transpiling '@/scripts/battleAI/headlessHorse.js'...
   transpiling '@/scripts/battleAI/robertII-2.js'...
   transpiling '@/scripts/battleAI/robertII.js'...
   transpiling '@/scripts/battleEngine/battle.js'...
   transpiling '@/scripts/battleEngine/battleActor.js'...
   transpiling '@/scripts/battleEngine/battleAI.js'...
   transpiling '@/scripts/battleEngine/battleHUD.js'...
   transpiling '@/scripts/battleEngine/battleScreen.js'...
   transpiling '@/scripts/battleEngine/battleUnit.js'...
   transpiling '@/scripts/battleEngine/fieldCondition.js'...
   transpiling '@/scripts/battleEngine/item.js'...
   transpiling '@/scripts/battleEngine/moveMenu.js'...
   transpiling '@/scripts/battleEngine/mpPool.js'...
   transpiling '@/scripts/battleEngine/skill.js'...
   transpiling '@/scripts/battleEngine/spriteImage.js'...
   transpiling '@/scripts/battleEngine/stat.js'...
   transpiling '@/scripts/battleEngine/statusEffect.js'...
   transpiling '@/scripts/battleEngine/targetMenu.js'...
   transpiling '@/scripts/battleEngine/weapon.js'...
   transpiling '@/scripts/gameDef/animations.js'...
   transpiling '@/scripts/gameDef/battles.js'...
   transpiling '@/scripts/gameDef/characters.js'...
   transpiling '@/scripts/gameDef/conditions.js'...
   transpiling '@/scripts/gameDef/game.js'...
   transpiling '@/scripts/gameDef/items.js'...
   transpiling '@/scripts/gameDef/maps.js'...
   transpiling '@/scripts/gameDef/math.js'...
   transpiling '@/scripts/gameDef/moveEffects.js'...
   transpiling '@/scripts/gameDef/skills.js'...
   transpiling '@/scripts/gameDef/stats.js'...
   transpiling '@/scripts/gameDef/statuses.js'...
   transpiling '@/scripts/gameDef/weapons.js'...
   transpiling '@/scripts/gameOverScreen.js'...
   transpiling '@/scripts/main.js'...
   transpiling '@/scripts/maps/main.js'...
   transpiling '@/scripts/maps/Portentia.js'...
   transpiling '@/scripts/maps/Testville.js'...
   transpiling '@/scripts/menuStrip.js'...
   transpiling '@/scripts/party.js'...
   transpiling '@/scripts/scenelets.js'...
   transpiling '@/scripts/session.js'...
   transpiling '@/scripts/testCases/brucesStory.js'...
   transpiling '@/scripts/testHarness.js'...
   transpiling '@/scripts/titleScreen.js'...
   transpiling '@/scripts/battleEngine/ui.js'...
   transpiling '@/scripts/inGameClock.js'...
   installing '@/images/battleBackground.png'...
   installing '@/images/gameOverScreen.png'...
   installing '@/images/splashScreen.png'...
   installing '@/images/titleCard.png'...
   installing '@/images/titleScreen.png'...
   installing '@/maps/main.rmp'...
   installing '@/maps/Portentia.rmp'...
   installing '@/maps/Testville.rmp'...
   installing '@/maps/Portentia.rts'...
   installing '@/maps/TestvilleTiles.rts'...
   installing '@/music/basicInstinct.ogg'...
   installing '@/music/gameOver.ogg'...
   installing '@/music/manorBoss.ogg'...
   installing '@/music/nightmareBattle.ogg'...
   installing '@/music/thePromise.ogg'...
   installing '@/music/chartreuse.mp3'...
   installing '@/spritesets/battlers/Amanda.rss'...
   installing '@/spritesets/battlers/Bruce.rss'...
   installing '@/spritesets/battlers/Elysia.rss'...
   installing '@/spritesets/battlers/H. Horse.rss'...
   installing '@/spritesets/battlers/Justin.rss'...
   installing '@/spritesets/battlers/Katelyn.rss'...
   installing '@/spritesets/battlers/Lauren.rss'...
   installing '@/spritesets/battlers/Lumisquirrel.rss'...
   installing '@/spritesets/battlers/maggie.rss'...
   installing '@/spritesets/battlers/maggie_hippo.rss'...
   installing '@/spritesets/battlers/Robert.rss'...
   installing '@/spritesets/battlers/Scott T.rss'...
   installing '@/spritesets/battlers/Scott.rss'...
   installing '@/spritesets/battlers/Victor.rss'...
   installing '@/spritesets/battlers/Xemnas.rss'...
   installing '@/spritesets/invisible.rss'...
   installing '@/sounds/munch.wav'...
   installing '@/icon.png'...
cleaning up old build artifacts...
writing Sphere manifest files...
writing source map...
0 error(s), 1 warning(s).

:smile:
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub