Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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!

share|improve this question
add comment

2 Answers

up vote 16 down vote accepted

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.

share|improve this answer
2  
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! –  Dream Lane Jan 18 '11 at 16:19
1  
@Dream Lane, if this answers your question you should mark it as "accepted" –  Tetrad Jan 18 '11 at 17:32
5  
@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. –  AttackingHobo Jan 18 '11 at 18:19
add comment

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
     }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.