1
\$\begingroup\$

I would like to know what's the best approach to solve this problem. In a racing game, i need to create the final result chart. In a single environment i've tought something like:

private string [] arrivalOrder;

void playerArrived(string playerName) {
   arrivalOrder[arrivalOrder.getLength()+1] = playerName;
}

I would like to know how to do in a multiplayer environment.

How the client can communicate to server "my player finishes the racing"? Thanks

\$\endgroup\$
2
\$\begingroup\$

In a multiplayer racing game, the client should be communicating position updates to the server. The server will then sanity check the message and update all the other clients. Never, ever trust the client to do these kinds of calculations for you.

If you have the server do all the calculations, then you don't need to worry about the client telling the server when they are "done" -- the server will know.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.