0 Favourites

simple water by shinkan

  • Hi,

    I am new to construct 2. I came across an old post of how to create water in construct 2 by Shinkan.

    https://www.scirra.com/tutorials/1124/s ... ter-plugin

    so I thought of trying out some modifications to get a boat on the surface just to see how this works with physics. Basically I connected all the waterControls with sprite instances, applied physics behavior to them along with the boat. Everything seemed to be working well until this crash with the following error message:

    https://www.dropbox.com/s/n4tpouyhog9zz ... e.JPG?dl=0

    I'm not sure what those error messages were saying but it seems like they were referring to construct 2 physics error? Anyways here's the capx. Thanks in advance for taking the time to check this out.

    https://www.dropbox.com/sh/c4t264eozkz1 ... ZNCLa?dl=0

  • Out of interest, is that with box2d web or asm.js?

  • I see you went a step ahead of me when I was playing with it. For all my tests I've been just adding sine behavior for all my ships xD

    Anyways, I run your capx with few different settings and never got this error message. And just to let you know, Canvas+WebGL don't work so great (one of the reasons I abandoned that project) but good luck!

  • donutpond

    I remember having a lot of fun with the capx shinkan made way back then. I tried to make the waves look a little rounder, and I wanted to make splashes too, so I ended up adapting some formulas I found somewhere. It worked well on my desktop, but I was disappointed with the performance on my iPhone... I meant to post a link back on the original thread but never did.

    To have things float in the water, I have a row of invisible sprites with the solid behavior - they get updated to the water's surface (minus an offset to make things look partially submerged).

    Press space bar to make waves, or click the mouse to make a splash. The beach ball has the platform behavior so you can move it around with the arrow keys. (Flushing drains the water, then it fills up again)

    try it out here: http://www.rieperts.com/games/Water

    you can get the capx here: http://www.rieperts.com/games/forum/water.capx

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Colludium

    oh my, I think you just fixed the crashing issue, I was using box2d asm.js for the physics engine. After switching to box2d web, the crashes stopped! I have no idea what's the difference between the 2 engines, but they seem to look and perform the same (by eyeballing).

    @shinkan

    thanks for the original demo. It's really awesome. I was just exploring that construct 2 can do, so was fiddling with various tutorials and plugins.

    @AllanR

    that's a pretty awesome adaptation you got there! I have no coding experience, your capx looks really impressive. Looks more like actual C code than construct 2 lol. I tried it on my mobile and indeed the performance is super sluggish where as it worked very smoothly on the desktop. Do you know why that is?

  • Aha! I had my suspicions - the asm.js physics is still rather beta and, in my opinion, may never reach full functionality because its use here depends on 3rd party updates.

  • Ashley says asm.js is much faster than the old Box2d web. But there are known bugs in the asm.js that cause crashes like that. Chipmunk Physics is a really good alturnative (plugin by Rojohound). It is the fastest as far as I can tell, however asm.js is more accurate in terms of simulating real physics.

    I think it is sluggish on mobiles because they have much weaker GPUs and can't handle the constant flood fill that creates the water - plus in my version the subroutine that calculates the splashes and smooths out the waves is pretty cpu intensive as well. But I know it should be possible to do on mobile because Jetpack Joyride does it just fine - they must have found some way to optimize the process! : )

  • AllanR

    Sorry for bumping old topic, but I was wondering is there any way to have multiple instances of the water and have each instance of waves behave individually from each other (without duplicating / renaming the objects and events)?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Simple Zombie Game [Devlog]
54 4,612
Lou Bagel's avatar
Lou Bagel
Unread hot topic
48 2,053
Drago_18's avatar
Drago_18
Unread hot topic
0 Favourites
[Effect] Simple Glow
42 12,467
Lordshiva1948's avatar
Lordshiva1948