Re: minisphere 4.1.1
Reply #1280 –
Thanks, I'll fix the documentation and maybe add a warning message in Sphere Studio when the engine fails to load for any reason.
This is an area where the documentation needs to be improved, but starting with minisphere 4.1.1, when you use a JSON manifest, the engine runs in native Sphere v2 mode. Among other things, this means that your main script is loaded as a CommonJS module, like in Node.JS. Any startup code should be placed at the top level, outside of any functions, and variable or function declarations are local to the module unless you explicitly make them global:
global.myGlobalVar = 812;
If you add "version": 1 to the manifest, the engine runs in compatible mode, the same as if you had a game.sgm file. In compatible mode the main script runs as global code and the engine calls the game() function, just like Sphere 1.x.