0

I'm new to scripting and I've been writing a dedicated UDP server for a 1V1 game Mova style game, using Navmesh agent. Should I constantly update player transforms or sync only when a player clicks to move, and setDestination to that position on the other clients? Also, with regards to hacking, do I have to get everything double checked with the server? Thanks.

thehennyy
  • 4,020
  • 1
  • 22
  • 31
xred
  • 1
  • 9
  • could you please explain what server are you using? if its custom build what language and what functionalities it have/ need to have. – S.Fragkos Sep 20 '18 at 07:21
  • Im sorry if i dont answer correctly, im pretty new. – xred Sep 20 '18 at 07:28
  • Udp server, language c#, server that will receive messages from all clients currently connected to it, have lobbies and matchmaking system for the game. – xred Sep 20 '18 at 07:29

1 Answers1

1

You have several ways to do this, I'll point out two of these with pros and cons.

Player Sends the click to move location to server.

1) The server then sends this location to ALL clients (including the originator) and then clients calculate the path and starts to interpolate movement.

pros: low bandwidth, fast execution and low complexity in implementation.

cons: Client will be easy hackable.

2) The server calculates the path the player will need to follow (pathfinding) and send the path nodes to the clients.

pros: unhackable, server will have the final word in every player action

cons: Server needs physics or pathfinding for this to work which is really lot of work. in case you implement physics you will be able to interpolate movement on server and send positions to clients in regular times to simulate movement.

Useful technologies to help you implement the second option are BulletSharp, SharpNav both of these will need you to load the geometry (Terrain) to the server side) and Snapshot Compression for optimizing Client- server Networked Physics.

Best of luck and you may ask for any clarification or help.

S.Fragkos
  • 301
  • 2
  • 9
  • How would i go about implementing my unity game physics in the server? Do you happen to know of any guide that could help? – xred Sep 22 '18 at 21:15
  • Should i do the server inside of unity to be able to use unity's physics, by using a thread? instead of outside with a console – xred Sep 22 '18 at 22:34
  • @xred I dont hink you can use Unity's Physics outside of unity, but you can use different physics and/or Pathfinding engine to do the work for you, plus you dont need heavy physics on server, just the absolutly critical things that can affect your game. – S.Fragkos Sep 24 '18 at 06:21
  • Check the BulletSharp link I provided and check the demos how to make the physics engine work. – S.Fragkos Sep 24 '18 at 06:33