EjectaGL - WebGL for iOS

Discussion and feedback on Construct 2

Post » Tue Nov 27, 2012 5:27 am

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

Currently I have basic APIs implemented enough to render a scene from my Voxel engine - http://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 http://impactjs.com/ejecta is a very good place to start.

Checkout the github project. Drop me a line here or at twitter - @vikerman.
B
3
Posts: 5
Reputation: 585

Post » Tue Nov 27, 2012 5:40 am

That's awesome!

Unfortunately i have no mac, but i will get a mac mini soon!
B
96
S
25
G
20
Posts: 3,054
Reputation: 22,642

Post » Tue Nov 27, 2012 1:06 pm

@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 !
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Tue Nov 27, 2012 3:54 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Nov 27, 2012 5:22 pm

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.
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Wed Nov 28, 2012 4:30 pm

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.juantar2012-11-28 16:32:17
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Wed Nov 28, 2012 6:18 pm

Cool! This is great! Thanks! It might not work for others, but it's a great alternative for me.
B
7
S
2
G
1
Posts: 44
Reputation: 1,415

Post » Wed Nov 28, 2012 8:53 pm

@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?

B
3
Posts: 5
Reputation: 585

Post » Thu Nov 29, 2012 1:03 am

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...
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Fri Nov 30, 2012 5:03 pm

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)
B
3
Posts: 5
Reputation: 585

Next

Return to Construct 2 General

Who is online

Users browsing this forum: armaldio, bilgekaan, Clintonpacheco, Davioware, saiyadjin and 2 guests