On Networking Destructibles in UE4

One gameplay mechanic (which will be expanded more as time goes on, into a generic system for flammable items) currently in Dungeon Survival is a destructible barrel ‘filled with’ (spawns) oil.

This uses UE4‘s built in NVIDIA APEX Destruction.

As any UE4 dev that has played around with destructibles will know, the actual destruction event doesn’t network “automatically” in any way – even if damage or collision events are.

That presents a problem.

What happens currently – you can enable movement replication on the destructible actor. This works well (probably not as well over the network), all the way up until the thing breaks, at which point the oil spill is placed in a totally different spot on the client and server.

Now I should point out that technically, my destructible barrel isn’t using the destruction system the “right way”. For something like a barrel which you want to accumulate damage and break, there is a built in impact system. Unfortunately, I was not able to tune that to act how I wanted – a predictable amount of hits to fracture the barrel.

So right now instead the barrel is set to generate hit events. I check to see how strong the hit was, and if it’s over a certain threshold, I apply some damage to the barrel, which is set to fracture if a certain amount of accumulated damage is ever applied.

Because of this particular setup, the way to network it is quite clear – handle not only the damage, but also the fracture event and spawning the oil slick on the server, replicated to the client.

In this fashion the server will determine where exactly the spill is placed, even if the client’s destructible fractured in a slightly different position.

I’ll be updating this post later with screenshots demonstrating the problem, though for now fixing it is a Backlogged task.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s