Game Development Community

Destroyable terrain

by Jussi Lepist · in Torque Game Engine · 01/18/2002 (6:21 am) · 6 replies

I'm making a 3D Scorched Earth style artillery game with Torque. I haven't played around with the engine very much, but I understand it doesn't support destroyable terrain (ie. terrain modified during play).

I was thinking of modifying the engine myself to handle that. Can the height map be modified with scripts during play? Also, the modified part of the terrain would have to be relighted, maybe by modifying the lighting code to light only part of the terrain again. Are there any other changes or calculations that would have to be made when terrain is changed?

-Jussi

#1
01/18/2002 (6:45 am)
religthing is very slow. so it isn't possible to relight the terrain during the game. you have to do much coding on the engine it self to come up with your idee. but of course it's posible. i think you can't alter the heightmap by script. but maybe there's something in the code of the terrainrenderer. i don't know it exactly.
#2
01/18/2002 (6:51 am)
Yes, relighting the entire scene is slow, but I would modify the lighting code to only relight the modified areas of the terrain. I don't think that would be VERY difficult, but I don't know before I have checked the code. If the relighting would happen only on a small area, and since it happens only once for each explosion, I don't think it would be even noticeable. I'll have to experiment...

-Jussi
#3
01/21/2002 (12:45 pm)
You could do pre-selected portions of the terrain.

You'd have to make the terrain initially have all the blown up areas, and make shapes and objects to represent the portions that get destroyed.

Then you could make the explosion anims and such.
#4
01/21/2002 (12:54 pm)
but would those sections have to be relighted?
#5
01/22/2002 (7:54 am)
By destroyable terrain I meant "dynamically" destroyable terrain, ie. there would be no predefined areas that could be destroyed, but the explosions would directly modify the height map based on the size of the explosion and distance of the height map point from the explosion.

-Jussi
#6
01/22/2002 (9:12 am)
Of course, currently the heightfield is stored in the .ter terrain file. It seems that you're talking about storing the heightfield in a cache or creating a temporary terrain file that gets modified/accessed during the game without destroying the original. Then it would be the problem of determining which tiles have been modified and to what extent, modifying the lightmap for that section and passing that info to the server. I asssume this also means maintaining a dynamic lightmap cache. Sounds like a great idea--don't know if it's doable--but you'll never know unless you try :).