Wind in Ghost of Tsushima serves two main purposes. First off, it helps set the tone from minute one, sweeping and swirling around players as they explore the vast island of Tsushima, kicking up autumnal colors and creating what can only be described as intense samurai vibes.
It also, however, doubles as a naturalistic companion. In order to strip back the traditional HUD without forcing players to wander aimlessly, Ghost of Tsushima developer Sucker Punch created a 'Guiding Wind' feature to gently ferry players from objecting to objective, allowing them to summon a gust of wind that will point them on their way with just a quick swipe of the DualShock touchpad.
Taking to the virtual stage at GDC 2021 to outline how wind works in Ghost of Tsushima, Sucker Punch coder Bill Rockenbeck explained the techniques used veer more into the realm of heuristics and hacks that allowed the dev team to blow millions of vents using only a small fraction of the PS4's computational capacity.
He explained that, for the purposes of Ghost of Tsushima, the wind simulations needed to prioritise volume over accuracy. As such, the model used for wind velocity (in the case of Guiding Wind) in the game is quite simple, and for the most part relies on a single vector pointing from the hero towards a current goal.
In cutscenes and other non-Guiding Wind situations, the studio used a single authored vector that might, for instance, vary with the weather. "We're not doing any real modeling of fluid dynamics," explains Rockenbeck. "The main wind vector has a constant direction, but we varied the magnitude a bit from place to place using time-varying Perlin noise. This is visible on large fields of grass when you can see gusts of winds blow through."
Particle systems were used to add in some higher frequency noise curl to, as Rockenbeck puts it, "sort of make things swirl around more." Sucker Punch also gave those particle systems access to a thing it calls 'vorticles,' which are basically invisible wind-generating particles that can be sampled by other particles. Beyond that, particles, grass, and foliage also have access to some inputs that are used to model local disturbances, such as the footfall of passing characters.
To ensure particles react appropriately to the blustery world of Tsushima, Sucker Punch switched out its main terrain implementation to a height map-based approach that incorporated a hierarchy of tiles containing various resolutions of height map data that could get paged in and out. The studio gave particles access to that height map using a terrain pause function that snaps given particles down to the ground, and used the same technique to create larger scale wind gusts.
"We're not adjusting the wind direction in general to flow around mountains in a complex way, and this is fine for most things, but it looks bad if wind is carrying stuff straight into the side of a mountain [...] so we are doing the most basic approximation of fluid dynamics for just this case, by taking several height map samples out in front of each particle and giving it an upwards velocity in advance so they float over things nicely."
In a bid to jazz up proceedings even more, Sucker Punch also uses those aforementioned vorticles (pictured above) -- which Rockenbeck calls "a special flavor of particle" - to add an extra layer of interactivity to particle motion.
"[Vorticles] don't actually draw themselves, but are visible only through their effect on other particles. They're basically like little spheres of wind. They output a position, an orientation, and a radius, and also a vector which determines the direction of the wind," Rockenbeck adds.
Those vorticles use a co-ordination system that's attached to the surface of the sphere -- so it has, east, west, north, south, and up-down components -- to allow the game to model multiple wind shapes including circular vortexes, linear gusts, and outward facing blasts just by pointing that vector in different directions.
"Vorticle emitters atomically append these into a single small array, listing all the vorticles in the world, and then regular particle emitters can access this array through a new function which samples the accumulated vorticle contribution at a point. It's doing this in a really brute force way -- just running down the whole list and adding up all of the contributions. It somewhat amazingly works even up to hundreds of vorticles," continues Rockenbeck.
"This isn't an automatic thing. Particle emitters only opt-in to this in a voluntary fashion for relatively few places where it helps, and since it's another building block function, emitters decide for themselves what to do with this information. They might decide, in a straightforward way, to add the vorticle wind under their acceleration vector so they get blown around by it like these leaves over a campfire (pictured below) where there's some upward facing vorticles emitting from it."
Rockenbeck notes that vorticles are also used to perform other functions, such as allowing players to extinguish candles with a well-placed sword strike or firing an arrow to scare away local fauna.
Want more game dev lessons from GDC 2021? Click here to catch up on even more tips, pointers, and tidbits from this year's conference.