Bullet whip attachments - 2nd, replicated actor on client & DH version not even spawning

Issue #368 resolved
Matt Hands created an issue

Bullet whip attachments are necessary to detect hits on player pawns. This now includes vehicle occupants, except tank drivers. They also handle the close bullet 'snap' effect. They are spawned independently on the server and each client. On a client the hit detection is only to show hit effects & bullet snap; the actual, authoritative hit detection is on the server.

The class inheritance is DHBulletWhipAttachment extends ROBulletWhipAttachment extends ROCollisionAttachment extends Actor.

Two fundamental bugs:

  1. The actor's RemoteRole is not set, so it inherits ROLE_DumbProxy from Actor. That makes each BWA replicate to all relevant clients. But the clients have already spawned their own BWA and saved a reference to it as the player pawn's AuxCollisionCylinder. So the replicated BWA just becomes a duplicate. At best this is adding pointless replication & a few dozen net channels. At worst, the duplicate BWAs cause some kind of interference (note that RO's HitPointTrace function shows screwed up behaviour).

  2. The DHBulletWhipAttachment version, which increases the height and radius of the collision cylinder, has never been spawned in a game of DH. Why? A classic case of re-state the RO super and change something (in this case, change from RO BWA class to the DH version), but include the call to the super, without skipping over the immediate RO super. So everything in DHPawn.PostBeginPlay() is duplicated in the RO super. The rest is pretty harmless, but the RO super is called first and spawns the RO BWA, recording it as the AuxCollisionCylinder, so the DH function doesn't spawn the DH BWA because we already have a AuxCollisionCylinder (good job really, or now we'd have 3 of the buggers !).

Comments (1)

  1. Matt Hands reporter

    Fixed in commit b80c74d.

    RemoteRole changed to ROLE_None, so no replication of BWA from server. Should now have independent server & client versions, with no duplication on clients. On a busy server this will remove a few dozen unnecessary net channels.

    Removed call to the RO super in DHPawn.PostBeginPlay(), so DH version of BWA will now be spawned.

    Note that DH version has a collision cylinder that is twice as high and wide as the RO version (300 units vs 150 for both height and radius). So I think we're going to get noticeably different bullet snap/whiz. It will be as the original DH 'author' intended, but we'll have to see whether we like the change. I don't think anything else will be effected though, i.e. hit detection and effects should not change.

  2. Log in to comment