Ejecta Thread

Discussion and feedback on Construct 2

Post » Tue Mar 26, 2013 3:45 am

I doubt if Ejecta supports Dynamic Memory, which is designed for complex games.
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Tue Mar 26, 2013 4:42 am

If it supports webgl, then there's a good chance that it does, actually.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Tue Mar 26, 2013 12:42 pm

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.0plus12013-03-26 12:42:49
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Tue Mar 26, 2013 1:15 pm

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.
B
31
S
11
G
7
Posts: 197
Reputation: 6,682

Post » Mon Apr 01, 2013 7:20 pm

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 http://www.youtube.com/watch?v=t48tlAUgZWY

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.juantar2013-04-02 03:16:24
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Mon Apr 01, 2013 9:19 pm

Congrats guys. you are all doing a great job. Including the developers on Ejecta. Is it more than just the individual who was doing ImpactJS?

B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Tue Apr 02, 2013 5:16 am

@juantar I tried WebGL on my game, it works, but there are some issues. First of all it seems slower on my iPhone4, I see that you have an iPhone5 who have an incredible processor, I wait for other people input, from my perspective WebGL is slower than 2d canvas.

I tried some effects and most of them doesn't work.

It would be useful to make a list of supported effects.0plus12013-04-02 07:17:45
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 26, 2013 1:11 pm

Ejecta is very exciting following this thread for updates. IOS with high performance and HQ game, my dream :D
B
31
S
10
G
2
Posts: 310
Reputation: 5,426

Post » Fri Apr 26, 2013 2:27 pm

@stctr indeed it is, next week I'll release the plugin I've used to publish Pigs in the Oven on the App Store!
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 26, 2013 4:57 pm

Congrats @0plus1 very great job about wrapping!
B
77
S
20
G
7
Posts: 46
Reputation: 7,840

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: blurymind, ishmaelmoreno, y2j, Yahoo [Bot] and 9 guests