2D water with dynamic waves

Posted by user1103457 on Game Development See other posts from Game Development or by user1103457
Published on 2012-11-27T15:26:15Z Indexed on 2012/12/11 11:18 UTC
Read the original article Hit count: 314

Filed under:
|
|
|
|

New Super Mario Bros has really cool 2D water that I'd like to learn how to create.

Here's a video showing it. When something hits the water, it creates a wave. There are also constant "background" waves. You can get a good look at the constant waves just after 00:50 when the camera isn't moving.

I assume the splashes in NSMB work as in the first part of this tutorial.

But in NSMB the water also has constant waves on the surface, and the splashes look very different. Another difference is that in the tutorial, if you create a splash, it first creates a deep "hole" in the water at the origin of the splash. In new super mario bros this hole is absent or much smaller. I am referring to the splashes that the player creates when jumping in and out of the water.

How do they create the constant waves and the splashes? I am especially interested in the splashes, and how they work together with the constant waves.

I am programming in XNA. I've tried this myself, but couldn't really get it all to work well together.

Bonus questions: How do they create the light spots just under the surface of the waves and how do they texture the deeper parts of the water? This is the first time I try to create water like this.


EDIT: I assume the constant waves are created using a sine function. The splashes are probably created in a way like in the tutorial. (But they are not the same, so I am still interested in how to make this kind of splashes) But I have a lot of trouble combining those things. I know I can use the sine function to set the height of a specific watercolumn but the splashes are using the speed, to determine the new height. I can't figure out how to combine those.

Not that I am not asking how the developers of new super mario bros did this exactly. I am just interested in ways to recreate an effect like it.

This week I have an examweek so I don't have time to work on the code. After this week I will spend a lot of time on it. But I am constantly thinking about it, so that's why I will be checking comments etc. I just won't be looking at the code since it might be too time-consuming.

© Game Development or respective owner

Related posts about XNA

Related posts about c#