Skip to content

Instantly share code, notes, and snippets.

@Zarkonnen
Last active March 26, 2022 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zarkonnen/bf56b5c72b203767cac8ddc264781fc3 to your computer and use it in GitHub Desktop.
Save Zarkonnen/bf56b5c72b203767cac8ddc264781fc3 to your computer and use it in GitHub Desktop.
New weather and landscape features documentation

These new features for weather and landscapes are currently available in the "weather" beta branch on Steam. The new data format is backwards-compatible with the old one, so you can e.g still just set "rain": true to get generic rain.

One big change is that instead of having extra fields for a snowy variant of things, there's now a generic "variant" value that can be used to define multiple visual variants of land blocks and backgrounds.

LandscapeType

  • backgroundFlavors - list, which CombatBackgroundFlavors this landscape type supports
  • hills - 0.0 to 1.0, hilliness
  • hasTrees - true/false, whether there are any trees
  • minTreeClusterDistance - Minimum distance between clusters of trees, in blocks.
  • maxTreeClusterDistance - Maximum distance between clusters of trees, in blocks.
  • minTreeDistance - Minimum distance between trees inside a cluster, in blocks.
  • maxTreeDistance - Maximum distance between trees inside a cluster, in blocks.
  • minTreeClusterSize - Minimum number of trees in a cluster.
  • maxTreeClusterSize - Maximum number of trees in a cluster.
  • minSmallTreeHeight - Minimum trunk height of small trees, in blocks. Default 1.
  • maxSmallTreeHeight - Maximum trunk height of small trees, in blocks. Default 2.
  • minLargeTreeHeight - Minimum trunk height of large trees, in blocks. Default 2.
  • maxLargeTreeHeight - Maximum trunk height of large trees, in blocks. Default 3.
  • largeTreeP - Probability a tree is a large tree.
  • bushDensity - Probability a bush is spawned on a tile.
  • specialGrassDensity - Probability a grass tile is a special grass tile.
  • specialGrasses - List of "special grass" block types.
  • specialFloaterTopDensity - Probability a floater top tile is a special tile.
  • specialFloaterTops - List of "special floater top" block types.
  • weightedTimesOfDay - List of { name: TimeOfDay, weight: integer } to override which times of day the landscape type supports
  • hasFloaters - true/false whether the landscape has floating rocks
  • soil, rock, suspendiumOre, grass, bush, smallTreeRoot, smallTreeTrunk, smallTreeCrown, largeTreeRoot, largeTreeTrunk, largeTreeCrown, floaterTop, floaterUp, floaterMiddle, floaterDown, floaterDowner, floaterDownerRock, floaterDownerSuspendium, floaterBottom - LandBlockTypes to override the default types.

LandBlockType

Much as before, but instead of snowAppearance, topSnowAppearance, snowParticleEmitter, externalSnowApp, externalTopSnowApp, you can now use a mapping of any kind of variant value to appearances and emitters, eg:

particleEmitters: {
	"normal": ...,
	"snow": ...,
}

So the new keys are:

appearances, topAppearances, particleEmitters, externalApps, and externalTopApps.

The default variant is called "normal", and snow entries are translated to "snow".

And you can now specify lights for them. Don't overdo this, as light sources have a performance cost! Example: stele tops in Ruins.json.

  • lightClr - { r, g, b} color of light
  • lightRadius - Pixel radius of light
  • lightX, lightY - Position of light in pixels from top left of the block

TimeOfDay

Replaced topLight etc. with fromTopLight etc. and made them refer to the correct lights.

There are new values for clouds:

  • minCloudSpawnHeight, maxCloudSpawnHeight: in pixels above ground
  • minNumClouds, maxNumClouds: to control the number of clouds

And two other new values:

  • isFairForTournament - true/false, defaults to false, whether this time of day can be used for combats, so it doesn't have directional advantages like dusk/dawn do
  • standard - true/false, defaults to true. Whether this time of day should be added to the available times of days for landscape types that don't override them. For example, sandstorm has this set to false because sandstorms are exclusive to deserts.

WeatherEffect

  • landscapeVisualVariant - String used in LandBlockType and Backdrop to control their visual appearance. More flexible replacement for the "snow" boolean. Defaults to "normal". Things marked as "snow" or "snowy" now use "snow". Could now also be used to for example do "autumn" for autumn trees, or I don't know, "cursed" for cursed landscapes.
  • shootJitterMult - Inaccuracy multiplier for weapons.
  • shootToRightJitterMult - Inaccuracy multiplier for weapons shooting left-to-right.
  • shootToLeftJitterMult - Inaccuracy multiplier for weapons shooting right-to-left.
  • fireExtinguishChance - Likelihood per time fires go out on their own.
  • wind - Speed applied to particles, etc.
  • lightningChance - Chance per millisecond of a lightning strike.
  • fogClr - Color of the fog. If you don't set this, you don't have to specify the other fog values either.
  • fogLevel - Fog height in pixels off the ground.
  • weakFogLevel - Secondary fog height in pixels off the ground. This fog layer is purely aesthetic, the inaccuracy multiplier applies to fogLevel.
  • weakFogClr - Color of the weak for layer. Note that both are drawn on top of each other.
  • fogJitterMult - Inaccuracy multiplier for weapons targeting locations in the fog.
  • groundImpactParticle - ParticleType for when stuff hits the ground.
  • numGroundImpactParticles - How many particles stuff hitting the ground should spawn.
  • icon, icon2 - Two icons { src, x, y, w, h } to display in the top right to tell the player what the weather conditions are.
  • numStars - Number of visible stars.
  • backgroundLoop - Sound effect value (same format as with eg module sound effects) for a looping background sound.
  • particleDripSpeed - How quickly particles stuck to ships drip off. Default 0.0002.
  • occasionalSound - Sound effect that gets played randomly, eg thunder.
  • occasionalSoundChance - Chance per millisecond that the occasional sound is played.
  • precipitationSpawnZones - List of precipitation spawn zones. Much more flexible replacement for the old rain and snow system.

Precipitation spawn zone format

Each precipitation spawn zone is a particle system that contains line-shaped particles of a specific color and shape. They are spawned inside the spawn zone and then move until they are outside of the visible area and won't re-enter it, at which point they're re-spawned. You can see an (imperfect) example of how this can be used for something that isn't rain or snow by looking at the new sandstorm weather effect.

  • x, y, w, h: Position of the spawn zone in pixels. Note that the visible area is at x = -3200 to x = 3200 and y = -2500 to y = 1000. So you wan to place the zone just outside the visible area, so particles enter the visible area from the sides rather than spontaneously materializing.
  • minXSpeed, maxXSpeed, minYSpeed, maxYSpeed - Determines the velocity vector of each particle. Eg rain going straight down would be eg minXSpeed = 0, maxXSpeed = 0, minYSpeed = 0.7, maxYSpeed = 0.9.
  • drops - The number of particles in the system. Obviously, drawing particles has a performance cost, so don't do more than maybe 1500 particles in total, and see if you can use less.
  • clr - The color of the particles, in { r, g, b, a }.
  • dropW, dropL - The particles are drawn as lines in the direction of travel. dropW is the line width, dropL is the line length.
  • sticksAs - Optional ParticleType to make the precipitation particles turn into regular particles stuck to ships when they hit a ship. So e.g for making snow stick to stuff.

Backdrop

Instead of using "snowy", you can now use "variant", to specify a visual variant. The default is "normal". Entries with "snowy" set to true have their variant set to "snow".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment