Announcement

Collapse
No announcement yet.

[Resolved] AI Behavior Tree + Multiplayer

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

    [Resolved] AI Behavior Tree + Multiplayer

    Hello everyone i need you help !

    I currently dev a online game (Type Arena) I know how to create and how works Behavour Tree but i don't no how to applicate on multiplayer
    There are any tutorials any explain how to replicate all action of enemy to Client & Server same time.
    All variables is replicated & the enemy has spawned with server directly.

    Thanks.
    Attached Files
    Last edited by R5GAMER; 03-14-2019, 10:21 AM.

    #2
    I would personally approach this by making the server do all of the logic, and then multicasting the montages. Example: make those RPCs in your screenshot server only, then create a "MulticastMontage" RPC which is set to multicast, then have the server call those instead of directly calling montages. In the "MulticastMontage" RPC, have the montage play there, and all the clients should see the montage play. Take this same paradigm and apply it across the board: logic done on the server, visuals are handled with a multicast called from the server.

    Comment


      #3
      Like this ? (Edit: I added C2A after random xD)
      Attached Files
      Last edited by R5GAMER; 03-14-2019, 12:06 PM.

      Comment


        #4
        That looks like it could work. Just ensure that the server is what calls the multicast. Have you tested that code?

        Comment


          #5
          Nothing happen on Client... :/
          Last edited by R5GAMER; 03-14-2019, 12:27 PM.

          Comment


            #6
            What about the server, do things look proper there? Throw some prints in there to see what logic is being run, and where. If you only see prints from the server, it's only running on the server.

            It requires some understanding of replication, and I don't think most people will be up for writing your code for you or stepping through every bit of it to ensure that you're doing it properly. The general idea is to run all logic on the server, and replicate visuals (pawn locations, animations, etc.) to the clients to keep things visually in-sync. Step through your code and ensure you're following this paradigm.

            "Nothing happen on Client... :/" is a very, very vague statement as well. What does that mean? Pawns are spawned/visible for clients, but not moving? Not attacking? Pawns aren't visible for clients but are for the server? Every single step of your code must be setup to support your goal of replication. That means, if a pawn spawns, the server handles that logic and replicates it to clients. If a pawn needs to attack, the server handles the logic and replicates. Etc.

            With such a vague statement, it's hard to help in an effective manner.

            Comment


              #7
              -> This enemy is a boss is spawned (On server) when my map is loaded.
              -> This Boss is appear on Client/Server.
              -> But i doesn't work any action on client but on server is work.

              Server receive 1, 2 & 3 Print
              Client receive just 1 not 1&3 ...
              Attached Files
              Last edited by R5GAMER; 03-14-2019, 12:39 PM.

              Comment


                #8
                The client prints 1 and not 2 or 3, or the client prints 2 and not 1 or 3? "Client receive just 1 not 1&3" appears to have a typo and I can't discern which of the two scenarios you mean. I'm assuming it only prints 1, but I don't want to theorize based on assumptions.
                Last edited by One Mode Only; 03-14-2019, 12:42 PM.

                Comment


                  #9
                  Sorry client i printed nothing but server printed 1, 2 & 3.

                  On this screenshot i added print 0 on BP_Boss to see if spawn default controller is worked after cinématic and client/server show 0
                  Attached Files

                  Comment


                    #10
                    Have you tried throwing in a print in the onBeginPlay of BossDW401? I'm curious who acknowledges that the actor has even spawned. I don't think I'd programmatically set replication after spawning, but rather set the replication details in the class defaults. I'm not convinced that this is where your issue is, but changing replication on the fly can have some interesting, usually unintended side effects.

                    Comment


                      #11
                      Nothing change when i delete "Set Replicates" or if i remplace Spawn AIFrom Class To Spawn Actor the ai behavior don't work on client.
                      So i tested printed on BossDW401 & client/server show "hello"
                      I tested directly on BP Boss to check if all code is work i called S2A Server Replicate on to beginPlay he work when i call on beginplay after this i don't understand why on client he get different animation to server & sometimes the client don't run animation.
                      Attached Files
                      Last edited by R5GAMER; 03-14-2019, 03:11 PM.

                      Comment


                        #12
                        I though AI was already replicated
                        Some cool unreal projects you may like!


                        Developer of GOTA - Survivalism Gladiatorial game Buy the game google gladiators of the arena steam https://store.steampowered.com/app/7..._Of_The_Arena/

                        Download the demo Download the demo
                        external link Dropbox DropBox

                        Become a c++ Professional now C++ Networking Tutorial

                        Comment


                          #13
                          I delete "Set Replicates" and nothing change on client nothing show on print & on menu debug i have just server debug but not client.

                          Comment


                            #14
                            Originally posted by R5GAMER View Post
                            I delete "Set Replicates" and nothing change on client nothing show on print & on menu debug i have just server debug but not client.
                            Deleting that isn't a solution in itself. You also need to ensure that your actor's components are replicated as necessary. For the sake of troubleshooting, just set the actor to replicate and movement to replicate.

                            Comment


                              #15
                              I resolved !!! AND is logic ! the AI Behavour is only work on server so i seek you're idea

                              Originally posted by One Mode Only View Post
                              I would personally approach this by making the server do all of the logic, and then multicasting the montages. Example: make those RPCs in your screenshot server only, then create a "MulticastMontage" RPC which is set to multicast, then have the server call those instead of directly calling montages. In the "MulticastMontage" RPC, have the montage play there, and all the clients should see the montage play. Take this same paradigm and apply it across the board: logic done on the server, visuals are handled with a multicast called from the server.
                              So on to behaviour tree i called all logic selected animations after this i called on my BP_Boss a Multicast to go to play a animation ! And is worked !
                              i show the picture if helping another people

                              Thank you !!! One Mode Only to patient & to try to understand with my bad segfault english

                              Comment

                              Working...
                              X