Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: WMCoolmon on August 28, 2005, 01:46:22 am

Title: Explosion idea
Post by: WMCoolmon on August 28, 2005, 01:46:22 am
In a code freeze, but I had this prototype idea :p

Groupable polies. A discussion about realistic explosions triggered this. The idea is that, instead of having a big explosion that goes from LOD0 to Debris, the polies in LOD0 actually break apart and drift. Although you'd have to add a whole bunch of polygons for it to work properly, the effect would be pretty sweet and a nice variety compared to the current system.

The best example I can give is the Wraith hive ships exploding in Stargate Atlantis.
Title: Explosion idea
Post by: DaBrain on August 28, 2005, 02:18:14 am
Isn't this possible with a debris stage that has the same ammmount of details the lod has?
Title: Explosion idea
Post by: WMCoolmon on August 28, 2005, 02:52:36 am
If that's the case then why hasn't anyone done it yet!?!? :p
Title: Explosion idea
Post by: redsniper on August 28, 2005, 01:06:29 pm
wouldn't that just give us a whole bunch of triangles floating around instead of chunks of debris? :confused:
Title: Explosion idea
Post by: Prophet on August 28, 2005, 01:17:49 pm
Ship explodes and leaves behind a cloud of dust :wtf:
Title: Explosion idea
Post by: Black Wolf on August 30, 2005, 08:23:57 am
Quote
Originally posted by WMCoolmon
If that's the case then why hasn't anyone done it yet!?!? :p


They have, as you'll see when VA releases his high poly pack in a few days/weeks/whatever it was going to be. He also does all the TI ships that way. Looks awesome.
Title: Explosion idea
Post by: phreak on August 30, 2005, 09:52:14 am
Any way we could have a table field that can specify how long a piece of debris lasts and perhaps its explosion characteristics?  I figure a piece of debris that houses a reactor will explode with greater dmg than a piece of generic debris from the superstructure of a ship, we could also add the emp effect to add insult to injury.  Also perhaps a maximum and minimum velocity something gets thrown.
Title: Explosion idea
Post by: DaBrain on August 30, 2005, 10:12:08 am
Quote
Originally posted by WMCoolmon
If that's the case then why hasn't anyone done it yet!?!? :p


I think I'll work on a test model for this. ;)

I hope it's not too complicated.
Title: Explosion idea
Post by: Vasudan Admiral on August 31, 2005, 03:05:52 am
It can be done - though with HTL ships, you're obviously not going to make the debris as high-detail as the ships. ;)

The fenris for example uses the 'crack apart' technique - (11 chunks made out of the original fenris model), but the problem crops up when the debris begins to drift away - most of it usually spontaneously combusts before getting anywhere, just leaving the odd piece here and there.

Any chance that could be fixed/improved upon? (possibly based on how many ships are in the mission due to performance issues?). It's a bit hard to get the 'crack apart' feel if most of it only travels 10m or so. :\
Title: Explosion idea
Post by: AqueousShadow on August 31, 2005, 07:19:55 pm
Damage per piece would mean significantly lowering the damage each explosion does...unless you'd like to kill everything by blowing up a Hermes or a crate :lol:

About the crack apart...what would increasing the hull of the debris do? Or do the pieces randomly blow up as a followup from the ship exploding because that's the way the destruction events are made?
Title: Explosion idea
Post by: Carl on August 31, 2005, 07:39:22 pm
Quote
Originally posted by redsniper
wouldn't that just give us a whole bunch of triangles floating around instead of chunks of debris? :confused:


Exactly. And the holes it left in the ship would be transparent and make the ship look hollow. It would look so fake and silly, you'd laugh at it every time you saw it.

I don't see how you would get this idea from a discussion on realistic explosions.
Title: Explosion idea
Post by: WMCoolmon on August 31, 2005, 08:26:23 pm
Quote
Originally posted by redsniper
wouldn't that just give us a whole bunch of triangles floating around instead of chunks of debris? :confused:


"Although you'd have to add a whole lot of polygons for it to work properly" is what I was talking about. You'd need to have something on the 'back' of the debris, that was 'inside' the ship...like a giant puzzle, except with 3D pieces.
Title: Explosion idea
Post by: Vasudan Admiral on September 01, 2005, 02:40:39 am
Quote
Originally posted by AqueousShadow
About the crack apart...what would increasing the hull of the debris do? Or do the pieces randomly blow up as a followup from the ship exploding because that's the way the destruction events are made?
Can't change how much err...debris integrity... each piece has, so it's the latter case.
Just a small modification that increased the debris survival rate - preventing some or most of the spontaneous combustion - would probably work really well in creating better looking explosions and help make more debris strewn battlefields. :)
(The bits do still fly away very very fast though, which could be another thing to look into. ;) )
Title: Explosion idea
Post by: IPAndrews on September 01, 2005, 04:29:32 am
Great. A discussion about explosion effects. Prompted by a SCP coder no less :D. I'm going to take the opportunity to jump in here. Certainly the explosion effect is looking a bit poor at the moment and is probably in need of looking at. Even the effect as it stands now has some issues:

1. When the ship splits in half the two halves move away from one another far too quickly for large ships. When Babylon 5 explodes for instance the two halves must be at least 50km apart by the end.

2. Too many pieces of debris explode immediately and never make it away from the ship's explosion.

3. Those pieces of debris that do survive fly away from the explosion too quickly.

Now as I understand it WMCoolman is suggesting getting rid of hand-modelled debris geometry from game models entirely and generating it on the fly? So you would split up the surface of the model into groups of adjacent polygons. I think this is the basis of a great idea.

You could also add some stuff into ships.tbl to let modders tweak the effect from ship to ship. Such as a setting to tell the game the percentage of the ship's surface that will be turned into debris, and another setting to tell the game how many seperate debris objects/groups of polys should be created.

The issue though as mentioned is what to do with the back of the debris objects you create. The bit that was "inside" the ship.

I believe there are a few approaches to this. The first is to make the polygons double sided and paste a generic debris texture onto the back. The texture could be specified in ships.tbl . This would mean that your pieces of debris would look like bits of the ship's skin that have come off. This might be appropriate in some cases like for smaller ships such as fighters, but used on big cruisers it might make them appear somewhat hollow.

In the case of bigger ships you really want big chunks of debris. You want the ship to crack apart. So in this case you're going to have to create some "inside ship geometry" for the back of the ship skin polygons to give it some solidity. You can texture that geometry with a table specified texture that might be a repetition of decks of ships and compartments and stuff and the geometry itself could be fairly basic. Your standard asteroid-esque irregular solid. You would though need to ensure that the inside geometry of your debris pieces did not overlap.

As simple as the "inside ship geometry" could be I still imagine it might be quite difficult to generate on the fly. Especially if you are worried about such things as the inside ship geometry of different pieces of debris overlapping. That would take a bit of thought to achieve. I have this idea in my head of picking a few random vertices inside the ship and using those positions to generate all the inside geometry for the different debris pieces, but I haven't thought it through ;)

Still either of these two, or even better a table defined combination of the two...

$percentagechunkdebris: 65
$percentageskindebris:    15
$debrisobjects:                 10
$chunkdebristexture:        ship_compartments.pcx
$skindebristexture:           smouldering_metal.pcx

... might work extremely well and mean the end of that most tedious part of model making, debris modelling.
Title: Explosion idea
Post by: Flaser on September 01, 2005, 09:52:41 am
What if the basics of the ships's interior were vowen into the model to be a basis for said generation?

No I don't mean a full fledged modelling of the interior along with texturing it. Only basic geomertry.

The things that would make sense to be modeled though would be:
-The frame
-The reactor cavity
-The engine cavities

The frame, since it will show up as strong metallic beams and could be a prominant feature that transforms debris from floating bricks into a crushed piece of engineering.
(Beams, stuts ect. - Preferably with a tiled texture)

The reactor since it will be the heart of the ship - by using a submodel we could make it the heart of 'the main explosion' and have it spew 'plasma'- particles all around. The reactor also holds 40-60% of the machinery in the ship.

The engine as it's the bigest hollow part inside.

Beside modelling we could assign sections to the geometry.
I think of helpers or a basic low-poly models as helpers.
It doesn't tell the actual geometry of the ship, but divides it into sections:
-machinery
-crew quarters
-ammunition bays
-frame*
-reactor*
-engine + engine cavity*

So when the ship's spliced up, these helpers will tell what type of texture to use for the exposed/created polys.
Title: Explosion idea
Post by: Vasudan Admiral on September 01, 2005, 10:10:06 am
Uh, those ideas are going a bit over the top me thinks. Seriously, debris - even full ship crack up debris - are easy and fairly quick to make, probably look better than any autogen will, won't cause nearly as much technical or performance issues and most of all won't require our poor overworked coders to spend weeks implementing. ;)

All we really need for good explosions and debris is for all or most of the pieces to remain intact after 'sploding, and for them not to race off too quickly for an appointment with infinity. Us modders can do the rest. :)
Title: Explosion idea
Post by: WMCoolmon on September 01, 2005, 10:58:18 pm
Not generated debris, no.

What I'm saying is, right now what happens is that the ship explodes, and multiple pieces come out of it, but actual debris LODs tend to consist of very few polygon chunks - the actual conversion seems to be masked by explosions.

Instead, I'm saying, have the entire ship be modelled as a debris LOD, but with separate pieces.

As a result, instead of just having a bunch of explosions and then a few pieces floating around, you could have a giant shockwave, and then the ship falls apart. (On a side note, has anyone thought of simply copying LOD0 to the debris LOD to make a derelict ship?)

Since people have been asking, here are the relevant values for debris life/speed and such. Within reason, these could probably be settable on a per-ship basis, Volition probbly hardcoided them to save on timne.

Code: [Select]
#define MAX_LIFE 10.0f
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
#define DEBRIS_SOUND_DELAY 2000 // time to start debris sound after created

// limit the number of hull debris chunks that can exist.  
#define MAX_HULL_PIECES 10

#define MAX_DEBRIS_DIST 10000.0f // Debris goes away if it's this far away.
#define DEBRIS_DISTANCE_CHECK_TIME (10*1000) // Check every 10 seconds.

#define MAX_SPEED_SMALL_DEBRIS 200 // maximum velocity of small debris piece
#define MAX_SPEED_BIG_DEBRIS 150 // maximum velocity of big debris piece
#define MAX_SPEED_CAPITAL_DEBRIS 100 // maximum velocity of capital debris piece
Title: Explosion idea
Post by: StratComm on September 01, 2005, 11:04:45 pm
Quote
Originally posted by WMCoolmon
Instead, I'm saying, have the entire ship be modelled as a debris LOD, but with separate pieces.

As a result, instead of just having a bunch of explosions and then a few pieces floating around, you could have a giant shockwave, and then the ship falls apart. (On a side note, has anyone thought of simply copying LOD0 to the debris LOD to make a derelict ship?)


Having the entire ship in the debris LOD is just something that most people don't spend time on, but I don't think it's in any way unreasonable.  The HTL Levifenris actually comes pretty close in its debris.  Making a hulk debris has not been explored because it looks stupid when you can see the split (a very fast propogation rate would hide this to an extent) and because of the tendancy of debris to gravitate towards the max velocity of the code snipped you posted.  A hulk moving at 100m/s isn't exactly easy to stomach.  However, the concept is sound.
Title: Explosion idea
Post by: karajorma on September 02, 2005, 03:41:45 am
Wouldn't you have problems with modelling debris as LOD0 though? Debris don't have LODs themselves so after you've blown up a few Levaithans you're going to be using up thousands of polys rendering full detail leviathans even if they are hundreds of kilometres away from you.

There's also the issue of the limited number of collision pairs the game can deal with. Some missions are already close to the edge as it is. Start making debris persist and it could suddenly become possible to shoot through some ships.
Title: Explosion idea
Post by: Vasudan Admiral on September 02, 2005, 04:07:24 am
Quote
Instead, I'm saying, have the entire ship be modelled as a debris LOD, but with separate pieces.
Oy! Checked the fenris yet? :p
Quote
The fenris for example uses the 'crack apart' technique - (11 chunks made out of the original fenris model)
Granted it's an older version in the media VPs (new debris is better - see below), but it still uses the same 'debris LOD' technique as i've been using for all my ships since.
Fenris (http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/Misc/Debris-Fenris.jpg), Triton (http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/Misc/Debris-Triton.jpg) & Aeolus (http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/Misc/Debris-Aeolus.jpg)!

Kara: Debris doesn't need to be highly detailed at all - especially not a lod0 level of detail!
I've been using sushied original [V] models for my chunks and they seem to work fine so far. :)

However, i think you're right in that it's silly for debris to still be rendered when that far away. There'd be a number of solutions for that, but the best one i can think of would be one that's based on size vs distance of the debris - so things like the chunks of IPAndrews planet (http://www.hard-light.net/forums/index.php/topic,34264.0.html) are still visible even when really far away. :)
Title: Explosion idea
Post by: IPAndrews on September 02, 2005, 05:04:08 am
Quote
Originally posted by WMCoolmon
Not generated debris, no. Instead, I'm saying, have the entire ship be modelled as a debris LOD, but with separate pieces.


Oh right. I think that's more or less what I do already. I have a few huge chunks of debris. Really, chunks of ship rather than chunks of debris. Either based on the LOD0 model or LOD1 model. It looks okay. Not fantastic or anything. As mentioned though most of my big pieces of debris explode for no apparent reason before anyone can admire them.