Jump to content
  • Advertisement
Sign in to follow this  
gamergamer

Is Real-Time Energy Fill Available Only To Online Games?

This topic is 3154 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

Hi, I am designing a game and I wanted to know the following: In a lot of online game e.g. Most of Facebook games like Zynga's Mafia Wars, the energy fills in real-time. Could this feature be done in an offline game or the game needs to be online? Thank you, GamerGamer

Share this post


Link to post
Share on other sites
Advertisement
Filling energy bars has nothing to do with the online or offline status of the game, unless you're making an online game and your client needs to ask the server how full the bar is.

Share this post


Link to post
Share on other sites
Quote:
Original post by BLiTZWiNG
Filling energy bars has nothing to do with the online or offline status of the game, unless you're making an online game and your client needs to ask the server how full the bar is.


So, you can have a real-time counter that increases let's say your energy bar by 1 after 5 real-time minutes in an offline game even if you don't access it?

Share this post


Link to post
Share on other sites
Quote:
Original post by gamergamer
Quote:
Original post by BLiTZWiNG
Filling energy bars has nothing to do with the online or offline status of the game, unless you're making an online game and your client needs to ask the server how full the bar is.


So, you can have a real-time counter that increases let's say your energy bar by 1 after 5 real-time minutes in an offline game even if you don't access it?
Are you talking about (e.g.) shutting down the game, then starting it up again 5 minutes later and having one more health unit than you did previously?

Share this post


Link to post
Share on other sites
Not really, unless you're running some kind of server 24/7. But you can do a trick which will make the program's behaviour appear to the user as if it was running and doing something during the time when it actually wasn't:

Each time when the program is shut down, you write the current time to a file. Then, when the program is started again, you read this file and compare the recorded shutdown time with the current time. This will tell you how long the program was "offline" and allows you to compute and apply the changes that should have happened in between (like your energy increase).

Share this post


Link to post
Share on other sites
Quote:
Original post by wurstbrot
Each time when the program is shut down, you write the current time to a file. Then, when the program is started again, you read this file and compare the recorded shutdown time with the current time. This will tell you how long the program was "offline" and allows you to compute and apply the changes that should have happened in between (like your energy increase).
You probably want to take some precautions if you go this route, to prevent the user from setting their clock forward an hour to gain more resources.

Share this post


Link to post
Share on other sites
Why? Cheating is always possible, at least in single-player games. If the player wants to do it, she or he will. And nobody else cares. I'd rather invest that work time into the game itself.

Share this post


Link to post
Share on other sites
That was my next question...How to avoid the cheat with the clock.
I would also like to add that I am designing the game for the iPhone platform. Not sure if this changes things though....

Share this post


Link to post
Share on other sites
since the iphone probably comes with a internet flat you can get the current time from a timeserver.

here are some
http://www.helmut.hullen.de/filebox/DCF77/ntpsrvr.html

Share this post


Link to post
Share on other sites
Quote:
Original post by Sudi
since the iphone probably comes with a internet flat you can get the current time from a timeserver.

here are some
http://www.helmut.hullen.de/filebox/DCF77/ntpsrvr.html


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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!