Announcement

Collapse
No announcement yet.

Multiplayer NPC Without (dedicated)-AIController?

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

  • started a topic Multiplayer NPC Without (dedicated)-AIController?

    Multiplayer NPC Without (dedicated)-AIController?

    Hi. As always, I have my Pawns have either an AIController or a PlayerController. However, I have 3 types of Pawns:
    - PalayblePawn used by the player with PlayerController.
    - PlayablePawn used by the machine with AIController.
    - NoPlayable always used by the machine.

    This last type of character, which under no circumstances will be controlled by users and whose program is unique, such as Zombies, Bears, Birds, is where I have the doubt.

    While the first and the second can be used both by the machine and by a user, therefore their behavior and orders must be written in different PlayerController and AIController:

    Can these last characters be written completely in the Pawn Blueprint? Or, they need these characters equally, that their behaviors be written in the AIController, so that they are distributed over the multiplayer network.

    Can I program a ZombiePawn exclusively in the BlueprintPawn, without using the AIController?

    Thank you.

  • replied
    Pawns are having very limited functionality, especially in older engine builds (pre 4.20) they don't even support networking properly. Characters which has walking (etc) functionality better to be implemented using Character class in the first place both in player and non-player cases. Character class has extensive functionality for networked movement replication.

    Just like Chosker have pointed out, these #2 and #3 types are not different in any way. The only difference between NPC anc PC are a few extra components being used for AI navigation capabilities, which you can probably spawn dynamically (on demand) or better to add them to your Base Character class (with inheritence you can later use this base class both for PC and NPCs). By following this pattern you can activate/deactivate PC / NPC related components when required - depending whether a player or ai is possessing the character in question.

    A practical example is when the player is possessing an NPC i deactivate the components and stop the brain to compute the behavior tree, then i store the reference to the AI controller for later use. When the Player Controller no longer possessing the NPC (in the tick i verify this case, since the char has no controller anymore) i possess the NPC with the AI controller, and reactivate the components, start the brain to function etc. It works nicely in cooked game as well as nativization enabled.
    Last edited by Konflict; 02-11-2019, 02:57 PM.

    Leave a comment:


  • replied
    the way I see it, so far the only difference between type #2 and type #3 are that #2 can be possessed by a Player. this does not warrant any change in the architecture.
    I don't even see the need to make a different "type" - they are still Pawns with an AI

    Leave a comment:

Working...
X