Detect when player is on point A and then , go to point B

Hi everybody !

I doing a multiplayer game in 2d with 4 direction .
I have a little problem to my system of movement over the network …

Every 0.5 second I’m receive the position of other player, then , I’m using velocity with specific speed to move the player point A to point B

But my game is a 4 directionnnal game , so sometimes I can see player move in diagonal and I don’t want …

I think about a system to go first on the Y axis , then go to the X position .

But I don’t know how to do that …its possible to use coroutine?( I don’t really understand how it’s work )
So if someone can help/teach me how I can do I’ll really appreciate !

I wish you a good night !

So, are you saying if you get 2+ movements within the timeframe, your code is telling the game object to move towards a destination (which may be diagonal?).
If that’s correct, perhaps you can send a “list of movement inputs”, then execute them sequentially, instead?

If that’s not it, what’d I get wrong? lol :slight_smile:

Thanks for your anwser on 2 topic about my problem ^^ i really appraciate !

Yes that it ! but i’ll prefer to send the position ,because sometimes some RPC can’t be not receive no? so if some rpc is missing, the position will not be the real position :confused:
unless I’m wrong maybe ? ^^

but i like your idea cause the path will be the real path of other player and i would like to solve this too ^^
Can you also explain how can i send a list of input ? How can i have the time of the direction and send it ? and the final … how to execute them “sequentiallty” ?

Thanks again for your help! Have a good night!

Well, okay, maybe it depends on the “Speed” of your game; if it’s fast moving, maybe the final position is the real important one, in which case you might prefer to work out how to move up and over ( to reach there). Of course, this still means you have to be sure the data (destination) arrives properly :slight_smile:
If you’re using photon, I don’t know, as I said in the other thread… but if it’s like Unity you can change the channel type to reliable (or ordered reliable). That’s what I meant about sequential, as well… Save up the moves for your 1/2 second, then send them together, and just play them back 1 at a time.

Back to my comment about fast… maybe it won’t matter, even fast paced should be okay with taking some input every 1/2 second, I would think :slight_smile:

Just think over the concept, then if you’re not sure how to do it… I guess you have to ask a specific networking question (or whatever you’re unsure about) :slight_smile: Good luck, though.

Thanks for your anwser! i will do a mix with my first idea and your’s!
i will sent every 0.5 second the input in a list, with how much time /movement

then play on the other client, and at the final step, i’ll check if the distance send position/real is greater than 0.X and recalculate a new path if it is !

Thanks again ! have a good night !:slight_smile:

Okay, good luck :slight_smile: