Moderator: Transport Empire Moderators
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.
- Messy Mathematica 5.1 code
- (1.58 KiB) Downloaded 547 times
- Animation: opens with quicktime if nothing else
- wake.gif (580.08 KiB) Viewed 10433 times
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.
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.
The colours look like the default colours Mathematica uses.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.
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.
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.
Users browsing this forum: No registered users and 2 guests