5
\$\begingroup\$

I'm trying to create relatively realistic weather patterns for my game. The simulation should handle temperature, wind, cloud formation and evolution, fog/mist, rain, snow, etc., and account for terrain (including seas/oceans).

My question: how can I achieve this? I've tried looking up how weather systems work but it hasn't been that helpful.

I've given it a shot anyway. I started with a 2D pressure grid that diffused and advected in the regular fluid-dynamical way (which generates a pressure-velocity grid, i.e. wind). Then I added a humidity grid that is pushed according to the wind. I made clouds form / un-form (rain?) based on the humidity (I gave the air a humidity 'carrying capacity' based on its pressure. Any extra humidity is converted into cloud).

Anyway, I've sort of lost faith in my work so far. Am I going in the right direction? One idea would be to simulate warm / cloud fronts themselves. Would that work out?

Any direction would be nice, I really don't know what I'm doing here. Thanks.

\$\endgroup\$
  • \$\begingroup\$ I don't think there's an SE site for the questions "What makes clouds form anyway? How are pressure and temperature related? How exactly does land affect weather, as opposed to ocean?" \$\endgroup\$ – Bálint Jun 5 '17 at 11:28
  • 3
    \$\begingroup\$ Is this for viewing from space, from ground, or from an airplane? Without context that says what kind of game you're thinking of, this is a purely meteorological question that has nothing to do with game development. \$\endgroup\$ – Peter Jun 5 '17 at 12:54
  • 1
    \$\begingroup\$ It's a deepy-simulated strategy game that plays out over the course of a couple years. The player will see a map about the size of the Mediterranean. The weather will have an affect on aircraft and ships. (I'm not sure if that helps, but there you go.) \$\endgroup\$ – CheChe Jun 5 '17 at 13:05
  • \$\begingroup\$ I'm afraid you'd need to go deep into geography here and then think of how to implement all this in code. I never seen anyone do that. What are you planing to use it for, implementation may vary accordingly. Edit: just seen that you posted a comment a moment ago answering some of the questions \$\endgroup\$ – Vadim Tatarnikov Jun 5 '17 at 13:06
  • 1
    \$\begingroup\$ I am convinced that it is not feasible (made some research on that topic not long ago) in realtime, there are however quite a few scientific articles on similar topics that might help you. What might surprise you is that the popular way is similar to yours - voxelization of the model and using cellular automaton or use CML to solve the Navier-Stokes equation. \$\endgroup\$ – wondra Jun 5 '17 at 14:25
7
\$\begingroup\$

Fake it. At least to some extent.

There is a field of programming that is concerned with simulating weather, as you're probably aware. It has come a long way, and we have very accurate weather predictions because of it. However, all of that stuff is designed to run on supercomputers based on a stream of data, not as a standalone simulation on a laptop. You'd be on your own.

In my experience, realistic simulations in games are huge timesinks. The more complex it is, the more like a black box it becomes, which actually makes it harder to get it to behave in a realistic way. You'll likely end up with something that a player wouldn't understand enough to give you much benefit over just randomly spawning storms.

So, don't start with 'simulation'. Work backwards from what you want the player to see. If you want them to see storm fronts, program in storm fronts. Maybe have them randomly spawn based on terrain, like mountains or bodies of water, and also time of year. Maybe have them behave differently on different terrain. Maybe have a few special interactions when a couple of them meet. I think that's all you need to make a player feel like there is an in-depth simulation happening.

\$\endgroup\$
  • \$\begingroup\$ Minecraft's weather system is super complicated (haha) and no one seems to mind much. There's a handful of mods that make it more complex, but it's little more than a series of random (rare) events (although I never liked the ones that did tornadoes by picking up blocks and hurling them around in a non-cubist manner). Even my own alterations which used the existing biome data to affect crop growth was little more than some relatively simple math. 70% of the code was just altering the original values to be more rational under the new mechanics. \$\endgroup\$ – Draco18s Jun 5 '17 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.