Saturday, May 18, 2013

Realtime Terrain Manipulation

Now that I have a game world split into cells, it can allow me to easily do some fancy things, such as targetted real-time terrain manipulation.  Think Populous where you would raise or lower the game world  or spells or technology that can cause a mountain or crater appear at the feet of an enemy (or player!), and have that mountain or crater become an actual part of the game level.

There are other things to focus on before this.  Camera setups, entity management, path finding - they take priority.  But I am going to revisit this.

I found a script on the forums.  Its in Java, I'll convert it to c# at a later date.
http://forum.unity3d.com/threads/87086-Realtime-Unity-Terrain-Manipulation-Possible?p=755093&viewfull=1#post755093

I ran the script as directed.  The end result is nothing fancy, just random heights being applied to a specific section of the map without recalculating the entire terrain.  That last part is important because recalculating the entire terrain mesh every frame is a massive performance hit.

All I need is a script to simulate curves...... mmmm curves...