Ejecta Thread

0 favourites
  • Hi guys, I'm opening this thread for reports and tutorial on making c2 work with ejecta.

    <font size="4">Do not download the stable release as it doesn't support most of the features required by C2.

    Download the latest build from GitHub</font>

    Exporter / Plugin:

    Refer to this github repository for exporter and plugin: github.com/0plus1/C2_Ejecta

    Know issues:

    • Tiled Backgrounds render as black in canvas2d.

    100% Compatible plugins:

    • Sprite Fonts (http://www.scirra.com/forum/spritefont-v0995rc-new-update-small-bugfixes_topic37778.html)
    • Random Array (http://www.scirra.com/forum/plugin-randomarray_topic45277.html)
    • Time Manager (http://www.scirra.com/forum/plugin-time-manager_topic49030.html)

    Partially compatible plugins:

    • CallJS (http://www.scirra.com/forum/plugin-call-javascript_topic45866.html). Basic stuff works, the function that calls the inclusion of the external js file must be deleted.

    Incompatible plugins:

    • TMX importer (http://www.scirra.com/forum/plugin-tmx-importer_topic49949.html)
    • Any plugin that relies on an XML parser

    Let's try to keep this thread going and see where we can take ejecta.

  • I can't offer any help fixing problems - one of the reasons it's so time-consuming and frustrating working with DOM-less engines is because there are no good debugging tools like Chrome has. Our code is all standards-compliant and works fine in a real browser, so if something is broken, it's probably an Ejecta bug. How you'd go about finding the problems, though, is a difficult one to answer unless you also reinvent some dev tools.

  • Incompatible plugins:

    • "TMX importer" by Rexrainbow
    • Any other plugin that relies on an XML parser
    • Tiled Backgrounds render as black
  • Ashley don't worry, is it possible currently to write an exporter ourselves?

    Also it appears like Ejecta is CocoonJS 1.0 (before spritefonts worked) what did you do to the loader to make it work in Cocoon?

    Thanks

    juantar edited with your plugins

  • Guys this is epic: juantar - vikerman - Ashley

    I grabbed the latest development version and....

    Loading screen works 100% and loads extremely fast.

    Spritefonts WORKS!

    I'm crying of joy, I can finally publish my game!!!

    I edited the post to reflect the new findings.

    THANK YOU EJECTA!

  • Guys this is epic: juantar - vikerman - Ashley

    I grabbed the latest development version and....

    Loading screen works 100% and loads extremely fast.

    Spritefonts WORKS!

    I'm crying of joy, I can finally publish my game!!!

    I edited the post to reflect the new findings.

    THANK YOU EJECTA!

    Seriously?? it must be good news.

  • Joannesalfa yes, all true! This is epic.

    I'm sorry but Cocoon (at least on iOS) is years behind Ejecta, we already have working game center, working iAP and new features are rolled in every day. Plus is open source meaning no royalties, no issues that takes months to fix and if you really need something you can code it yourself (the extension system of Ejecta is really simple to understand).

  • Good, also GameClosure is another option, would you port space blaster with Ejecta?

  • is that a C2 GameCenter plugin? congrats. Looking good. I do agree that open source alternatives are a great option :)

  • Space Blaster has already been ported to Ejecta: youtube.com/watch (http://www.scirra.com/forum/experiment-construct2-with-ejecta-and-gamecenter_topic64187.html).

    Game Closure seems far too complicated, Ejecta is working right now, with Game Center, iAP and WebGL. It works like Phone Gap and it's very very easy to extend with native code.

    I firmly believe that as today the ONLY option to export professional games on iOS (with C2 of course) is Ejecta. Even if CocoonJS supported Game Center Leaderboards and Achievement (and it still doesn't), even if iAP purchases worked (which apparently they do not) there is still the issue of the forced CocoonJS logo before your game.

    Anyway let's try to keep this thread on topic, posting example of games, issues and so on.

    jayderyu yes it is but I'm not the original author, I'm expanding it with iAP purchases and whatever might come down to road to make it a complete Ejecta Plugin. I'll publish on GitHub so anybody can contribute.

  • I doubt if Ejecta supports Dynamic Memory, which is designed for complex games.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If it supports webgl, then there's a good chance that it does, actually.

  • Added a ghetto style exporter in the first post. It's a batch file that finds and replaces the correct lines using FNR.

    It's really handy for me, so I shared.

    If you are unsure about running batch files from random guys on the intertubes open the .bat file and check what it does.

  • Great work!

    It looks like Ejecta and Pender could be blazing the way for C2 on iOS and Android respectively. From where I stand, IAP, open access to ad SDKs and social network inclusion are what's missing/poorly-integrated by proprietary solutions at the moment. This is a mahuusive leap forward.

  • Thanks to vikerman, I was able to get Space Blaster running on webgl in ios using Ejecta (latest build from GitHub). It feels faster than the ejecta canvas version I did before. The TileBackground plugin now works perfectly. I was also able to use the radial blur effect when one of the enemies hit. Hopefully, it is clear in the video when the effect takes place. The youtube video is at

    Subscribe to Construct videos now

    To make it work, I did a diff on Vikerman's work and was able to identify where in the c2runtime.js file you need to make changes for webgl to work on ios with ejecta (no need to do the changes shown in the 1st post of this thread, that is for canvas):

    1. In GLWrap_.prototype.loadTexture remove the last parameter in hte function declaration, so that it reads:

         function (img, tiling, linearsampling, pixelformat) //jpt

    2. In GLWrap_.prototype.loadTexture after gl.texImage2D(gl.TEXTURE_2D, 0, internalformat, format, type, img);

    the following if condition needs to be removed:

    if (tiling)

              {

                  ?if (tiletype === "repeat-x")

                  ?{

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

                  ?}

                  ?else if (tiletype === "repeat-y")

                  ?{

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);

                  ?}

                  ?else

                  ?{

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);

                  ?}

              }

              else

              {

                  ?gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);

                  ?gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

              }

              

    and replaced with:

              

              

              gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, tiling ? gl.REPEAT : gl.CLAMP_TO_EDGE); //jpt tiling restructured

              gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, tiling ? gl.REPEAT : gl.CLAMP_TO_EDGE);//jpt tiling restructured, replaces the if(tiling) part

    4. In function Runtime(canvas) add

         this.isEjecta = !!window["ejecta"]; //jpt

              

    after this line

         this.isCocoonJs = !!window["c2cocoonjs"];

    5. Replace

              this.isDomFree = this.isDirectCanvas || this.isCocoonJs;

    with

              this.isDomFree = this.isDirectCanvas || this.isCocoonJs || this.isEjecta; //jpt

    6. also in same function, replace the following:

         if (typeof jQuery !== "undefined" && this.fullscreen_mode > 0)

                  ?this["setSize"](jQuery(window).width(), jQuery(window).height());

                  ?

    with

              if (typeof jQuery !== "undefined" && this.fullscreen_mode > 0 && !this.isEjecta)

                  ?this["setSize"](jQuery(window).width(), jQuery(window).height());

                  ?

    7. In the next "if", replace it with:

         if (this.enableWebGL && (!this.isDomFree || this.isEjecta)) //jpt

    8. Surround the following code with an if for ejecta:

                  ?jQuery(this.overlay_canvas).appendTo(this.canvas.parentNode);

                  ?this.overlay_canvas.oncontextmenu = function (e) { return false; };

                  ?this.overlay_canvas.onselectstart = function (e) { return false; };

                  ?this.overlay_canvas.width = canvas.width;

                  ?this.overlay_canvas.height = canvas.height;

                  ?this.positionOverlayCanvas();

                  ?

    so it should read:

                  ?if (!this.isEjecta)

                  ?{

                  ?jQuery(this.overlay_canvas).appendTo(this.canvas.parentNode);

                  ?this.overlay_canvas.oncontextmenu = function (e) { return false; };

                  ?this.overlay_canvas.onselectstart = function (e) { return false; };

                  ?this.overlay_canvas.width = canvas.width;

                  ?this.overlay_canvas.height = canvas.height;

                  ?this.positionOverlayCanvas();

                  ?}

    9. Add the check in Runtime.prototype.go:

    replace:

         if (this.overlay_canvas)

    with:

         if (!this.isEjecta && this.overlay_canvas) //jpt

              

    10. In Runtime.prototype.go_textures_done:

    add a check around this.canvas.parentNode.removeChild(this.overlay_canvas) :

                  ?if (!this.isEjecta)//jpt

                  ?{

                        this.canvas.parentNode.removeChild(this.overlay_canvas);

                  ?}

    11. also, in the same function, add check to

         if (this.fullscreen_mode >= 2) :

    So it should read:

         if (!this.isEjecta && this.fullscreen_mode >= 2)

         

    The XCode project for the Space Blasters using WebGL with the modified c2runtime.js file is at http://sites.google.com/site/jptarqu/downloads/SpaceBlastersWebGL-ejecta-xcode.zip?attredirects=0&d=1

    By the way, I only wanted to test WebGL in this space blaster version so I left out the GameCenter actions/events I did for my previous experiment. The GameCenter should work even if you use webgl. Also, note that in order to keep good performance on your mobile game, you need to still follow the general guidelines for mobile that have been floating around in this forum, i.e.: not drawing more than 3 times into a pixel, keep physics object count low, use tiled backgrounds instead of sprites when possible, etc.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)