Boat Wakes

Archived discussions related to Transport Empire. Read-only access only.

Moderator: Transport Empire Moderators

Locked
Sprocket
Engineer
Engineer
Posts: 2
Joined: 27 Jul 2006 07:01
Location: Urbana, Il
Contact:

Boat Wakes

Post by Sprocket » 27 Jul 2006 07:45

Hello, this is my first post. I'll start with flattery. I think this project is really a neat thing to be doing, and I hope it goes well. To that end, I would like to code a little (small projects). However, I don't know C++ (as I said, small projects). On the other hand, I am a physics grad student, and I have worked a little with C#, so I might not be totally worthless. Anyways, on to the point of this post.

I haven't seen anything about how you plan to implement water, and in particular the wakes caused by ships in it. A few months ago, I came across a relatively simple method of modeling ripples from a point source that reflect, interfere and even diffract here: http://www.bugman123.com/Physics/Physics.html

Basically it works by looking at a point of water on a grid (smaller than the usual map grid) and subtracting where the water was a short time ago (contains velocity information) from the average height surrounding it (smoothing filter). Remarkably this works well, and you only need to store two arrays (though they might be huge...)

In any case, I decided to give a shot at adapting the method to model a boat wake. Five hours later, what I have still needs work. It is written in Mathematica, and is much too slow. I would like to spend some time writing better code in C++ and seeing how it works there. I with proper smoothing, I think it could look quite nice, and Mathematica isn't well suited for rendering quickly, so it should be faster in C++. Let me know what you think, and whether it's worthwhile for me to go further with this.
Attachments
wake.txt
Messy Mathematica 5.1 code
(1.58 KiB) Downloaded 458 times
wake.gif
Animation: opens with quicktime if nothing else
wake.gif (580.08 KiB) Viewed 8755 times

User avatar
charlieg
Transport Coordinator
Transport Coordinator
Posts: 323
Joined: 08 Oct 2003 14:07
Contact:

Post by charlieg » 27 Jul 2006 10:19

I think it's a nice idea but you seem to be missing a little on the implementation.

To start with (I couldn't tell whether this was your intention) this needs to be a basic pre-rendered animation; it can't be calculated real time because it would be requiring way too much CPU/GPU when you consider all the other things the game has to think about. But, for the process of developing the frames for that animation, it looks like you are on the right track.

Also I know you are probably trying to show off the physics there but the colours are all wrong. Wakes are invariably white on blue-tinted water.

I think you should persevere but try to make it look more like water and try to come up with a set of pngs to overlay onto a water tile.
Open source tycoon games
--
Free Gamer - open source and Free Software games
FreeGameDev forums - open source game development community

User avatar
aarona
Traffic Manager
Traffic Manager
Posts: 221
Joined: 26 May 2006 15:54
Location: Perth, Australia
Contact:

Post by aarona » 27 Jul 2006 12:01

Hi Sprocket, nice to see a fellow physics graduate on these forums!

In response to your water simulation I agree that it can be done and look rather pleasing. In fact in Ogre3D (a graphics engine) one of their examples does this in real time and you can play with some of the physical parameters such as viscosity. The only speed bottleneck is the reflectivity of the water.

I would agree that its partly Mathematica's fault its too slow as I've implemented many Laplacian equation type simulations in C++ sucessfully in the past. I'm sure there are some simplifications which could be made to make it go faster.
charlieg wrote:Also I know you are probably trying to show off the physics there but the colours are all wrong. Wakes are invariably white on blue-tinted water.
The colours look like the default colours Mathematica uses.

Sprocket
Engineer
Engineer
Posts: 2
Joined: 27 Jul 2006 07:01
Location: Urbana, Il
Contact:

Post by Sprocket » 28 Jul 2006 05:20

Thank you both for your feedback. I completely agree that it needs to be polished a lot. And the colors (even the blue) were Mathematica's default. It's reasuring to know that other people have created real time water simulations (even if they were skilled programmers). So judging from your responses (and my own interest), I think I will put some effort into learning a little C++. I've started to create a Water class (basically just comments) that needs to handle knowing where it is, and what the surface looks like, finding what out what it will look like next, and passing this on to another piece of code that will eventually someday exist, and render the water. I'll post again if I get badly stuck, or have something presentable.

If anyone has any thoughts regarding or insight about this algorithm, I'd appreciate the input. From what I did yesterday, I particularly had trouble controlling the wave speed independent from it's amplitude... the two seem to be sort of linked here. Thanks again.
~be proud-- shut up~ (shy person's anthem)

User avatar
aarona
Traffic Manager
Traffic Manager
Posts: 221
Joined: 26 May 2006 15:54
Location: Perth, Australia
Contact:

Post by aarona » 28 Jul 2006 09:19

I've found a good link which shows a good method for implementing ripples with at least 4 parameters. I have seen it in action in the Ogre3D example called Water (the demo of which can be downloaded from the Ogre 3D website.

The web site in question is http://collective.valve-erc.com/index.p ... simulation.

If you could think of a way of implementing this which would not be a 3n^2 process but a 3a^2 (where a << n) then its worth investigating. (I can think of a few) Otherwise as charlieg has mentioned it may take up too much processing time relative to the other game processes.

Locked until the DD discussion arrives at this issue.

Locked

Return to “Transport Empire Development Archive”

Who is online

Users browsing this forum: No registered users and 1 guest