Author Topic: Weather discussion (split from FAQ)  (Read 684 times)

codeman_nz

  • Initiate
  • Posts: 3
    • View Profile
Weather discussion (split from FAQ)
« on: 3 May 2009, 03:25:31 »
I see in the shared lib there is a header file called "weather.h" but it is not used.  When is this going to be implemented and how are the variables in the header file (flatOrHilly, tropicalOrArid etc ) going to be used?

daniel.santos

  • Guest
Weather discussion (split from FAQ)
« Reply #1 on: 26 September 2009, 08:48:35 »
I'm not sure when exactly it will be implemented, but you can add yourself to the CC list of these bugs to get updates on progress:  (he's referring to this file: http://glest.codemonger.org/docs/0.2.11/d3/df3/weather_8h-source.html)

https://bugs.codemonger.org/show_bug.cgi?id=12
https://bugs.codemonger.org/show_bug.cgi?id=14

In essence, there will be a Weather Engine and the parameters you give it will allow it to generate random weather that closely emulates the weather patterns of a region that you describe -- that is the essence of Bug #14 (the complex weather system).

The simple weather system will be implemented 1st and have more canned definitions for what type of weather to expect (similar to the way tilesets now defile the chance of snow, rain, etc.), but wind will blow "across" the map and air pressure will be managed on a per-cell basis and interact with particle systems and "swayable" objects -- this is part of the plan for supporting animated tilesets, where trees, shrubs, etc will sway in the wind.  But it is also a very important part of making realistic affects and particle systems.  For instance, explosive attacks, like that of the archmage, will create a high pressure system.  Every animation frame, the Weather Engine will update, transferring pressure from each cell to the adjacent cells based upon standard physics rules (air density, mass, inertia & viscosity, pressure difference, etc.).  In practice, the engine will use abbreviated versions of the calculations, or skip them entirely when they are unlikely to affect the rendered scene (i.e., camera view) and later revisions can include a mechanism to fill in those calculations if you move the camera somewhere it's been summarizing this way.

So the end result (with the simple wind model) is an exceedingly realistic environment.  For instance, if a building is on fire and an archmage attacks a unit next to it, you will see the fire particles be harshly blown away from the center.  You may even notice the subsequent wave back in the other direction, as is common in explosions, it's often followed by an implosion due to the inertia of the gasses escaping the center causing a momentary low pressure system (as it's "stretched" apart), which then implodes on its self.

Having traveled a fair amount, one of the things I enjoy about it is the way everything looks and behaves differently in a different part of the continent (and I've never even left the Americas!).  The complex weather model is aimed at bringing that variety to the game, from wind and storm patterns, to humidity & fog levels.  It's an ambitious endeavor for certain, but the majority of the calculations should be able to be done when the game is loading, allowing that code to be unloaded from memory (well, paged out) and using minimal CPU cycles during play time.  In essence, rather than specifying weather patterns in the tileset, the Weather Engine will figure that out for you after you tell it about where you're map is located.

 

anything