Sign in to follow this  

Shooting

This topic is 4475 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this