Weekly programming – Client positions in fast paced networked games (v50)
|
Me and my current studygroup have designed a networking skeleton over the past week for our multiplayer space shooter project. We had already decided on using a server-client network model. After discussing how to solve the networking without causing input lag and with a good structure we started working on it. We chose to split the networking code into a “low end”-part that recieves and sends packets, a “message converter”-part that translates packets into our own message class, and a “message handler”-part that sorts and delivers messages to the game logic. We listed the types of messages we wanted to send and I will only go into details on how we handled client positions and velocity. When discussing this, me and my group settled on clients sending a current position and velocity to the server, and the server sending these positions and velocities to all clients. What we realized after todays lecture in game networking is that having the client send it’s current position and velocity is a bad idea. This gives too much authority to the clients as they can send positions that the server just has to accept and it potentially allows for easier cheating. A better way to do this is the Quake 3 method. Clients should send the control input to the server. In a nutshell, clients send button presses and how long they have been pressed to the server. Both the server and the client processes this information but the server has authority. The position of the player is updated in regular intervals by rubber-banding the player to it’s actual position. Having already built the code to work with clients sending positions and velocity means that we have to change this part of our current code and handle all issues that come along with it but it will be worth it since it is a better way of doing it. As the title of this blogpost says, this method is recommended for fast paced games, like FPS’s and not necessarily the best choice to use for other types of games. The things I talked about here was taught by our teacher Tommi Lipponen as well as from a lecture in the GDC-vault presentation on Halo: Reach’s networking: Link |