Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Destructible Objects or environments?

Author
Message
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 11th Aug 2011 23:44
Hey everyone. So id really love to add into my game the ability to destroy a wall of a building. And i mean any wall of any building in a city.

One way ive thought of is to basically make a ruined building with all the holes in it and then cover up the holes with objects that all essentially have health and who wait for someone to reduce that health so the hole appears. That doesnt seem terribly efficient to me.

Im not talking about brining down a building or anything, just breaking through walls. Physics dont even have to be involved, i just want to know a good way for this to work.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Aug 2011 00:14
This is not easy to achieve for a whole city unless the city is made of repeatable components. If you have 20 different types of wall for example.

I would build two different versions of the wall, one in peices and one whole. Use the whole version until the wall is damaged.

You'll need to start thinking about optimising which parts of the city are visible and consider using LOD (Level of detail) for each wall too.

Cities are terribly difficult things to do well but that's a place to start!

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th Aug 2011 10:27
You could also use the CSG commands to remove sections of wall too. But that will eventually slow things down if used repeatedly.

My signature is NOT a moderator plaything! Stop changing it!
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 12th Aug 2011 16:09
I really want to do a game with a fair sized city where you can go into any part of any building. The insides would be more or less bare though, so not like a full decorated city.

And Mobiius, can you give me an example of the commands and how theyd be used, also what do you mean by repeatedly? I guess it depends on the example.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th Aug 2011 17:14 Edited at: 12th Aug 2011 17:16
Search the DBP help files for the CSG commands. There's an example in there.

(They're in the gamefx section.)

My signature is NOT a moderator plaything! Stop changing it!
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 12th Aug 2011 20:00
OH ok, i know what you mean now.

I just had a thought too, i wonder if i can work the "difference" command in such way that when a wall's HP is down to 0, an object is made in front of the camera and then differences with the wall and is then deleted or something.

something along those lines anyways.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 13th Aug 2011 20:07 Edited at: 13th Aug 2011 20:19
You could run enough bricks for a small city, and update them a distance from the camera. You would be surprised how many object you can get on a screen without much slowdown. I have worked on programs with over 20,000 objects, and they were sphere (I run 50,000 sphere as well, but with 6,4 columns, rows), bricks probably 60,000 could be handled. Or you could just switch fake walls for real walls when they are hit. That's what I would do come to think of it. I'd also make a building designer editor to manage the walls. Build a real wall from bricks, then press PrtScn to get a texture that matches it perfectly. Then texture the fake wall with the real brick wall, and when they switch you will not notice. Then use the new fake wall as a lego part.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Aug 2011 23:38
I've been wondering for some time if I could stretch a UV map over numerous objects, which would help in this case, ie pieces of a wall.

Most other games that have destructable objects just cheat,using an image or object for showing a percentage of damage (maybe 5 images, 100% health down to nothing in stages). Probably easier than taking the pieces apart, and also probably quicker than having lots of smaller objects or images that make up the 'wall' or object.

For a large scale scenario as you're mentioning, then set stages of destruction would be a better option.

Warning! May contain Nuts!
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 24th Aug 2011 17:23
Ok i came up with an idea that suits my needs AND should also be super easy to implement, i just am not efficient at coding such things yet.

Basically you give the player a command list like...

1: Make Wall Hole
2: Make Floor Hole (etc)

and when they pick one of those, a ghost object comes up that represents where the hole will be placed and itll be green or red, green for ok to place, red for not ok to place. Once its green and you click yes, then it makes a Difference hole using the ghost object and the wall.

There can also be easy little rotate commands to make sure the object is aligned the way you want it to be, or force align it to the wall object or floor object.

The main issue i can see now is hit box issues so you can then move through the holes.

Login to post a reply

Server time is: 2026-07-10 19:06:34
Your offset time is: 2026-07-10 19:06:34