Announcement

Collapse
No announcement yet.

Networking Custom Movement Character Spawning Bug, UML & Screenshots provided.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Networking Custom Movement Character Spawning Bug, UML & Screenshots provided.

    Hello all,

    I'm encountering an odd issue with spawning characters with my first person shooter template. I need to solve the spawning issue before I can begin my journey testing net code for my custom implementation. I am having inconsistent spawning problems when I try to spawn 2 clients (non dedicated), however when I spawn 3 or more the pawns spawn with issue but the possession is not working properly. With a default game mode it behaves the same way except I can move my clients around but not with my own custom Game Mode. I am using the default spawning built in as I tried overriding the game mode and player controller to spawn my characters with no success.

    Overview: I've successfully ported over VQ3 (Quake 3) movement physics to the UCharacter Class. I've created my own character movement component which has a square collision capsule and movement code. With the custom movement code I override the PhysCustom function and run my code there. Here are useful screen shots below.

    UML: (Legend* Blue is Variables, Orange are functions, Grey is aggregation, Empty Arrow is Inheritance)


    C++ PhysCustom code lives here:



    BP_FirstPersonCharacter



    Server Perspective:

    https://imgur.com/a/7tMusrO

    Client Perspective:

    https://imgur.com/a/BEtv98u

    Tried:

    1. I have tried several combinations to my world overrides like using default player controller, my own controller, I've also tried the default game modes and my own.

    2. I have also tried placing Start Point actors with no success.

    3. I wrote some code to try and spawn some character pawns on Player Start points with iterators inside my game mode and possess it.

    I've spent a long time time reading documentation and tutorials I have also done replication before and took a course to network vehicle APawn classes (did the prediction, physics etc), I never came across any spawning issues until now. I've tried different implementation approaches with no success. I am looking for some steps in c++ solution to this problem.

    Thanks so much as this would mean a lot to me to learn and move forward.
    Last edited by StaticJPL; 06-11-2019, 01:26 AM.

    #2
    The first thing I'm noticing is that the character still has a capsule and mesh setup, but you are saying the box is supposed to be the movement collision? If that was the case the box should be the root component and the capsule shouldn't be there anymore - however, a substantial (if not ALL) of the Character Movement code relies on a capsule as the movmenet proxy, and for a movement component to work it needs to be moving the root component.

    Ultimately you won't be able to change character movements collision shape without either a) significant engine modifications or b) a completely new from-scratch movement component and character class. Or are you not using Character Movement at all?

    ---

    The Game Mode also already has a system for spawning players at player starts - from the outside it appears whatever you have done in the custom gamemode is fighting with the engines implementation or overriding it, but does not work.

    Either way the camera and/or player not being where you think they should be points to an issue with the movement component rather than the spawning logic to me, since the default mode spawns the players as you say.

    Comment


      #3
      So the way the code is I have my own Movement Component and it has it's own collision component which is the box collision, the box collision is attached to the root capsule component. Thus the root capsule comes for the ride, I intend to do all my collision detection with my own custom one client side and let the Character Movement Component just replicate where the default capsule is. My first person camera component also attaches to the root collider with a forward vector that I use for reading mouse input. Now oddly, I've tried using the default pawn and player controller and default game mode. I still see the exact same issue with two players where the client is spawning in the ground.

      Comment


        #4
        I think I may have pin pointed the issue. I've looked at the original source code designed for the VQ3 movement collision component. I'm deducing it from how the collision box is attached to the player.

        In the Movement Component Class

        void UDefragrPlayerMoveComponent::BeginPlay()
        {
        Super::BeginPlay();

        Origin = Player->GetTransform().GetLocation();
        }

        Additionally the Collider on the player location is set to this origin value on the Tick component

        //This is inside the tick component
        Player->Collider->SetWorldLocation(Origin);

        What could be happening is on BeginPlay the collision box is set to where the player spawns. Then the player for some reason is falling through the map and is hitting the kill zone, while the player falls every tick the collision box is being pulled down vertically but it can't obviously fall through the floor. Then the pawn is unpossessed and that's why the camera that's tied to the player is under the map.

        Any thoughts on this?

        Comment


          #5
          IMO you're going to be fighting the engine all the way with this setup to be honest, I still think your best bet is to make engine changes to use a box collision. As for the issues with spawning, it's hard to say given the odd setup you have.

          Comment

          Working...
          X