Has anyone developed, or know of, a weather engine for Ren'Py?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Errilhl
Regular
Posts: 164
Joined: Wed Nov 08, 2017 4:32 pm
Projects: HSS
Deviantart: studioerrilhl
Github: studioerrilhl
Contact:

Has anyone developed, or know of, a weather engine for Ren'Py?

#1 Post by Errilhl »

I'm considering adding weather to my game - different weather, temperature etc. will figure in when deciding what activities and events are available. So, I was wondering if I have to code this myself, or if this has already been made, so I don't have to reinvent the wheel.

What I would like for it to have:
  • Random weather, preferably based on previous days weather as well, so you have a somewhat gliding weather change, instead of sudden, random weather day by day
  • Temperatures matching a set list of months (or the ability to set these in an array or similar)
  • A way to have a low chance random effect like thunderstorms, downpour/torrents, and so on
  • Let rain/snow be "correct" for months as well
  • Preferably the ability to have gradually worsening weather during the day, or gradually getting better (so, for instance, it starts out like a sunny day, but by evening it's puring down, or it starts out like a cloudy day, but gets sunnier during the day)
Does anyone know of anything like this, or maybe suggestions of other code that can be modified to fit this? If not, I guess I'll go ahead and try to make something myself.
Currently working on: Image

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Has anyone developed, or know of, a weather engine for Ren'Py?

#2 Post by RicharDann »

I did look into this some time ago since I wanted to have a weather system simmilar to the one found in Persona 4, where daily activities are affected by weather.

While I didn't find anything regarding specifically the weather, if you're going to use months and days to control the flow of time in your game, maybe you can use an already made calendar system as a base and add weather functionality. If I recall correctly the Dating Sim Engine has days divided by time periods (morning, afternoon, etc.). You'd have to add some way to change weather conditions on each day, month, etc. Wich might be a lot of work depending how close to reality you want to make the weather in your game behave.
The most important step is always the next one.

Errilhl
Regular
Posts: 164
Joined: Wed Nov 08, 2017 4:32 pm
Projects: HSS
Deviantart: studioerrilhl
Github: studioerrilhl
Contact:

Re: Has anyone developed, or know of, a weather engine for Ren'Py?

#3 Post by Errilhl »

Hm. Yeah, I already have a working (sort of) calendar in, so I might just see if I can expand on that, and make it something more. If not, I will have a look at the Dating Sim Engine, and see if I can extract what I need.
Currently working on: Image

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Has anyone developed, or know of, a weather engine for Ren'Py?

#4 Post by RicharDann »

Just in case there's also the Quickstart Framework:

viewtopic.php?t=22393

I didn't mention it in my previous post but I should have (had forgotten about it), this one has a more complicated system but has an already made month calendar.
The most important step is always the next one.

Errilhl
Regular
Posts: 164
Joined: Wed Nov 08, 2017 4:32 pm
Projects: HSS
Deviantart: studioerrilhl
Github: studioerrilhl
Contact:

Re: Has anyone developed, or know of, a weather engine for Ren'Py?

#5 Post by Errilhl »

Thanks again. I will have a look, and see what I can come up with.
Currently working on: Image

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Has anyone developed, or know of, a weather engine for Ren'Py?

#6 Post by Remix »

Depending on which direction you are taking with your game, you could also look at

Event Handler with Lexer

It mostly handles progression of time and a simple Ren'py-esque way for setting things up and registering labels as events. Basically allowing game scripting to be Ren'py style without the need to keep having $ python lines or blocks.

For integration into a weather model you could perhaps just amend the EventHandler advance_time method to call an external function (or class) and perhaps pass the month/day/hour as parameters. (that method is called each time Ren'py reads a script line such as 'event time "90 mins"') Events themselves can be easily set up to include a conditional function such as test_weather( "temp <= 0" ) for label ice_skating_on_pond etc... e.g.

Code: Select all

label ice_skating_on_pond:
    event register:
        weekday "Sat" "Sun"
        hour range(11, 16)
        function:
            test_weather [ "temp <= 0", "snow == False" ]

    "You go ice skating... wheeee"
    
    event time "1 hour"
    # that line advances time and (if you tweaked the advance_time method) then determines any changes to the weather
Frameworks & Scriptlets:

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: Has anyone developed, or know of, a weather engine for Ren'Py?

#7 Post by noeinan »

If I were including weather in a game I made, I would include a weather check in whatever code I was using to progress the time. For example, in the code for my current game...

I use the calendar code created by xela, which is located in the Quickstart that RicharDann linked above.

Then I have a "timecount" label, which I call whenever I want to check to see what time of day it is, and if the game has moved to the next day:

Code: Select all

label timecount_nomsg:
    
    if time_cnt > 5:
        $ time_cnt = 1
        $ timeofday = "sunrise"
        $ day_cnt += 1
        $ calendar.next()
        
### Here I keep a list of all variables that get "reset" at the end of each day
        
    if time_cnt == 1:
        $ timeofday = "sunrise"
    elif time_cnt == 2:
        $ timeofday = "morning"
    elif time_cnt == 3:
        $ timeofday = "noon"
    elif time_cnt == 4:
        $ timeofday = "sunset"
    else:
        $ timeofday = "night"
        
    jump check_events
    return
And then throughout my code, if going to certain places or performing certain actions makes time move forward, I include some code saying "$ time_cnt += 1".

To add weather, especially randomized weather, I would add a weather check inside the timecount code. I'd have to make a label that checks the weather, and gives me a list of random weather effects. Could even make it different for each month. Ex:

Code: Select all

label weather_checker: 
    $ weather_spawn = renpy.random.randint(1, 100)
    
    if calendar.month == "January":
        if weather_spawn < 10:
            weather = "Sunny"
        elif weather_spawn <50:
            weather = "Cloudy"
        elif weather_spawn <97:
            weather = "Rainy"
        else: 
            weather = "Snowy"
            
 ## Continue making lists like this for each month, with different ratios of weather as you feel appropriate.
 
     return
If you wanted weather to get progressively worse or better, you could always make another variable that is triggered by certain events, for example, a variable called "weather_worse" or "weather_better".

Code: Select all

label weather_checker: 
    $ weather_spawn = renpy.random.randint(1, 100)
    
    if weather_better == True: 
        weather_spawn += 30
        
    if weather_worse == True:
        weather_spawn -= 30
    
    if calendar.month == "January":
        if weather_spawn < 10:
            weather = "Sunny"
        elif weather_spawn <50:
            weather = "Cloudy"
        elif weather_spawn <97:
            weather = "Rainy"
        else: 
            weather = "Snowy"
    
    $ weather_better = False
    $ weather_worse = False
    
    return
Image

Image
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]