Hi everyone,
I want to make use of destructibles in my game so that players can use artillery to blast holes in barricades which they can then walk through to breach a fort. The maps will be big, so it’s possible for players to be too far away for the barricades to be relevant.
For this reason I need to replicate damage so that newly connected clients joining a game in progress, or players who were out of relevancy for a while don’t see players running through solid walls. I see two possible ways to handle this:
-
Make destructibles always relevant and replicate damage taken with a netmulticast, and also store an array of previous damage taken replicated with “InitialOnly” for new clients to “backfill” the historical damage taken. This would work, but I don’t want to make objects always relevant unless absolutely necessary, as I plan a high player count (over 200 players if possible with the 4.20 networking overhaul)
-
Store an array of hits received and stick a repnotify on it, so as new damage is taken it’s replicated to clients who then apply the damage in the repnotify. A “dirty” client who has just connected or was out of relevancy for a period of time will simply catch up on the next repnotify.
I was wondering which would be the best approach, or indeed if there are other approaches I haven’t considered.
A couple of questions:
-
How would I efficiently replicate an array? The size could grow quite large over the course of a game, so I don’t want an array containing dozens of hit infos being sent out to people every time some damage is taken. Does UE4 intelligently only send info for array indexes that have been modified or are new?
-
For “historical” damage taken, is there a way to prevent chunks being produced? Essentially what I don’t want is for a new client to join and watch walls explode everywhere as their version of the game catches up. Is there a way to apply damage to a destructible that doesn’t produce chunks? Of course, I would need to track when the damage was dealt so the client knows if it is old damage or not
Any advice would be much appreciated!