Today I packaged my multiplayer test game (something like a pong) and then I tried it in two instances in my laptop. All goes perfect, fluently and without lag.
When I have tried on another computer in my home and in my laptop, I see that exists a lot of lag. The things I noticed:
-In the other computer, not a very good computer, the games ran slower than in my laptop (I mean, the ball goes slower, the player moves slower and in my laptop all goes at the right velocity)
-The server side goes perfect (if not take into account the previous problem) but the client has a terrible lag (for example the ball moves quickly beetwen two positions (the next and the new one) or my player moves similar as the ball)
Do you think that maybe is a lag problem? Or perhaps if the other computer is worse than the laptop is normal this behaviour? Can be a code problem, for example too mucha variable or actor replicatons o inaccurate methods? (I dont think that can be that because only exist about 4 or 5 replicated variables (to the position, velocity etc…) and 3 replicated actor (the two players and the ball).
If anyone knows something or have an idea, I will be very pleased to hear it.
Most likely it is because you are not using a component that takes care of network prediction and interpolation like the CharacterMovementComponent does. Without that you need to handle what happens instantly client-side when the client apply input (prediction) and what the other client see while waiting for the next signal (Interpolation) for it to appear instant and smooth.
So, do you recommend me to change the type of movement to CharacterMovementComponent to avoid thats problem? Although the blueprints are pawn or actors instead of characters?
Yes if you want to take advantage of all the code included in the CharacterMovementComponent then it has to be a character. ProjectileMovement works okay too but it doesn’t have any prediction as far as I remember so it will have a bit of input-lag. Enabling physics is another workaround but it not very reliable and not intended to be used on networked gameplay elements.
In that case, the I will add a CharacterMovement to the players pawn and to the ball I will try to change it to a character to an put it another charactermovemet.
I would take this approach if my pawn was shaped like a character, but it’s not, so using capsule component of the Character pawns causes problems for me. Is there a way to get Character movement without using a Character class?