In-game Weather System

So a while ago I decided I wanted my games to have realistic weather to add to the atmosphere of what I was trying to put together. I went through one iteration of the system, added it to the game, published a free version for public domain, then promptly pushed it through another two iterations (the most recent being in August) without ever updating the public version. My intention the whole time was to make improvements to it, then create a plugin that would auto-install the entire system for the user. Fast forward to this afternoon, where I decided to actually go ahead and finish that!

Ladies and gentlemen, I give to you the Weather Systems Plugin!

Simple pictures don’t do justice to the atmosphere this plugin brings to a game, between the sounds and the appearance it is by far one of my favorite projects to work on.

Here’s a rundown of what it offers:

  • Day / night cycle
  • Seasons + calendar
  • Randomized temperature based on season
  • Randomized precipitation based on season and temperature:
  • Simple rain showers to deluges
  • Snow flurries to near white-outs
  • Thunderstorms with occasional hail
  • Mixed precipitation when the temperature hovers around freezing
  • Varying levels of cloudiness
  • Ambient sounds
  • Customizable average monthly temperatures which determine where the daily and nightly temperatures will trend towards
  • Customizable seasonal precipitation which determine how often it will precipitate
  • Optional forecast GUI (includes daily temperature, precipitation, and wind (just for show) forecasts)

Most of the customizable stuff is accessed directly within the main script, it is my intention to bring those settings into the actual plugin menu.
Additionally, in the future I’d like to add a way to force a certain type of weather to occur without it changing itself.

Like I said earlier, I just released this, so if something is going horrifically wrong then let me know!

27 Likes

I kinda wish you had held off on posting it until it was possible to force a weather effect to occur. The ambiance is the most important part of a system – cool logic on deciding when it rains, snows, etc. doesn’t impact my experience as much (though I do think it was worth doing). I lazily tried to see all the effects, but I couldn’t swing it. I even had trouble changing the length of a day (you have a variable in your main script named “LengthOfDay” which does nothing; it was a good red herring).

Anyway, add a feature to change the startup weather, or to force certain weather conditions to always be present. With my short attention span, I couldn’t screw around with it for any more than 5 minutes in attempt to get it working – especially not for different types of weather. I’ll try to remember to check back in two days, or so.

All that said, I admire the effort. :slight_smile:

3 Likes

Whoops, I guess I forgot to actually finish that bit.

Will do!

2 Likes

Not sure if you do but… you should use particles for rain/snow :smiley:

3 Likes

Rad. I feel like before this kind of thing can be perfect, though, we need more skybox customization.

Nice system. I love how you bind the part with the precipitation to the players camera to make sure they see the precipitation no matter where they look or how far they zoom out.

1 Like

Does it add foggy breath when it’s cold? It should if it doesn’t :smiley:

Does the rain disappear when inside? I am far too lazy to get the plugin

Hmm, that’s something I could easily add to this. Thanks for the idea!

Unfortunately no, I’m not sure how to go about making particles disappear only under overhangs.

Take a look at this place. It’s got rather pretty rain which disappears under stuff. I think the trick was to work with large blocks at a time, but I haven’t looked at the code.

It’ll give you some inspiration for other weather effects.

1 Like

[quote=“TwentyTwoPilots, post:9, topic:19816”][quote=“pauljkl”]
Does the rain disappear when inside? I am far too lazy to get the plugin[/quote]

Unfortunately no, I’m not sure how to go about making particles disappear only under overhangs.
[/quote]

Could you cast a ray in the positive Y direction above the player’s head and remove the effect if it hits something?

I could, but then things would look goofy when your camera is right next to the edge of an overhang.

He actually creates over 700 individual parts and CFrames them on each frame so they’d fall, face the camera, and reappear higher in the sky when they hit something. It worked fine on my laptop, but I’m concerned that a method like that would spell doom for any low end machine trying to run it and the rest of the game.

This sounds dope. I’ve actually been working on a weather system myself recently that does stuff similar to this, maybe not as well. I’d use this system in a heartbeat, it’s just that mine is integrated into the game and I have scripted events happen at certain times/dates.

Plus, I’m not sure if yours would work well with around 200,000 parts and around 50 players. If it does though, let me know and I’ll give it a whirl!

1 Like

I don’t see why it wouldn’t. The client does most of the heaviest lifting by simulating the weather conditions, and even then it isn’t very resource intensive. The server simply determines the weather and tweens between different conditions.

Is this system up for testing somewhere?

Here. I ripped it straight out of my games.

The system’s pretty darn good.

One flaw in the game’s logic I noticed is the fact that if someone dies by falling off the map, they’re not sent to jail if their bounty is high enough. This is probably the case because if somebody with high bounty randomly flies off the map because their vehicle wacked out, they’re wrongly assumed to have been killed/reset and are thrown in jail.

What was happening was a few people would get their bounty upwards of 5,000 simply by exploiting this failsafe you have by jumping off the map every time they’re close to getting caught. It’s really annoying.

I recommend detecting their distance from a policeman when they die to check for fraud or having some other way to detect if they’re being pursued.

I could have a Died event check to see if their position is a) within ___ distance of a police officer on the X and Z axis, and below the police officer on the Y axis. I’ve had complaints of this, I just haven’t had the time or drive to getting around to fixing it.

1 Like

At my studio it’s not working. How can I fix it?

Try setting it up again, you might of set it up wrong.