AppCore Modules

This is the 2017 version of IGE and is based on the "appCore" branch in git and is a relatively large re-write of many areas of the engine to allow for automatic dependency injection in your code, much simpler navigation of your game scenes etc.

It is modelled after AngularJS in the way dependency injection works and modelled after ui-router for how routing works, although it doesn't include either of those libraries.

AppCore Modules

Postby rob » Tue Sep 12, 2017 1:41 pm

The new dependency injection system in IGE 2.x is called AppCore. It is a very lightweight module registration / dependency injection framework that is written to mimic how AngularJS does modules and dependency injection.

If you want to define a module, simply use appCore.module(moduleName, controllerFunction). Your controller function can list the dependencies it needs as argument names e.g. function ($ige) {} would ask for the $ige module to be injected.

Code: Select all
appCore.module('MyModule', function ($ige) {
    var MyModule = function () {};

    MyModule.prototype.sayHello = function () { console.log('Hello'); };

    return MyModule;
});


Now you can use MyModule in another module:

Code: Select all
appCore.module('MyOtherModule', function (MyModule) {
    var a = new MyModule();
    a.sayHello();
});


Although that is a contrived example, it shows how automatic dependency injection works.
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm

Re: AppCore Modules

Postby foobarbecue » Sun Dec 03, 2017 12:30 am

First of all, as someone who's just getting in to using IGE, I'm thrilled to hear there's going to be an IGE 2!

Could you explain how this system relates to ES6 style modules? I'd really rather not learn yet another module system... wish everybody would just use ES6 modules but perhaps you can explain why appCore is different / better? (I'm intermediate at JS, expert at python...)
foobarbecue
 
Posts: 4
Joined: Sat Dec 02, 2017 11:55 pm

Re: AppCore Modules

Postby rob » Fri Dec 15, 2017 11:43 am

foobarbecue wrote:First of all, as someone who's just getting in to using IGE, I'm thrilled to hear there's going to be an IGE 2!

Could you explain how this system relates to ES6 style modules? I'd really rather not learn yet another module system... wish everybody would just use ES6 modules but perhaps you can explain why appCore is different / better? (I'm intermediate at JS, expert at python...)


Hey! So the main reason I've gone with this approach is so that I can maintain the existing code for the most part rather than porting the entire project to ES6 all in one go which would be a somewhat mammoth task.

This approach allows us to continue to use all the existing ES5 engine code but gain dependency injection super-powers that I suspect most JS devs have probably seen or worked with (it is similar to AngularJS style dependency injection, although vastly cut-down so it does not bloat anything).

I think long term, when I have time an ES6 re-write would be great. That will likely be version 3 though. My aim with this version is to reduce the complexity for beginners. I spent some time in the appCore branch fixing up the editor I was working on but never got finished. As time allows (as I know you've been active in the thread explaining my current situation) I will try to continue adding to the engine.

So many devs love IGE that I didn't even really know about, so I have some renewed energy to keep this up. My primary focus for version 2 will be easier beginner usage. Version 3 if I can get time and collaboration from the dev community would be to convert everything to WebGL entirely. Right now the canvas renderer is very solid but I think that if we can create easy to use 3d, it could be a really great update to the engine.

So to sum up:

Version 2:

* Dependency injection
* GUI editor features
* Easier learning curve for beginners - perhaps some tutorials?

Version 3:

* ES6 rewrite
* Full WebGL support - this will be transparent to the user of the engine - either they want to make a full 3d game or only isometric or only 2d. If isometric or 2d only, they should not need to delve into or understand 3d rendering etc, the engine should just handle it as it does now, but allow the renderer module to choose WebGL if available or fallback to canvas2d if not.
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm


Return to Version 2.x

Who is online

Users browsing this forum: No registered users and 1 guest