simple water by shinkan

0 favourites
  • 8 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • 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

  • 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! : )

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)