Shooting

Started by
2 comments, last by ro4tub 18 years, 6 months ago
I'm programming a shoot 'em up and I have a question regarding the shooting part. Should I send a message that tells the server that I am starting to shoot (pressing mouse button) and then one when I stop shooting (releasing mouse button)? Or should I send one message per bullet? Should the server send bulletss like ordinary objects, in snapshots?
Advertisement
You should just have the clients tell the server when the player has pressed or released the fire button. Then the server sends a message back to the client for each bullet fired. (You have to send this message to the other clients anyway.) If the client were to tell the server each time a bullet is supposed to be fired, then a hacker could cheat by increasing the rate of fire.
Actually, just sending edge events is very susceptible to packet loss. You might want to send the desired button state in each packet, and have the server use this input to figure out when bullets are actually fired. You can also, optimistically, render firing bullets on the client, assuming that the server will get the message.
enum Bool { True, False, FileNotFound };
Do u limit the shoot interval?
Do u limit the shoot amount?

if u have the limit, Client send "Start Shoot" packet to client,and
then Server send the "Damage Response" packet.

if u haven't the limit,Client also send "Start Shoot" pack,and send the "Damage
Request" packet to Server frequencyly.

This topic is closed to new replies.

Advertisement