lautaro52
35 posts
|
Hello Kongregate! I want to do a virtual pet game, all good. But i want this game was like in realtime or something like that. In my mind i was planning do this:
create 3 vars: hours, minutes and seconds that will say, well obviously hours,minutes and seconds. Ok, the game will autosave before you leave and when you come back, the script will compare the hour you left and the hour you came. Already compared, the hungry of you pet will descrease. Example: You left the game at 10:30:51 with 0 Hungry, and you come back at 12:08:43 watching that your Pet’s hungry is.. 5. Now… is this a good way to do a “realtime” pet game or is there another way?
Sorry for my bad English and i hope this explanation is understandable.
|
Drakim
1134 posts
|
That is very possible and you seem to have understood the necessary mechanics quite well, but I would recommend you start with something simpler just to get a better hang on things, something like Pong, Breakout or Pacman.
|
a3lex33
127 posts
|
It will work, but do you really want to do the idea? Players might not like the idea of real time waiting. Anyway, just make sure to compare time basing on some time server, not the computer time else players will cheat.
|
lautaro52
35 posts
|
mmm but i think the players won’t cheat because the only thing this “realtime” mechanism will do is descrease the hungry and happiness of your Pet. Do you think is a good idea?
|
Rivaledsouls
974 posts
|
Although players could still edit the save file, you can get a more reliable current time using this class (it uses www.time.gov which uses an atomic clock)
https://github.com/skyboy/AS3-Utilities/blob/master/skyboy/net/NetTime.as
...
//When the game is loaded
NetTime.addEventListener(NetTime.TIME_UPDATED, handleTime);
...
private function handleTime(e:Event):void{
//Get current time
var currentTime:Date = NetTime.getDate();
//Update based on time
...
}
|
Drakim
1134 posts
|
The fact that it is a reliable atomic clock wouldn’t matter in this case. The important detail would be that it is external from the user’s computer, and thus harder to mess with.
|
YuuSakuhin
6 posts
|
I agree with Drakim. And I see an other problem with the system, dépending in how you implement it.
In your example, the hunger increase by 5 in 2 hours. What will append if the player let the game open, and watch a movie? Or is connect long enough for the hunger bar to change state? It must be cumulate with an internal clock during the connexion to work correctly, if you have not already implement it.
In all case, good luck for your game, and don’t hesitate to share the solution you choose in the end.
|
saybox
2665 posts
|
Originally posted by a3lex33:
It will work, but do you really want to do the idea? Players might not like the idea of real time waiting. It works for Farmville.
|