What I'm planning on doing is:
- 1. Making a map with coins throughout it
2. Storing the x,y locations of the coins in a database, as well as the map name. Only to be done ONCE per map, by me, and not by players.
3. Then when a game is started from a room, the client will tell the server which map was chosen.
4. The server will get the coin locations based on the map name
5. When a player picks up the coin, a message is sent to the server, which then does a check, to ensure they actually got a coin. Which then tells the rest of the players that the coin was picked up.
So my problem here is that how does the server know which coin that the player picked up? Loop through them all and check for the closest one? Could that cause problems with multiple coins close together? And if that works, how do the rest of the clients know which coin was picked up, so they can remove it?
Perhaps I'm looking at this all wrong though, is there a better way of going about it?