• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Game Time

Nickalooose

--------------------
  • 1,309
    Posts
    17
    Years
    • Seen Dec 28, 2023
    Is it possible to NOT use real time within a game...

    I actually thought about using a start time of something, and having it be:

    For every real 6 hours the game passes 24(1 day), so I guess for every minute of real life, the game would pass 4 minutes, so every 15 seconds of real life, the game passes 1 minute... I think that's how it would work out.

    And would it be possible to edit this time VIA a script afterwards?

    Do you get any of that?

    I kind of confused myself during the explaining part of this haha! I'll try and explain better if you need be.
     
    I haven't looked at it propaly yet but at a glance, I think you just need to adjust the pokemon time/day night script, I dont think it should take to much to work out by playing around with it.
     
    Look around line 90 through 115 of the PokemonTime script. Some modification of this would more than likely achieve a custom day and night system.
     
    The easiest method would be to have the in-game time still depend on the real world time, but add in a couple of extra calculations.

    In theory, adding the lines below will get you what you want.

    Code:
      def self.pbGetDayNightMinutes
        now=Time.now # Get the current system time
        hour=now.hour
        minute=now.min
        [COLOR=Red]totmins=(hour*60)+minute
        days=4
        newtotmins=days*(totmins%(24*60/days))
        hour=newtotmins/60
        minute=newtotmins%60[/COLOR]
        month=now.mon-1
    The days value is the number of in-game days per 24 real world hours (i.e. 4 means one in-game day every 6 hours as you desire). The code is this way round on purpose; it's much more difficult to define one in-game day as X real-world hours than it is to define X in-game days per 24 real-world hours.

    As for manually changing the time, you could add an offset to totmins, and change the offset accordingly. Said offset would need to be equal to the difference between the current real-world time and the desired real-world time (you should make a def to deal with that business), and is something I leave for you to figure out.
     
    I take it that that fix will still show up on the trainer card as time played in game.
    Is there a way to show it as a time of day instead of minutes played?
    And is there a way to set it accordingly.

    for example if it is 10:50pm in game it will show on trainer card as 10:50pm
     
    No, what I gave just changes the shading. You'd need to make further changes in the Trainer Card script section to have it show in-game time (i.e. replace the amount of time played with the in-game time).

    The amount of time played is completely separate and different to the in-game time.
     
    Oh ok cool, I understand that now.
    Thanks Maruno. So I just need to link the two, separately so the day/night cycle corresponds with the time shown on the trainer card. the two are not actually linked by any script at all.
     
    Wow, I'm a little slow on the responces haha!

    EDIT: This only works the shading... And doesn't work anything else...

    Can this little bit of code refer to the time itself and change it? So the new in-game time will be my new 6 hours = 1 day

    Or will I refer to totmins for that?
     
    Last edited:
    Oh ok cool, I understand that now.
    Thanks Maruno. So I just need to link the two, separately so the day/night cycle corresponds with the time shown on the trainer card. the two are not actually linked by any script at all.
    The thing that is currently shown in the Trainer Card is the total amount of real-world time you have spent playing the game. You can either multiply this amount of time by 4 to get the total amount of in-game time spent playing the game, or replace it with the completely separate piece of information which is the current in-game time.

    Other time-related functions, such as evolutions at night and events that reset themselves at "midnight", will need to be edited as well so that they use the in-game time rather than the real-world time.

    Time.now is the real-world time.
     
    I figure I may have been a little slow again... So I shall paste here;

    EDIT: This only works the shading... And doesn't work anything else...

    Can this little bit of code refer to the time itself and change it? So the new in-game time will be my new 6 hours = 1 day

    Or will I refer to totmins for that?
    I can't figure out how to call now or newNow(for example) as a method, to call my new time even if I tried any of what I have asked.

    EDIT again: Nooo wait I get it...

    I will make a new def to work out the next part and use totmins to find out how many days have past, to use in-game... Time.now is not needed unless I would want to know the real time
     
    Last edited:
    Hey, sorry I'm kinda new here, I'm helping with Nicola's project homeward bound, I'm have experience with RPG Maker and scripting plus among other things. She pointed out to me this thread about time changing. Now I would actually like to know how would we go about using a fake time, so in theory we could allow for time fast forwarding.

    Does anyone have an idea on this, I was originally thinking about removing PokemonTime, completely, but Nicola still wants the day and night system.

    So I figured removing all time.now's etc, but they interlink with day night system.

    Is there another way?

    I will be signing up with my own username later, so apologies for using Nici's right now
     
    Convert some 'Time.now' in scripts to use something like the defs:
    Code:
    module NewTimeSystem
      Proportion=4 # Time proportion here
    
      def self.seconds
        return (Graphics.frame_count / Graphics.frame_rate) * NewTimeSystem::Proportion 
      end
    
      def self.minutes
        return self.seconds/60
      end
    
      def self.hours
        return self.minutes/60
      end
    
      def self.days
        return self.hours/24
      end
    
      def self.months
        return self.days/30 # Needs a better check
      end
    
      def self.years
        return self.days/30 # Needs a leap year check.
      end
    end
     
    Hey FL ., Thanks for the reply...

    Would this be in a new script section?

    I thought about doing a calendar, so I could use leap years and days in a month, from that probably.
     
    Yes.

    Alternatively (this is more easy to adapt) you can use a certain start date (like January 1, 3000) and sum the time in sec, like:
    Code:
    def newTime
      proportion=4 # Time proportion here
      return (Time.utc(3000,"jan",1)+(
        Graphics.frame_count / Graphics.frame_rate)*proportion)
    end
    Take a look in https://www.ruby-doc.org/core-1.9.3/Time.html for time class. Untested.
     
    Back
    Top