13
\$\begingroup\$

An example of offline skilling would be EvE Online. Your character (pilot) does not gain skills by getting experience. Instead, your character gains skillpoints towards a skill you are training whether you are in or out of game. Also, I am fairly certain that skills continue to build even when the game servers are down.

Anyone have any broad ideas of how they go about this, or better yet how I could go about implementing something like this in a game I am developing. I'm not looking for a detailed explanation here (don't let me hold you back though), but I am looking for a signpost that points me in the correct direction.

Thanks!

\$\endgroup\$

2 Answers 2

17
\$\begingroup\$

Assuming the skill development is deterministic and fairly linear, all you need to do is to hook into some kind of real time clock (such as the system clock, or server clock), and calculate how long the skill has been in development.

In other words, when the skill development starts, take timestamp and store it, and whenever you want to check if the skill has improved, compare the timestamp with the current one, check if the delta is big enough, and bing, the player has a new skill.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Suddenly it makes sense why they force you to pause training if you change your attributes that affect the speed of the training! Because they recalculate the needed delta... Awesome, thanks! \$\endgroup\$
    – Dream Lane
    Commented Jan 18, 2011 at 16:19
  • 5
    \$\begingroup\$ @Dream Lane, To ease any potential computational overhead this will have. Only recalculate the earned skills/points when the user logs on. So having thousands of logged off people wont incur any overhead. \$\endgroup\$ Commented Jan 18, 2011 at 18:19
2
\$\begingroup\$

If the skill won't be used until the player is back online you can simply store the log-off time and remaining time on any skills in the queue, and then when the player logs in do something like this:

timeRemaining = currentTime - logoutTime
while ( timeRemaining > 0 and hasQueuedSkill() ) {
     skillTime -= timeRemaining
     if ( skillTime <= 0 ) {
           popSkill()
           timeRemaining = -skillTime
     }
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .