Copyright 1999-2014 (c) Synthetic Reality Co

Synthetic Reality:
Company Store
Contact Us

Well of Souls
Warpath 97
Warpath Classic
MIX Game Server

Rocket Club
Galaxy Simulator

About Us

This is another useless demo program, and is a serious number cruncher with which to task your high powered computer. This program is FREE, not shareware. Just enjoy it.

What Is synWater?

Aside from an interest in simulating wave action on the surface of water (remember those 'ripple tanks' in high school physics?), I also was experimenting with higher color resolution DIBs. This program uses 16 bit color DIBs (and as a result probably won't run under NT, just to warn you). Only after I finished it did it hit me that only meant 5 bits of 'blue' and 32 shades is not as amazing a spectrum as I was idly dreaming about while coding it.

Overall, I know I will be writing a sailboat simulator (I should say ANOTHER sailboat simulator) someday and I am thinking about water off and on as a result. I had an insight that the wake behind a boat might be modelled as a large number of expanding circular wavefronts displaced in time (imagine the rear end of the boat dropping pebbles in the water at regular intervals as it moved along)

Thus was born synWater. Once running, you click in the water area to start a drop going. I think I limit you to max of 10 simultaneous drops. The resulting interference patterns can be quite pretty (and I think very water-like in way)

Running the Program

Well, just download the executable and run it.

synWater version 1.0 synWater.exe

It is a dialog-based MFC app written in VC++ 4.2b

The Controls are:

  • Drop-down combo (100x100) for setting size of computation frame. This is an N-squared implementation, so you need a power computer for larger computation frames.
  • Rain: Click this on to automatically drip the occasional drop. You can still click manually to start a drip
  • Drift: Adds a fixed linear motion to the water (like dripping into a stream instead of a pond)
  • Add Color: Tries to get more than 32 shades by mixing 2 hues.
  • spectrum: enables a little spectrum scale along the left side, just to show order of colors
  • stretch: you can resize the window to any shape you like, but the computations will still be limited to the size you specified in the combo box. But turning on stretch means that the computation space is stretched to fill the current display size. A POWER user doesn't use stretch!

There's really not a lot to this program.

The Math

This is more an example of my implementing a model which I thought would be useful later in a game, rather than trying to simulate the underlying physics of particle and wave interactions. My reasoning went like this: Imagine that every disturbance in the water can be modeled as a 'drip' of a particular intensity starting at a particular moment in time. From the perspective of the drip, there would be a circular wave front pushing out from the center of the drip. Viewed from the side this would be a sine wave which would start off with a peak set by the initial drip magnitude and would then peter off slowly with some decay value. A single drip in the center of the pond would affect the elevation of every other point on the surface of the pond with an equation similar to this:

delta time = distance/velocity ; distance of this point from the center, velocity of wave propagation

elevation = (K1/(1+delta time)) * sine(K2 * delta time)

I like to think of the drip in the middle continuing to bounce up and down (initial weight of drip presses it down, then pressure of surrounding water fills in the depression but makes a little hill, which is then pulled back down by gravity which makes a valley and this repeats over and over becoming the foundation of the sinusoidal wave). And then slowly petering out, but each new ripple in the center makes a new circular wave front which propagates out from the center at a certain velocity, decaying in amplitude the further it gets from the center.

So basically I wrote an equation which gives the elevation of an x,y location contributed by a single drip, then called it repeated for each possible x,y location in the computation space. Then I convert the elevation to a color and display it.

Then I made an array of drips and ended up with this:

for ( x= min to max)

for ( y = min to max )

elev = 0

for ( drip = 0 to max )

elevation = elevation + F(x,y)

next drip


next y

next x

Given that the inner loop (called 100*100*10 times in the default case) contains a squareroot, a sine calculation, and several multiplies and divides, it is clear to see why this is so slow!

But it's so pretty! :-)


synWater is the property of Synthetic Reality and all rights are reserved. If we can figure out a way to convince people to pay for this, you can be sure we'll give it a try. But for now it is expressly intended to provide a moment of joy for the math geeks in the audience, looking for number-crunching programs to show off their power computers!

Thanks for your feedback in advance!

Dan Samuel
Synthetic Reality Co.