How to update network shots?
I managed to make a network game where some players are updated. The player is updated in the client and then sent to the server, where a list with all players will be sent to the clients.
The players on the server have the client id as index.
Player drawing and network player drawing are separated in the client. Player draws from local variable.
But how can i make shots for all players in the network, which can collide and be removed?
Actually I make a "new bullet" message if the player presses space bar. The bullet info will be sent to the server, which adds it to the bullet list.
I would like to update all bullets in the server but serverUpdate gets not called all the time but only when the server has something to process.
So I need to update all the bullets in each client (?) How can I register that a bullet has to be removed? All clients would send a collide message at the same time to the server as far as I see. When a bullet collides on the one client with a wall, it would collide on all other clients, too.
Bullets on the server have NOT the client id as index...
I am a little bit stuck.
Anyone who had same problems?
It's my first network code.
I copied it from microVerse project. I added, that the player only updates when something changes, to save network traffic.
Short: I can MAKE bullets in network but I don't know how/where to update them, remove them and collide them with walls and players (that should work with the local player, Idk - but the walls?), synced with the server and all other clients.
Thanks in advance for your suggestions.