top of page
Search
  • Writer's picturehippowombat

Approximated wind exposure calculation for survival games



I'm working on a survival game with a big focus on PVE. One thing I'm experimenting with at the moment is calculating an estimate of player exposure to wind based on surrounding occluding objects. Here's how it works:


  • Determine wind direction & strength - these are pretty simple values that have the most context relative to stat systems that I still need to put together, but the gist is that a weather controller actor defines a 2D wind direction and an arbitrary strength value. Since this is a single-player game, I get the liberty of dictating a single global wind direction & speed, since it's really relative to the player's position.

  • Perform incremental traces along the wind vector, passing by the player with an equidistant start & end position from the player on the XY plane. The height/pitch direction of these traces is based on the height of the terrain at the given XY position, so the traces sort of arc & flow over the terrain.

  • On a trace hit, find the distance from the hit position to the player. To simulate reconvergence of wind passing over obstacles, if the player is a certain distance away from an occluding object along the trace path, they're not considered "occluded" from the wind. Only if the player is close to the occluding object is their exposure status changed.


  • While not as sophisticated or nuanced as something like a GPU driven flowmap sim or something crazy like that, this does a pretty solid job of giving a simple "is the player/object being hit by wind?" value, and it only took a couple hours to formulate & implement. I also have a check for a "Structure" tag on hit objects, which increases the reconvergence distance so that player-built structures that might not be fully finished or wider objects can have their partial boundaries still contribute to wind occlusion in a way that's believable.

With this I can have more contributions to determining overall player health/exposure, difficulty in building a fire, efficacy/merit of different types of shelter, all sorts of fun stuff to help me/nature kill the player.


That's it! Super short & sweet post but I was excited about how this is working/how quickly it came together and I wanted to share. Cheers!

84 views

Recent Posts

See All

Fear

Post: Blog2_Post

Subscribe to my mailing list!
I'll try not to bug you too often!

Thanks!

bottom of page