Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
CloseRange

Running game while closed

Recommended Posts

Im looking for a way to make my game do stuff even when the game is closed. My game is supposed to gather recourses every hour or so constantly but I want it to continue to gather recourses even while you closed the game so when you go back youll have still gotten them. I know this is vary hard if not impossible so im just asking if anyone knows a way or a script to make this work thanks :P

Share this post


Link to post
Share on other sites

The only game I can think of that has done anything like this that wasn't already online, was Animal Crossing, but it just used the system time to determine what had happened while you weren't playing.

Share this post


Link to post
Share on other sites

Of course that's how you would do it, using the system time. You would calculate the time between close and open, and then run your system to determine what "happened" when you were offline, based on how much time had passed.

Share this post


Link to post
Share on other sites

There in lies the problem. Is there even a way for the RPG Maker Engine to look into the system time? There are things like Moon pearl's Daily life script that accurately emulates and keeps track of time, however it doesn't work when the game is off... 

Share this post


Link to post
Share on other sites

It doesn't need to work when the game is off. It only needs to store the system time when the game is last saved, and use it again when the game is loaded. I'm quite sure this can be done in RGSS / Ruby. Nothing is happening when the game is off, this is just being emulated.

Share this post


Link to post
Share on other sites

The default scripts even have the system time saved when you make a save file. Doing it that way will probably cause the least problems altogether and I'm not sure it can be done any other way anyway. :\

Share this post


Link to post
Share on other sites

Yes, rpg maker xp uses the Time class from ruby. It tracks the system time. While it's rather primitive, you can still use it to calculate how many seconds have passed between last time you closed the game and the next time you start up. With that you can calculate what has happened during the time the program was closed.

Share this post


Link to post
Share on other sites

http://www.ruby-doc.org/core-2.1.2/Time.html

 

time = Time.new

print time.inspect

 

Its a start. Save files in the default game also give Timestamps. So you can compare the current time with Time.new to when the file was saved and get the difference in seconds that way. Next thing to look at is the scripts for Scene_Save and Scene_Load. Most time functionality in the languages I've used start off very very greek, but eventually start to make sense.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...