Skip to content

Repository files navigation

Dynamic weather module

This is a dynamic weather module built for Roblox.

Refer to the wiki for details.

Overview

This project is a fully event-driven localized weather simulation system designed to render dynamic storms efficiently while maintaining smooth performance. Rather than relying on global weather states, every storm exists independently, allowing multiple weather systems to coexist naturally throughout the game world.

The system focuses on scalability, deterministic simulation, and client-side visual fidelity.


Features

  • 🌧️ Independent localized storm systems
  • ⚡ Dynamic visual storm progression
  • 🌀 Client state simulation based on environmental conditions
  • ⏱️ Time-scalable weather simulation
  • 🚀 Event-driven architecture
  • 📦 Optimized rendering using PartCache
  • 🎯 Distance-based rendering and culling

Storm Simulation

Each storm is simulated independently using an event-driven update model.

Instead of updating every frame with a traditional game loop, the simulation advances according to elapsed time measured with os.clock(). This allows storm progression to remain deterministic while avoiding unnecessary computations.

Each weather system contains a configurable TimeCycle attribute that controls the speed of the simulation.

  • Higher values accelerate storm progression.
  • Lower values slow the simulation.
  • Visual effects remain synchronized regardless of simulation speed.

This design makes it possible to create storms that evolve at different rates without modifying the underlying simulation logic.


Client Weather State

The client's perceived weather is determined by their proximity to rainfall rather than simply entering a predefined weather region.

The system continuously evaluates the density of nearby rain particles generated by a custom particle system.

Using the amount of rainfall surrounding the player, it can determine environmental intensity such as:

  • Light rain
  • Moderate rain
  • Heavy rain
  • Storm conditions

This approach creates smooth transitions between weather states and allows overlapping storms to blend naturally.


Custom Rain Particle System

Rainfall is generated through a custom-built particle system instead of relying solely on built-in particle emitters.

This provides greater control over:

  • Particle density
  • Spawn behavior
  • Simulation timing
  • Collision behavior
  • Weather intensity calculations

Because every rain particle contributes to nearby weather intensity, the particle simulation becomes part of the environmental simulation rather than serving only as a visual effect.


Rendering Optimization

Rendering every active storm continuously would become expensive as the number of storms increases.

To solve this, the system employs two primary optimization techniques.

PartCache

Storm visuals are rendered using PartCache, allowing reusable objects to be recycled instead of constantly creating and destroying instances.

This significantly reduces memory allocations and garbage collection overhead.

Distance-Based Rendering

Storms outside the client's rendering range are ignored entirely.

Only storms close enough to affect the player are rendered and updated visually, allowing a large number of active storms to exist without unnecessary rendering cost.


Architecture

The weather system follows an event-driven architecture where simulation, rendering, and client perception remain largely independent.

Storm Simulation
        │
        ▼
Time Progression (os.clock + TimeCycle)
        │
        ▼
Rain Particle Simulation
        │
        ├──────────────┐
        ▼              ▼
Visual Rendering   Client Weather State
        │
        ▼
PartCache + Distance Culling

Separating these responsibilities makes the system easier to maintain, extend, and optimize.


Design Goals

The primary goals of the system are:

  • High scalability
  • Low runtime overhead
  • Deterministic weather progression
  • Smooth visual transitions
  • Independent localized weather systems
  • Efficient client-side rendering

Technologies

  • Luau
  • Event-driven simulation
  • os.clock() timing
  • PartCache
  • Custom particle system

Summary

This weather system combines deterministic simulation, event-driven updates, custom particle simulation, and aggressive rendering optimizations to support large numbers of localized storms while maintaining consistent visual quality and efficient runtime performance.

License

This module is available under the terms of the Apache License. Refer to License for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages