PDA

View Full Version : HOWTO: Edit projectile deformation


Mr. Bildo
3rd Oct 06, 5:19 PM
(Note: this HOWTO assumes you are using Corsix's Mod Studio, if you don't know what that is, stop reading this and find out.)

One of the cool features of CoH's is the ability to deform the terrain. This makes for a very dynamic battlefield, because the craters left behind from various explosions can provide new cover for your troops.

I've found that editing the deformation effect is pretty easy and very flexible.

First off, most (if not all) deformation stems from the explosion effect of a projectile. In game terms, this means anything from an artillery shell to a hand grenade. There is a lot to projectiles in general and too much detail here would be out of the scope of this HOWTO.

Projectiles are entities stored in attrib\ebps\projectile\. They are not broken down by race here, but some are prefixed with allied_ or axis_.

If you don't know what weapon shoots what projectile, here is where to look: attrib\weapon\(race)\(etc)\*.rgd. Let's look at attrib\weapon\allies\ballistic_weapon\mortar\m2_60mm_mortar.rgd as an example. One of the children of the weapon_bag table is projectile. You will notice that it is referencing ebps\projectile\m2_60mm_mortar_round.lua. You will find that some weapons may share the same projectile, so keep in mind that changing values of the projectile will affect both weapons. Note: not all weapons have a projectile.

Once you have found the projectile you want to edit (we'll stick with the m2_60mm_mortar_round) you'll want to navigate to \explosion_ext\terrain_hit in the GameData table. You will see a half dozen or so properties here. You can reference my lau guide below for more details on each one.

The properties we are most concerned with are the deformation table, radius_max and radius_min.

The deformation table has a number of properties as well (again, reference below). The one we are most concerned with here is the deform_decal_file property. For our mortar example, the value is mortar_crater. In short, this property is asking us what decal we want to use to generate the "look" of our deformation or crater. What we are actually referencing here is a graphics file (tga) in the game data. You can view these files by navigating to data\simulation\deformdata\. Here you will see a few existing .tga files. Let's extract mortar_crater.tga and look at it in an image editor. You should see a greyscale image of what looks like a hole. Most people will recognize this as a heightmap (http://en.wikipedia.org/wiki/Heightmap). Basically, grey represents "the ground", lighter colors are raised portions and darker colors are lowered portions (i.e. the crater). This image is what is used to create the deformation in the game!

So if we wanted to change the deformation for our mortar projectile, all we have to do is change the value of deform_decal_file to a new image. You can try this with the existing images or create your own. There are a number of heightmap editors available on the internet. This is the one I use (http://hme.sourceforge.net/).

In order to scale the deformation properly (and add some randomness) you will want to take note of the settings in radius_min and radius_max. Also, vertical_scale under deformation.

One more note of caution: be mindful of the value in chance_splat_only. This is a value between 0 and 1 which determines if a deformation occurs or just a decal is displayed. If it is set to 1 (which is the case in the mortar example) a deformation will never occur!

SDK/LUA notes:




-- terrain_hit

\terrain_hit[chance_splat_only] = 0 to 1 -- the chance that only a decal will be drawn and no deformation will occur. 1 = no deformation 0 = always deformation

\terrain_hit[cover_type] = a value of attrib\type_cover -- determines what type of cover is created by the deformation. Keep in mind that the size of the hole doesn't matter, only this value.

\terrain_hit[radius_min]
\terrain_hit[radius_max] = the min/max scaled size of the deformation.

\terrain_hit[splat_only_splats]
\terrain_hit[splat_only_splats_seconds] = relate to the decal of the explosion and is out of the scope of this HOWTO.

--\terrain_hit\deformation

\deformation[deform_decal_file] = the name of the file (minus the .tga) to use as the heightmap for this deformation. Stored in data\simulation\deformdata\.

\deformation[deform_type] = a value of attrib\type_deform -- this determines how the deformation compounds with other bounding deformations.

\deformation[limited] = ?? NOT SURE ??

\deformation[random_rotation] = a bool value that determines if the deformation is rotated when formed.

\deformation[rotation] = ?? I this obviously relates to random_rotation, but I'm not sure what the min/max values are.

\deformation[splat_list] = not in the scope of this HOWTO.

\deformation[vertical_scale] = the depth of the deformation. This number is generally specified in the thousandths (.001).



Please let me know of any errors or omissions. Like most of us at this point, a lot of this comes from experimentation.

--Mr. Bildo

WatZ
10th Oct 06, 10:31 PM
Very nice find.. And thanks for pointing out that noone replied to this because thats how i found it!

I was trying to find a way to implement this and actually scraped the idea because i couldnt find a mention of craters.. Agian nice guide.

Btw maybe a screenie or two is needed.. you know.. just to show off those dirt jumps for jeeps and tanks ;)

Mr. Bildo
10th Oct 06, 10:51 PM
Yeah, I think you're right. I need to revisit this and add some screens. Maybe I'll also add a little example mod or something.

--Mr. Bildo

WatZ
11th Oct 06, 12:58 AM
The germans now have moat building capablities!..hehehe i wish i could hit water :(


So I used .041 under vertical scale on my flak 88z and you could easily bury a jeep inside of it.. However I put .091 for my v1 rocket and it actually made a volcano! Well my laptop is about to blow up so i better stop makin graves ;)

Thanks agian bro.. And post those screenies with your custom heightmaps!

communist_bob
12th Oct 06, 7:10 PM
^Sounds cool, shame we can't make tunnels with this though...

djukel
31st Oct 06, 11:16 AM
I found some inconsequences. For example let see stuh_42_stug.rgd
chance_splat_only 0
splat_only_splat_seconds 90
If no splat why give it 90 second to exist?

Sledge
4th Mar 07, 10:31 PM
So you could potentially give troops an ability to dig holes?

TheVOID
17th May 07, 9:34 PM
Yes, you could and you actually can. I have been experimenting with this to make it possible to dig basic trenches and foxholes and it really works. For example, you could make a grenade that has practially no damage, a long delay to at least simulate building time a bit and a very sharp and drastic vertical crater effect. That would make a nice foxhole. If you could somehow combine this ability with a building action that constructs a sandbag and plank custom object, you could even make it look good and use the debries in case of potential destruction to fill the hole up again AND burry/kill anyone inside. ;)

Perhaps this is a complicated method, but as far as I experimented with the concept, it should work.

Allied paratroopers already have the ability to "dig" foxholes, using their satchel charges. Of course 150-225 munitions for such a hole are not a very good deal. :lol:

Feuer Frei!
18th May 07, 10:58 PM
The_Void:

Love that signature!!! LOL!