Jump to content
  • Advertisement
Sign in to follow this  

Player attack timings

This topic is 2563 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 want to know which methods I should consider when implementing a RPG game.

Basically a server hosts the game and keeps track of things like attack, defence, hp, and attack speed.

1. Player A is close enough to swing a sword at player B. (server updates status to "Player A is attacking Player B")
2. Attack speed is "one swing every other seconds".
3. Server must somehow know exactly when next attack event should be handled. (i.e player do not send the "attack" packet, the server do this automatically if Player A is engaged to Player B and if they are close enough)

Another example is, "player A is casting a spell on player B". The spell casting time is 3.2 seconds. it would be stupid for the server to wait and block unless it's doing multithreading. Should I just check if the elapsed time has passed for each game loop and then do the event? And there are also so many other "effects" that must be checked. "Has the HP+50 buff expired?". For the server it is alot to keep track off (100-1000 players/npcs), many IF checks etc, is this viable?

Thank you

I wish to know how the server shall be written.

I am thinking of a thread working contiously on a database, updating states.

Share this post

Link to post
Share on other sites
I really want to know which method I should consider. Any input is much appreciated. Should the server have a big "database" with one worker thread mauling over it?

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!