Speed boat "ricochet"

Topics: Developer Forum
Jul 26, 2012 at 12:11 PM


I am planning to try and create a speed boat game viewed as a 2D sidescroller.

The goal is to use the water physics as a gameplay element.

To do so, I will need a few features :

- The boat will have to react to the water's surface as a speed boat would, meaning "ricocheting" on the surface.

- I would love to be able to make the boat dive underwater a bit when colliding the surface at a certain angle.

- The surface will be dynamic (waves and all !).

Any advices on how to do these things without drowning the CPU ^^ ? ! ?


Jul 26, 2012 at 7:50 PM

I would probably do the water surface as a line of edges, and then deform the vertices as needed. First you of course need a system that will filter out all the "out-of-screen" vertices, which shouldn't be updated since they just eat up your processing time. By doing the deformation on the visible vertices only you might get a nice amount of vertices to work before you "drown" your CPU. The more vertices you have, the smoother simulation you get, but of course, the more it will cost processing time.

The small diving can be done in numerous ways, but the first thing to pop to my head would be to scale the physics body of the boat on the moment of impact, possibly basing the amount of scaling on the velocity on the time of impact. Another method of doing this would be spring joints.

The ricocheting of the water surface may or may not happen by "happy accident" if you set the restitution correctly and have a nice, dynamically deforming water. It's hard to say what will do before you have the whole system up and running, and then by tweaking friction, restitution, center of mass, possible joints etc. you can find the optimal solution - if one exists. If not, then you might have to write your own implementation of physics. Maybe a some sort of "loose" physics simulation would be fit..?

Just my two cents :)

Jul 27, 2012 at 8:16 AM


Thanks for the advices.

I was thinking the same way for the dynamic water surface.

The small diving can be left on the side for now...

The ricocheting on the other hand is quite essential ^^ ! And I'm a bit sad that there is no magic property that allows it ^^ !

I'm going to start making my water surface and boat and try a few methods, maybe something not that complex will do the thing, as you said.

If I end up stuck, I probably won't try to make my own physics system, seems like to much work for a really small game.


PS : On this sample, if you lower the linear drag a lot, things start "ricocheting" although rotating a lot on themselves, and pumping up the rotational drag seems to be enough to fix that !


Jul 31, 2012 at 1:14 PM

Hey !

I tried a few things but quickly found out that the buoyancy controller would only accept a AABB as container... which completely ruins the whole "wave" thing ^^ !


In this sample, there seems to be support for buoyancy polygons.

So in the end : possible or not ???

If I really need to, I might end up building my own water controller, but this kind of things means a lot of work and I really wish we could just use a polygon or triangle list as container for the buoyancy controller.

Jul 31, 2012 at 4:13 PM

That's the waves controller from 2.x series. It was removed in the 3.x series. I wish to actually implement a similar thing back into my current code-base as I want to simulate water. Maybe we can partner up and I can share my progress; and we can make a new WaveController for both our needs. I'm wanting to simulate water to push things and have them "float". 

Aug 1, 2012 at 2:40 PM

I would love to have a buoyancy polygon, but I really don't have enough time to do this, even with help ^^.

But, the way I see my water controller is quite simple (although really not physically accurate) :

- the water polygon would be managed with a simple model, not based on physics, more of a "trick".

- then, my boat would have "floaters", simple points attached to its body. Each floater, when immerged will apply a force on the body at the floater's position.

That's how I picture it, I will have to implement a small test to see if the given results are promising or not.

If this gives me good results, I'll keep everyone informed via this discussion.

Anyway, good luck with the WaveController approach, I wish you could succeed ^^, farseer really needs some advanced water physics !

Aug 7, 2012 at 2:07 AM

The buoyancy controller that used to be in the engine had several problems with the 3.0 series. I tried to fix them, but never got around to do it. The buoyancy itself is pretty simple. It is based on Archimedes Principle on water displacement and simply apply an force to the submerged element, taking the amount of submerged mass into account.

The wave controller itself was a list of vertices that deformed, causing the submerged mass to be different. I would love to see a good working solution, if any of you get around to implement one, let me know.

As for the boat planning on the water, it occurs when the lifting force becomes higher and the displacement volume becomes smaller. I'm not sure if this concept can be implementing using a buoyancy controller alone, but I would think that it is possible with such a controller and some added upward force applied to the hull at high speeds. The reason I don't think it would work alone, is that the buoyancy controller basically works like a high linear drag and a small upward force - moving in it at high speeds would not cause the upwards force to become higher.