top of page
Search
  • Kevin Chandler

How To: Spaceship Combat Damage


One of the main features of Void Royale that i want to implement is battle damage that both communicates damage done to a ship but also serves a gameplay purpose. In games like Dauntless and Monster Hunter, damaged areas apply more damage when hit. I wanted to make pieces break off capital ships to and reveal the squishy innards of the capital ship. It presented a bit of an issue because Unreal has a lot of ways to do destruction but none of them really fit perfectly


- Destructible Mesh/Chaos Engine

This is great for a mesh that needs to fall apart in a cool crazy way but I need to have precise control in what pieces break off and I am also not looking for the whole ship to break apart and have players drilling down inside the ship as it falls apart.


- Physics Asset

If you have a skeletal mesh you can supposedly set it up so that you would turn on physics for the piece you hit and it will disconnect from the main body. I actually tried this method but it didn't work. I set up my physics asset to try this method so I may come back and try this again and see if I can track down the problem.


- A collection of static meshes

The brute force solution is to have a main ship mesh, cut out a bunch of pieces and make sure they all share the same pivot so they all snap together, When a piece is broken off you destroy the piece of and spawn a version of it with physics so it spins away from the ship. I have 50 different holes on my capital ship and while the method I landed on isn't perfect, it's easier that trying to manage all those different static mesh. Besides which, shadows were being generated around the holes so the holes were completely obvious.


So in the end I used skeletal mesh an an animation blueprint to create the effect I wanted. Here's how it works.


  1. Take a complete model of your choosing and cut holes in it. In Blender I made an irregularly shaped spline and used the knife project tool to project the hole I wanted to make in the hull.

2. I then went through and cleaned up all the holes by extruding down and then adding faces to connect up the extruded bits.



3. I then made an armature and made a bone for each hole and attached the vertices for each hole to the bone.


4. I then exported three separate meshes. I exported the skeletal mesh with the bones with the hole covers in place, a static mesh of just the ship with the holes cut out, and mesh that is just the extruded out and sealed holes. I needed the skeletal mesh with the bones because as each hole piece takes damage I am going to "destroy" it, leaving a neat little hole. I need the the static mesh with the holes cut out because i need a mesh to catch bullets for shots that hit anywhere but the holes. Then I needed the extruded holes because hitting this layer will do double damage. In hind site i could have probably just had a single skeletal mesh if I just took the body mesh and attached it a "body" bone and attached the extruded holes to a bone called "interior" but I was already getting pretty crazy with the bones and I didn't want to add more complexity. I could have also done it with physics materials but hindsight is 20/20.


5. Next I had to set up the physics asset. I had to go to each bone and generate convex collision for each one.



6. I then made an animation blueprint to control the "destruction" of the hole pieces. In reality without using the physics asset I can't destroy a bone, I can only hide it or move it. So I move them. When they get hit I move them to the center of the capital ship well inside any of the exterior meshes so they can't get hit. To do this I made heavy use of the transform modify bone node to move the bone holding the hole geometry.


and when I say heavy use...



What's the expression? If a stupid idea works it ain't stupid. Again, when I optimize I am going to probably use the physics asset or physics materials for this but for now this works.


7. I made an array of names in the anim blueprint that lists all of the destroyed hole pieces. My ship blueprint point damage event adds the name to the array using "add unique" so the same hole can't be added twice.


8. I then made a macro that takes a number, appends it to the word "hole" then if that name exists in the list of destroyed holes, it returns a float value of 1. Then back in the anim graph it sets the alpha on the transform bone to 0 if the hole is intact and 1 if the hole is found in the list of destroyed holes.






9. Then you go into the projectile blueprints and made sure that when they impact a surface they apply point damage. This allows the collided bone to be passed through the Point Damage event.


10. At this point it's back to confirm that the point damage event is hooked up and it spawns and explosion particle at the location of the hole.




And the final result is this





129 views0 comments

Comments


bottom of page