Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Offline Timer

Author
Message
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 13th Jun 2012 12:46
I am wondering if it is possible to make something keep time in an application without it relying on a persistant online source.
So if i made a resource based program that gave you a peice of wood every 2 hours once you build something, if you switch it off but then come back to it 8 hours later you would have 4 peices of wood, even though the computer has been switched off.

Similar to "Settlers Online", only offline.

Also on another note, i take it darkbasic is going out of the window now that everyone is all app app app app app app app crazy, they even moved the forums higher to prioritize. Just curious is all.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 13th Jun 2012 18:33
You would have to get the date, and time, and have the game update on reloading. So the game would simulate that time had passed.

print get time$()
print get date$()
wait key

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 14th Jun 2012 17:13
I was thinking about this, and its the only thing i could think of originally. The only problem is you could easily cheat the system by changing your system date. Change your system date to last year, starting the game up, build a few things then advance it a little. Then build more with all the resources because it thinks 6 months has passed and do it again.
Ideally i would like to try a different solution if possible.

Thanks for the reply though.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 14th Jun 2012 18:49 Edited at: 14th Jun 2012 18:50
Well you could do it once, but the second attempt could be checked if the date was before the last date committed. I suppose you could store the install date with a batch script, and that would disable the first attempt to cheat. Then to cheat you have to change the date before installing the game, and you still only get one chance to cheat.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 14th Jun 2012 22:45
Aye thats not a bad concept. I think i would end up mainly on people not trying to ruin it for themselves by cheating
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 15th Jun 2012 04:13 Edited at: 15th Jun 2012 04:14
this is interesting... and got me thinking of the calculation concept

as most yearly systems are fixed...
aside from leap years... which is easy to calculate anyway

say you use that LEFT$ and RIGHT$ thing

MM / DD / YY

you can work this out by using



so my concept is

MM = 12
DD = 1-31 [depending on MM] [IF MM = 01 DD = 31 etc]
YY = 12 [FROM NOW] to 99 [or how ever long you anticipate your app to be in existence for] [this is also used to interpret the leap year data]

so basically you take the month calculate the individual months prior up to the present month and then calculate the current day to represent the total of days for that month then simply calculate the total days within the year that have elapsed from the previous run... same goes for time which is likely more tedious lol

eugh can someone post up a less complex method or build from mine?

I would love to see a simple community shared concept...

[And for the record I never claim to be a maths Einstein]

EDIT

Fixed the code box

Login to post a reply

Server time is: 2024-11-21 23:24:28
Your offset time is: 2024-11-21 23:24:28