Tuesday, January 22, 2013

Morgan - Waves, Wind, and Wheels

Wave and Wind Tuning

I'm now taking the basic water simulation (which is based on a classic latice method / demo scene hack) and wind model and tuning it to produce realistic phenomena. The advantage of modeling reality is that robust and plausible behaviors will result if the input and model are reasonable.

Most of the G3D scene editing tools (not to mention the floating point precision) work best with scenes that are on meter scale.  The ships that I'm simulating average about 150' (46 meters) in length, so I modeled everything in the game at 1/45 scale.  This makes a typical ship about 1m long.  The relative scales for some key lengths and speeds in the game are below:
                             Real        Game
Ship length                 45.0 m      1.00 m
Hull speed                   9.5 m/s    0.21 m/s
Strong breeze               14.0 m/s    0.30 m/s
 Wave height (2 * amplitude)=3.0 m      0.07 m

Version 1.8 of The Graphics Codex includes a table of lengths of common (game) objects that provided the other data I used in simulation.  I'm working on a similar speed table for the next version and used a variant on it to calibrate other in-game speeds and lengths. Tomorrow night I'll actually integrate these numbers and tune the ship.

For modern ships, one can find polar speed profiles for maximum performance as a function of point of sail (relative to the wind) at various wind speeds.  For example,

From http://j30.us/ubbthreads/ubbthreads.php/topics/8817/Re_J30_Polars.html
for a modern Bermuda rig 
Based on some historical accounts, plots like these, and advice from sailing friends (my advisor John Hughes and father Mick McGuire), I formed coarse models for square, gaff, and Bermuda rigs.  For example, my square-rigged model is:

My first model of a square-rigged ship's polar speed profile

I also created a rudimentary model of heel based on trim and point of sail. My constants are all off, so right now the ship is nearly impossible to sail to weather (although that isn't entirely unrealistic for a square-rigged ship!)

UI Evolution

The figure on the right shows the evolution of one of the user interface elements, the ship's wheel. When I switched from direct control over the ship's heading to controlling a rudder, I found that the delay in the ship's movement made the controls feel as if they were nonresponsive. It was also hard to steer straight. For gameplay reasons, I needed a control to show the rudder's current orientation.  A ship's wheel was the natural design, so I showed the top half of the ship's wheel on the bottom of the screen (design 1) in gray.  When steering, it was then immediately apparent that the rudder was moving and the same controls felt good.  I also changed from using the left controller stick as a joystick to using it as a "wheel"--the turn motion is to spin the stick instead of push it to one side.  I was surprised how this simple gesture (very much in the style of Quantic Dream's interfaces) greatly improved the feel of steering the ship.I then made a visual iteration (2) to make the wheel match the design language of the rest of the interface.  It became hard in that new style to know when the wheel was centered, so I made the top pin brighter (3) to restore gameplay functionality.  Although that is based on real ships' wheels, it looked odd in this user interface.  Mike Mara suggested using a gradient instead.  I tried several and settled on a white to blue gradient that focuses on the top pin and extends in both dimensions (4).


I needed to add the sound of a luffing sail to indicate when the boat is pointing too high, which is a critical feedback mechanism for sailing.  The irrKlang audio API that I was originally planning to use didn't support 32-bit operating systems and was poor at managing looping sounds.  I switched to the FMOD audio API and added the luffing sound. It actually plays continuously in the background and the volume varies with how high the ship is pointing and how well the sails are trimmed.


I fixed screenshots; they were broken by not unbinding an OpenGL pixel buffer object after reading back a texture for the CPU in the water simulation. I found a new bug in the bounding box and sphere computation for G3D::VisibleEntity and corrected that.

I didn't work as much as I intended tonight and am a little behind schedule. Tomorrow I'll work on the other tasks that I had planned for tonight:

- Visual Luffing indicator
- Load / save Design for ship dynamically
- Design editor
- Make water height conventions consistent throughout the program (e.g., tide level, world-to-water scale)   
- Implement and tune wind waves
- Model the world
   - Add buildings for scale and texture
- Fix water height sample queries under position change

No comments:

Post a Comment