Network Send to Server not replicating
I'm trying to make the movement of my character to run on server only and replicate to client in order to avoid cheats like speeding up or teleporting, so I built things in this way:
1- inputMoveRight and inputMoveFoward mapped are used in my PlayerController class. They call moveRIght and moveFoward custom events from the CHaracter. 2- moveFoward and moveRight custom events do the logic to move the Character, and these events are set as "Run On Server"; 3- Character "Replicates" flag is marked.
THe expected behavior is: a- Input from playerController calls movement events from Character (server only), b- CHaracter move on the server, and this movement should be replicated to the Client.
But this is what is happening: a-If I try to move in the Server window, the server CHaracter moves fine and replicates to client (I can see it moving in both windows) b-If I try to move in the Client window, nothing happen. CLient Character doesn't move eighter in server or client windows. c- If I change the "Run on Server" to "Not Replicated", it works fine on both client and server, but I don't know where the movement calculation is happening (I believe that it's happening in the client and replicating to server when I try to move in the client window, but it's not what I want). d- If I change to Multicast it works also on both client and server, but I think it's not being calculated in the server and being replicated as I desire. I want it to be calculated only on server and replicated, since players can modify their clients to cheat.
What am I doing wrong?? The tutorial's teacher did the same thing as I did almost (he did all in the Character class, no input from PlayerController), and he used it to spawn "bombs" instead of adding movement. The concept should be the same in both cases, right?
The same problem is happening with my Shoot action (again, input mapped called on PlayerController, that calls Character Shoot custom event, that calls WeaponClass (Actor) "PullTrigger" custom event, that calls "ServerAttemptToSpawnShoot", and this S.A.S.S. is marked as Run on server (it's a Weapon custom event). The ServerAttemptToSpawnShoot verify if it can shoot (on server, with authority guard), and if canSHoot is true, it spawns a "Bullet" (Actor with projectile movement component). Bullet AND Weapon are also marked with the "Replicates" flag. I think the Shoot problem is the same problem i'm facing in the Movement action replication, I'm not sure but maybe if I fix/understand one I'll automatically understand the other.
Bellow are my movement Blueprints (I can put in a reply the Shoot blueprint too if you need it, since it involves PlayerController, CHaracter, Weapon and Bullet it will be more print screens to post and the answerhub limits me in 5 images )
Please help me :)
asked Mar 03 '16 at 08:31 PM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here