EjectaGL - WebGL for iOS

0 favourites
  • Hey,

    Couple of days back I started working on adding WebGL bindings to the Ejecta framework (http://impactjs.com/ejecta) - github.com/vikerman/EjectaGL

    Currently I have basic APIs implemented enough to render a scene from my Voxel engine - indie-indian.blogspot.com/2012/11/ejectagl-webgl-on-ios-with-ejecta.html

    One application of this project is the possibility of getting all the WebGL shader effects in Construct2 working on ios devices assuming an Ejecta exporter can be worked out.

    There is still lot of work to be done but I think this is better than waiting for Apple to flip the switch on WebGL on iOS devices. Please take a look at the project and provide help in terms of API additions, look at performance, porting samples, doing code reviews, testing etc. I don't have detailed documentation on EjectaGL other than the README file but the base Ejecta documentation at impactjs.com/ejecta is a very good place to start.

    Checkout the github project. Drop me a line here or at twitter -

  • That's awesome!

    Unfortunately i have no mac, but i will get a mac mini soon!

  • vikerman : great job ! I was thinking about it myself, but didn't know what road to take : 1) add WebGL shader support to Ejecta, or 2) create a PhoneGap plugin with calls to OpenGLES effects on images (UIView and images in fact). I started to work on the PhoneGap-plugin side, but your work seems very useful from a game viewpoint !

  • Very interesting! Unfortunately the main problem I see is the practical difficulty of using it with C2... there's no build system (like PhoneGap Build, appMobi or Ludei provide) and you need a mac to build. That could rule out a lot of people using it for the time being.

  • A little bit off topic, but Is anybody working on an "unofficial" way to run c2 games in ejecta? I tried it and with minor tweaks to the rintime.js, i was able to get ticks and draw calls but the sprites are not drawing on the screen. I know for sure that the sprite's draw function is being called with the correct params because i added a console.log right before it. All i get is the white background from the layout.

  • Never mind, I was able to make a simple C2 game work in Ejecta.

    I had to do the following:

    1. export as Html5 game

    2. Modify runtime.js in the following places

    a. set this.isDomFree = true and this.isiOS = true in function Runtime(canvas)

    b. set this.ctx = global_ctx; in function Runtime(canvas). global_ctx is just an arbitrary global var that holds the 2d context obtained in the index.js script (see Ejecta documentation). That was the only way I could make it work, not sure why.

    c. always return true in areAllTexturesLoaded. The loading progress logic did not work for me in Ejecta. As a ugly work aorund I just set it to return true. Obviously, this could create problems for games that load a lot of textures.

    3. Create a index.js file for ejecta with the following contents:

    var global_canvas = document.getElementById('canvas');

    var global_ctx = canvas.getContext('2d');

    ejecta.require('c2runtime.js');

    // Create new runtime using the c2canvas

    cr.createRuntime('canvas');

    Please see Ejecta documentation for additional steps required for ejecta to work in Xcode.

    As Ashley said, you need a mac to use Ejecta, but then again, you need a mac anyways when uploading the final version for publishing in the app store.

    For me the biggest advantage of Ejecta over Cocoon or AppMobi is the already available integration with GameCenter. other than that, I think they perform the same. The other biggest possible advantage would be WebGL if vikerman is able to complete his amazing Ejecta webgl bindings.

  • Cool! This is great! Thanks! It might not work for others, but it's a great alternative for me.

  • Ashley - Ah ok. I just saw that AppMobi was an export option and I thought there can be a similar one for Ejecta - but I realize it would involve manually moving around files.

    Is it possible to do similar to what juantar mentioned in a plugin and in a more automated manner?

  • I read Ejecta doesn't support patterns yet, which is a blocker (Tiled Background won't work without it). It also doesn't support C2's memory management for large projects. However if it supported WebGL it'd use a different renderer anyway which supports both.

    If it already supports AJAX and Game Center, and it gets a working WebGL, then it's a pretty interesting option. TBH I'm getting a little frustrated by slow progress from appMobi and Ludei on all three of those, so adding optional support for Ejecta would be nice.

    It looks like it also has WebStorage and decent Audio support, but it's still missing something that could be used to make letterbox mode, it strangely seems to be missing the deviceorientation event, and it looks like it ought to have support for suspend and resume events which it doesn't say it does.

    Still, potentially promising...

  • Thanks for the detailed explanation. Currently Ejecta supports DeviceMotion events. Not sure if that can be a replacement for device orientation. Also I think Dominic is working on adding support to the missing features in Canvas and a more complete version should be up soon.

    In any case the cool thing about Ejecta is that it's open source and I hope that will make it more flexible than the other options. Personally I am excited to be able to get Construct2 games on to Ejecta - And would be happy to work with you into adding missing features (as soon as I finish a first pass of the WebGL bindings)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • IIf it already supports AJAX and Game Center, and it gets a working WebGL, then it's a pretty interesting option. TBH I'm getting a little frustrated by slow progress from appMobi and Ludei on all three of those, so adding optional support for Ejecta would be nice.

    Still, potentially promising...

    Is this looking like a real potential option? I've been looking into the IAP and Ad stuff for CocoonJS and it's been rather frustrating. A new potential option would be nice, but then again I don't know if it'd become a new waiting game for features of new export option.

  • Hey Ashley,

    Here is an update on the WebGL implementation on Ejecta. The Rain Demo is fully functional on Ejecta - after minimal hacking to c2runtime.js.

    Here is the Rain Demo running at 6-7 FPS on an iPhone 4S (retina display) but graphically fully functional. The game doesn't have touch control so not much to play yet.

    It should be fairly easy to target Ejecta if you wanted to. I manually copied the files from my Windows Machine to Mac, dropped into an Ejecta project, created an index.js which is just

        ejecta.include("c2runtime.js");

        cr_createRuntime("canvas");

    Hacked c2runtime.js(Dropped it here if anyone wants to check it out) a bit to work with Ejecta and that was it.

    Quick video I made of the game running on a iPhone 4S -

    Subscribe to Construct videos now
  • vikerman - that's pretty cool, but unless it's a real browser engine it's going to be a big headache to support, and it's missing a cloud compilation system like Ludei have. I'm not sure we could officially support it since then we'd be obliged to fix all the quirks and issues that crop up, but if it works unofficially then you can still go ahead and use it!

  • vikerman : very nice video. Did you add a comment to the lines you changed in c2runtime.js so that we can find them, or should I just do a diff on them?

    Thanks!

  • Please Ashley support Ejecta. Construct 2 misses real games for mobile to showcase and there are lots of people sitting on them unable to publish for performance issues. Not everybody needs a cloud compilation, there are people with a mac mini able to compile this stuff themselves. Put it as an advanced option, experimental or whatever beause it actually works already and Ludei is promising updates that never comes, meanwhile Ejecta gets updated weekly.

    So far the only real issue with Ejecta is the loading screen that doesn't work.

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