objective c - iOS game-world calendar/clock -
i'm working on ios game needs have in-game "calendar" , day/night cycle. envision finish "24 hours" take maybe 15 minutes real-world time (for example). previously, i've used int
counter time of day.
how can efficiently track game-world calendar?
i figure @ to the lowest degree utilize time of day counter, , every time resets, can increment day
counter, , every 7 days can increment week
, , on.
or might worth using epoch
-like scheme , converting readable format.
if want 24 false hours take 15 real minutes, can convert nstimeinterval
s so:
nstimeinterval real = [[nsdate date] timeintervalsince1970]; nstimeinterval false = real * 96.0; // there 96 false minutes each real minute.
you record game world's start time nsuserdefaults
, utilize offset in [[nsdate date] timeintervalsincedate:date]
instead, if choose.
ios objective-c
No comments:
Post a Comment