Sign in to follow this  
Tispe

Player attack timings

Recommended Posts

Tispe    1468
Hello

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

edit:
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
Tispe    1468
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this