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

Started by
21 comments, last by gamergamer 14 years, 1 month ago
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
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.
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?
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?
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).
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.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

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.
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....
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
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


This topic is closed to new replies.

Advertisement