Advertisement

Data Structures/Ideas for destroyable scenery like in XCOM?

Started by March 19, 2001 02:58 AM
3 comments, last by onnel 23 years, 10 months ago
I''ve been working on a 3d Tilebased game and really want to have "destroyable" terrain. It''s easy enough to create a system for destroying walls and objects, but what I really want is a sytem where destroying walls and supports can effect larger structures (XCOM being the best example of this, where blowing out walls and the like could cause buildings to tumble down). Does anyone have any recommendations for data structures/algorithims for supporting these kind of effects? Being tilebased obviously makes things much easier, and since XCOM already did exactly this, I figure there''s got to be some info on it out there. Any help appreciated! Thanks! Onnel
Dependant on how simple or complex you wish to make it ...

Deformable terrain is a matter of having 4 height values for each corner of the tile and modifying those accordingly.

For buildings, you have levels/floors. Each floor tile has a Structural Integrity value for each corner. If a wall below an upper wall (or roof) is destroyed, you set the SI of each corner (of the level ABOVE the destroyed wall) to 0. If three (two if you want more easily destroyed walls) adjacent corners = 0 then, you destroy the wall, and update the values above it as well. If you''re talking walls, have each tile have a "byte wall" value and use bit flags to set and destroy the walls. For total building destruction, you can preset a Minimal Structural Integrity value, and if the total of all levels drops below this, demolish the building.

Sorry it''s not very clear, I hope you get my drift.
Advertisement
Thanks for the reply. I''d gotten about as far as all of that myself. I''d like to go even a step beyond with a slightly more physics based model, but that''s easy to manipulate.

My main question would be, how would you recommend building the data structure to hold the relationships? I.e., a wall goes away, how do I find the bits attached to it (especially in case where it''s not just the square DIRECTLY above)?

I guess I can define vertain objects as spanning squares (for example an arched support may actually go under several squares of a building or bridge). This is because destroying any one of the squares effects not just the square above it but also the squares along side it in a case like this.

This may end up being more work than it''s worth, but I thought I''d see if anyone had some good ideas!

Thanks again,
onnel
It seems, that you have same things to do, that i done/have to

Destroying the walls/buildings is a bit complex.
For good-looking physical based building demolition, each tile must contain MANY additional properties.
I didn''t taken much time to this problem because i don''t think, that destroyable terrain worth this. Yes, it''s cool, looking how building starts ripping apart, but implementing such thing can be a brain damage Also, for dynamic terrain you will need a MUCH more memory and processor power, than static terrain. I don''t think that modern average PC (let say PII-300 with 64/128Mb) can handle with it. But who knows

Here are my thoughts about this stuff:
The more physics in your model - the more realistic it will be.
Each tile must have a mass and connections to adjasted tiles - let''s say "welding", in 2D - 8 welding connections, in 3D - 8+9+9. You can skip diagonal welding, then you''ll need 4 for 2D and 6 for 3D.

Assume, that with welding = 0, tiles is not connected by anything. The bigger welding value - the more stronger connection is. For example an adjasted wall tiles from bricks will have a bigger welding than tiles from wood. And steel wall much stronger than a brick wall. But this is tricky! Sometimes, to break a brickwall is much easier, that break a wooden wall - this is because wood lighter than brick.

This is a good reason for making model in such way - the difference in connections (weldings) between tiles will help you to manage object destroying process flow, determine cracks and which parts of object will fall, which will stay , e.t.c.

How to determine, when and at which point your object become unstable, when it''s taking damages?
The situation is a very simple(physically): when particular tile is destroyed, or physical model changed somehow (when pink elephant lands on roof of your cottage ), you must recalculate a connections between tiles - calculate a new forces of gravity and reaction for each tile.
Inspect each tile - is it''s summary welding is strong enough to compensate it''s gravity+reaction forces. If not, break the most weaker welding (or randomly select one from the equal weldings), then recalculate model again. If no connections left for tile or block of connected tiles, then they will fall.

As you can see, this is only a top of the iceberg You must implement a good and fast model recalculation. Implement algorhytm, which determines blocks, which will fall and so on.
Start testing your model from playing with arc/archway. Then try to build something more complex, like brigde section.

WBR, sig
mailto:sig@sig.kiev.ua
Anon,

Thanks for the great info. I may not go as in depth as to get a full blown deep physics implementation, but since I will be testing the structural integrity very rarely (changes will be rare and stability will be assume by default until a change is made by the player (rare), I should be able to make it "realistic enough" without having to stress too much about the speed of it. Thankfully, no real/hyper time physics engine is needed...this time around!

Thanks for the good info.

Onne

This topic is closed to new replies.

Advertisement