April 24, 2016, 06:38:34 am

I split this off from my response on the Plugins part.

Let's make Pegasus async (non-blocking). Node is, indeed, and we should follow this path. No multi-threading (for now), but one big event-loop. Yes, I say event-loop because it sounds a lot like 'game-loop'. (node uses an event-loop).This might be harder than non blocking without an event loop, but it does solve a lot of issues regarding files and such. I am not sure how this would be designed, especially in a game, but I will look into it today.

If we follow the node.js modules+async path, I think I could implement a full-software (slow) engine by implementing Pegasus on top of Node. This could be used for prototyping. Not really for games, that is too slow. Also, 'npm install sphere-pegasus'.

If we go with Async, I suggest we use Promises. Promises is an ES6 builtin and there is Bluebird and many other libraries for ES5. You can also implement it yourself if you like, which is good fun. Use promises where-ever you can, that is.As you might have no idea what promises are, I will explain it a bit:

A promise is a promised value. A promise can either reject (with an error) or resolve (with a value).A quick example: loading a file. That can either fail (file did not exist, system error, whatever) or it can succeed (with the data). Now, in Node-style-async you would thus have the following function:

minisphere 3.0 includes basic async support. There are no async functions in the core API -- it basically mimics Sphere 1.5 with a bunch of backwards-compatible enhancements. minisphere 4.0 will be the first Pegasus engine. However it does have a promise library bundled: miniRT/pacts. Promises are used like in every other promise library in existence, however you also have Pacts to simplify making them:

miniSphere 5.1.3 - Cell compiler - SSj debugger - thread | on GitHubFor the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enourmous man eating pigs ~Rhuan

But otherwise, yes. The Pacts are just there to simplify JS code which needs to create promises since using new Promise effectively is difficult.

miniSphere 5.1.3 - Cell compiler - SSj debugger - thread | on GitHubFor the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enourmous man eating pigs ~Rhuan