Jump to content
Sign in to follow this  
Sealife

Example of Damage to Model

Recommended Posts

THIS example is an OTT example and should not be seen as a good end product use section counts sparingly , many of these can cause lag , pls be sensible and create strategic damage like holes in tunnel roofs for rescues etc

It will also work on vehicles to a degree too , but better use deform animation instead

I wont have much time now or as much as i would like to play and mess with this game ,this is a brief example of something i made when i read about destruction in some other thread and i leave here for others to maybe learn from it.

Tools i Used

BI tools http://community.bistudio.com/wiki/BI_Tools_2

C4D (demo 40 days)http://www.maxon.net/downloads/demo-version.html

Nitroman4d xbreaker scripts http://nitro4d.com/blog/freebie/xbreaker/

Overview of the download

In the downlaod there is a Binarised PBO and a folder containing the unbinarised model and textures, the idea of the example is to show how you can Hide damage on a part of the model and how you can (A) script a particle effect to the effected area and or (B) config an engine based particle effect to the area affected.

Media/B]

A small video follows to show (badly) a use for such an addon

5_YRFLGbd7c

for visitor please use the LAND_ prefix in usual way and remember script wont init from that model make a module to define the handle your calling there

HOW WHAT WHERE Model

I presume you already know how to make addons altho with this downlaod and this description you can at least make walls for yourself.

So make a box object in C4D and run the xbreaker script , ideally you probably only want the center to break so maybe choose 5 pieces for the script to break it into

then only name and config the sections you want to be destroyed.

Export the model as 3ds and import to the o2 , if you keep the name properties Piece_0-_x in the model then you can recycle my configs and cpp

most of the breaks will allow you to create your geometry very easy bu copy and paste and component convex hull .

finish in the normal way ( see whats in the download mlod) and your done.you could always use this on an existing wall in your own house model and not create a box.

The Example is an OTT example you would never need 40 +pieces in such an object , i did it to create a template more than anything.

HOW WHAT WHERE CPPand cfg

in the Model.cfg we define the Hide animation like this

first we define the bone

"piece_1","",

then we define what we want to do with the bone , in this case Hide it.

   class Animations
  {
   class hit1
   {
   				type="hide";
			source="hit1";
			selection="piece_1";
                               minValue = 0;
                               maxValue = 1;
                              minphase = 0;
                              maxphase =1;
hideValue = 0.9;

   };

this tells the engine to Hide piece_1 when the value of Hit1 is at 0.9

the way we define Hit1 THE SOURCE is in the CPP like so :

    class Hitpoints {
		class Hit1 {
			armor = 0.05;
			material = -1;
			name = "piece_1";
			visual = "";
		passThrough = 0.1;
			convexComponent = "piece_1";

The armor = 0.05 is a refference to the Hipotint being .05% of the total armor of the class

The convex component will also hide the Geometry (may not be necessary to name it as the geo lod has it name same anyway)

Visual is old way when Material had a number in 02 on texture and then texture will change so obsolete for this.

Mess with the armor to suit you , geometry weight of model is also another factor here, however the biggest thing when defining here is to remember BIS use a Hit factor radius including an indirect hit radisu , this may affect your results if you set things too light or too heavy , it will certainly effect the precision in many cases i believe

We can add aditonal Config Particles by adding the following to the hipoint

  class Hit1 {
			armor = 0.05;
			material = -1;
			name = "piece_1";
			visual = "";
		passThrough = 0.1;
			convexComponent = "piece_1";
			[b]class DestructionEffects {

				class Dust {
					simulation = "particles";
					type = "ExploRocks";
					position = "piece_1";
					intensity = 0.1;
					interval = 0.01;
					lifeTime = 0.01;
					size = 5;
				};

				class Dust2 : Dust {
					simulation = "particles";
					type = "ExploRocks";
					position = "piece_1";
					intensity = 0.1;
					interval = 0.01;
					lifeTime = 0.01;
					size = 3;
				};

				class Dust3 : Dust {
					simulation = "particles";
					type = "ExploRocksDark";
					position = "piece_1";
					intensity = 0.1;
					interval = 0.01;
					lifeTime = 0.01;
					size = 1;
				};
			};[/b]

		};

Now the model will have particle effect at the point described in position = "piece_1";

to achieve this perfect copy and paste the Piece_1 from the geo lod and place it in the Memory lod and press Shift + D , this will create

one point at the center , sometimes because we have hiddeln Piece_1 the particle can fail so maybe rename this point in memory lod and CPP to piece_1D and position = "piece_1D";

you can also make a ruin model for each piece if you wish by adding the following ( i have no time to show how to config the class ruin sorry, however to config in hitpoint

its like this :

		     class Hit1 {
			armor = 0.05;
			material = -1;
			name = "piece_1";
			visual = "";
		passThrough = 0.1;
			convexComponent = "piece_1";
			[b]class DestructionEffects {

				[b]class Ruin1
			{
				simulation = "ruin";
				type = "thromp_example\Ruins\thromp_example_piece_1_Ruins";
				position = "dampiece_1";
				intensity = 1;
				interval = 1;
				lifeTime = 1;
			};[/b]
				class Dust {
					simulation = "particles";
					type = "ExploRocks";
					position = "piece_1";
					intensity = 0.1;
					interval = 0.01;
					lifeTime = 0.01;
					size = 5;
				};

				class Dust2 : Dust {
					simulation = "particles";
					type = "ExploRocks";
					position = "piece_1";
					intensity = 0.1;
					interval = 0.01;
					lifeTime = 0.01;
					size = 3;
				};

				class Dust3 : Dust {
					simulation = "particles";
					type = "ExploRocksDark";
					position = "piece_1";
					intensity = 0.1;
					interval = 0.01;
					lifeTime = 0.01;
					size = 1;
				};
			};

HOW WHAT WHERE Scripted Damage

As well as cpp effect there are many ways to script it , for normal use or cutscene

For adding particles to the model when its damaged (becareful remember this is no matter what damage , not when damaged to 0.9 of 0.05% like defined in the model.cfg and the CPP)

add an eventhandler that is called when damaged simple as so ( shown in example download)

 class Eventhandlers {
		init = "_scr = _this execVM ""\thromp_example\scripts\init.sqf"";";
		dammaged = "_this call thromp_exampledebris;";
	};

Init could simply define the thromp_exampledebris and this isnt efficient to init same for every model , pls make a module or something for many models

you can just use a format script for cutscene and use for TOH selectionposdamage .

well i hope you have fun and pls leave any questions , i may have time to come here to answer them but until then :

I hope you have fun and i hope i haven't made your life worse ;)

Thromp

the download is in the spoiler

http://www.mediafire.com/?6eywe9c4ysvag64

Pls feel free to use the Unbinarised things in Any Bis Engine Game only .

there is no permission to use the model scripts and Textures outside of CO A2 and TOH games any sharing of this link without this read me will result in copyright issues and the poster could become liable to any legal issues persued as a result .similarly do not host the download for the same reasons

IMPORTANT

Please make sure if you do make something change folder names and paths and especially dont use Thromp_ anywhere make a TAG for you ;)

IMPORTANT

Please make sure if you do make something change folder names and paths and especially dont use Thromp_ anywhere make a TAG for you ;)

Edited by Thromp

Share this post


Link to post
Share on other sites

hey Thromp, nicely explained proof of concept, and nice damage effect

a few issues and questions:

1. the link you provided via mediafire is NOT working.

2. i would add a readme.txt to the archive, so that it can be hosted elsewhere as well (thinking about armastack, ofpec, etc...)

other than that, :thumb:

PS:

for you max users out there:

1. you can do use the procutter tool (boolean, i personally don't really recommend)

2. or the Fracture Voronoi Script 1.1 to create the individual pieces

Share this post


Link to post
Share on other sites

Can someone make sure the DEV team at Arma 3 see this? perhaps they can tweak it in time for Arma 3?

Share this post


Link to post
Share on other sites

Thanks Pufu

I'll see about readme and link fixed

Share this post


Link to post
Share on other sites

This is extremely interesting, its a shame I am no good at modelling things.

Very good work keep it up! (and maybe BIS will hire you at some point)

Share this post


Link to post
Share on other sites

That’s a good thesis and example. :thumb:

I did investigate this for my precast concrete pipes, but as noted it rapidly becomes perversely costly geometry wise without including propagation across both visible & invisible/indirectly seen LOD’s or “lag†and like said is perhaps best suited to key small static areas of a larger modal – like e.g. locked/non opening door/s to gain access or like said specific area of a wall gain access to something.

e.g. if 12 triangle wall become 400+ triangles, imagine if your modal is 500+ triangles for lod1 anyway your talking 10000+ triangles or more :yikes: if its sectioned into components, you also run into problems with movable objects with many multiple components in contact with the ground causing weird effects with the physics engine like objects “vibrating†and thus moving across the ground or doing crazy things if time is speeded up, even default TKoH objects can do the same crazy things if time is speeded up or ropes attached or they are moved from their starting location or they are shot etc.

So I am just making “ruins/wrecks†that just get swapped at X damage given its significantly cheaper geometry wise across all visible and indirect (e.g. shadow) LOD’s even if it is old hat.

Share this post


Link to post
Share on other sites
if 12 triangle wall become 400+ triangles

Exactly thats why i think its important if used strategically it can make for good gameplay .

in terms of TOH it would be nice for breaking into big tunnels to lower people in to recue etc.

But your example which is good to show extreme , you wont need such polies in reality , you can make a wall with 2 sections only for a cost of 20 triangles for a basic U shaped hole

A pipe also can have a nice star shape piece cut out or even split in half for less than 60 triangle .

So I am just making “ruins/wrecks†that just get swapped at X damage given its significantly cheaper geometry wise across all visible and indirect (e.g. shadow) LOD’s even if it is old hat.

i have described above how you can do that with ruin class ;), it also adds nice continual gameplay and with other unproven thepry Dependanton _x (seen in an a2 config i cant find )you wont have floating pieces ;)

anyway i hope people experiment i have no time anymore :(.

i shall place tonight tomorrow a more MP friendly RTM example ( pls be aware my keyframe patience is low so it will look bad lol ;) but an example will be there for good modelers

Edited by Thromp

Share this post


Link to post
Share on other sites

So is this feasible to implement for all the neighborhood backyard walls in a map like Shapur? Can you make it so walls take a ton of punishment from small arms but fall apart like that when hit by HMGs? Can HEAT rounds make small holes while pure HE blasts away whole sections?

Share this post


Link to post
Share on other sites

it is feesable as long as its done efficiently , like the header says this is an Ott example ,

i guess one way to find out is to see how many of the example walls you can put on a map and play and then * by about 35 because an efficient wall would be 35 times less poly and selection heavy than the example

Share this post


Link to post
Share on other sites

might take up the challenge to test, and then blow them up with something (take it I can use these in CO cos it'll be much easier)

Share this post


Link to post
Share on other sites

do what you like with them in any Bis game :)

however to clarify , to make more efficient i meant not only a better model but also when placed in visitor walls are Streamed and this makes them a hell of a lot more efficient than placing one of these ott examples in editor ;)

Share this post


Link to post
Share on other sites

hi thromp tried the link in spoiler got this

The key you provided for file download was invalid. This is usually caused because the file is no longer stored on Mediafire. This occurs when the file is removed by the originating user or Mediafire.

If you believe you have reached this page in error, please contact support.

Click here to view our help resources

Any chance you got another link please

Share this post


Link to post
Share on other sites

Hmm , real sorry about that , thought it was permanent

I will try and find the original and upload ASAP , i did mean to remove the dont Host links guess i have suffered now because i was lazy :(

Share this post


Link to post
Share on other sites

Hey mate

i believe this was the version , really sorry i cant check or anything busy as hell with RL .

http://www.filedropper.com/thrompexample_1

Have fun pls use in conjuction with warnings in 1st post about number of sections or Lag will ensue and if yo use script particles , use an isnil check like BIS so every item does not init the scripts.

any questions i try to answer here

good luck

http://www.filedropper.com/thrompexample_1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×