Real-Time Destructible Terrain

Hello, I am wondering which is the best way to create a map that contains both destructible and indestructible terrain. Is it best to store all terrain data in a 2D array or rather should I use Polygons which describe the terrain? Which is faster and more efficient? The map is constructed by a background image and a foreground image which is painted onto the terrain (And erased when terrain is destructed).

With Thanks,

laginimaineb.

[455 byte] By [laginimaineba] at [2007-11-27 1:48:22]
# 1
Make a Terrain class with two subclasses, DestructableTerrain and IndestructableTerrain.
CaptainMorgan08a at 2007-7-12 1:12:23 > top of Java-index,Other Topics,Java Game Development...
# 2
Thanks but what I meant was which is more effective - using a Two-Dimensional Array or using a Vector of Polygons? (Or perhaps a HashTable)?With Thanks,laginimaineb.
laginimaineba at 2007-7-12 1:12:23 > top of Java-index,Other Topics,Java Game Development...
# 3

Vector and Hashtable are legacy classes that aren't to be used...

They're notoriously slow.

But whether an array or a Collection in general would be more efficient depends on a lot of factors, not least of which is the number of expected read and write operations and the relation between those operations as to earlier read and write operations.

jwentinga at 2007-7-12 1:12:23 > top of Java-index,Other Topics,Java Game Development...