Game that runs in real-time?
Would anyone be able to tell me how (or if it's possible) to create game that runs in real-time?
IE you tell the game to start a task, and you come back in 1 hour of real time, and the task is complete?
The easiest example I could use for the type of thing I'm asking about is Farmville.
IE you tell the game to start a task, and you come back in 1 hour of real time, and the task is complete?
The easiest example I could use for the type of thing I'm asking about is Farmville.
Answers
My projects need something like: player have 10 energy to spent with some actions in the game, after this get to 0 or less than 10 a realtime counter starts and give 1 energy for each 1 realtime hour past.
My second concern is about if you close the game the system keep tracking this info and updates when user plays the game again.
We should share info about this in future, just keep in contact with me using this topic or private message.
This is not me trying to put you down, it's quite the opposite
Ace
I know that with the clock system (the one there's a template for) it does calculate it even when you aren't playing the game. You have to make sure that you have save/load attributes and an attribute (for your energy, or whatever) that you can save your time stamp to. Typically called "timestamp". And set it so that timestamp saves when it's equal to or greater than whatever date you want the game to start at, so you could make it today's date, and then when ever anyone plays at anytime, if their timestamp is greater than today's date, it'll save it.
And, of course, you need a load attribute for when the game starts up to load your time stamp.
You then need to put in a behavior that when timestamp = whatever amount of time you want, it adds 1 energy, or 2, or 3, or what have you.
@mynameisace
I'm not sure if you've actually looked at the equations, not the one for the digital clock, but the ones for the flower. It's something like -1.5((game.time.year-2011)*365*24+Floor((game.time.month*1)*24+(Game.time.day*1)*30.5*24+game.time.hour*24*60*game.time.minute*24*60*game.time.second*24*60)/60)
Now, that was just off the top of my head, since I'm not on my mac right now, but I'm pretty sure that's relatively close to the actual equation.
Looking at the equation in the template, and changing mine to be the exact same, is easy, I already got that to work, and that's fine.
But what if I want a different amount of time? What if I want days, not minutes, can you figure out exactly what that equation means by looking at it? Because I can't... that's my problem, if it was something simple like, year+month+day+hour+minute+second, then it'd be fine, but I can't figure out the specifics of the equation to figure out exactly how to change it to what I want.
For example, why doesn't it have to be *24, and not *12, seeing as there are only 12 months in a year, and not 24. I understand why days is 30.5, seeing as there aren't exactly 30 days in any given month.
I'm not trying to sound angry, if that's how I sound, I'm just trying to figure it out.
If you have any way of explaining how to make it display the exact time/date that you want, without having to just guestimate, then I'd be happy to hear any advice you might have on the subject.
As for starting with different projects, I'm already doing that, I'm trying to figure this out for a project that I intend to start in the future (and maybe dabble with to try and get my barrings) rather than trying to figure it out on the fly when I'm actually ready to start this project.
there are much simpler … albeit more resource intense …
ways of tracking real time with attribute to store a startTime …
and Rules using game.Clock conditional expressions comparing those attributes
EX: changeAttribute: game.startHour To: game.Clock.Hour
Rule: When
Attribute: game.Clock.Hour ≥ game.startHour+1
--do something to show task is done … or time is up
and, of course, you would need attributes for startDay; startMonth
and your rules would have to have those conditions for valid triggering/accurate timeLapse
===
best, to get on your computer … open the Clock demo (OSTime Demo)
click on the prototype flowerActor
add a displayText: for self.TimeStamp > Preview
as the GS Note explains: this is the number of minutes from January 1st 2011 till now
add a Note behavior … drag the expression there
and analyze it … why is this number here? why is this multiplied by that?
(do some math with your calculator)
figure out what you need to use from the expression
when each of us started in GS … we knew nothing about how things worked
we learned from others … we learned from trying things out
especially trying different things to get what we needed to work working!
you want/need this functionality … you are lucky to have this demo as a starting point!
I am confident you will conquer this one! … @Whitemage87
@};- MH