Made to work within Unity, this tool lets you paint grass on any geometry in a way that’s performant enough to run with ease on mobile devices.
It is written in C#, with accompanying shaders written in both HLSL and the Unity Shader Graph.
Made to work within Unity, this tool lets you paint grass on any geometry in a way that’s performant enough to run with ease on mobile devices.
It is written in C#, with accompanying shaders written in both HLSL and the Unity Shader Graph.
Simple water shader written in HLSL. This shader is composed of 4 main layers.
Brace the Swarm creates a new level ‘on-demand’ whenever certain stages are played. The levels are created using an algorithm called Wave Function Collapse, an implementation of the Model Synthesis approach (detailed in this paper). This algorithm uses a map of relational constraints to continually remove available foliage from the nodes of a grid until a level that fulfils all the constraints has been found.
This game uses an alteration called ‘modifying in blocks’, which divides a larger map into smaller subsections to reduce complexity and increase the likelihood of a successful generation.
For pathfinding, Brace the Swarm uses a hybrid approach combining traditional A* pathfinding with a second technique often referred to as vector fields.
A* is an algorithm that will search a grid of nodes for possible paths between 2 points, using a multi-step process of sequentially evaluating the strength of neighbouring spaces on a grid until a path is found. This path is guaranteed to be either the shortest path, or one of multiple shortest paths. I use this for user instantiated movements, as well as long distance enemy movements across larger parts of the playfield.
For shorter unit movements, using A* becomes costlier and produces worse results than other comparable methods. One such method is the use of vector fields. This is the process of ‘pre-baking’ the fastest path between a target and all of its surrounding nodes, then make those paths available in an easily accessible data structure (such as a field in this case).
There are a couple of requirements that must be in place for this to be a better choice for pathfinding than A*.
In Brace the Swarm, the above criteria are met when actors are about one screen distance away.
When a field is generated, it can be freely used as long as no fundamental changes are made to any of the obstacles or targets used by the field (as that would warrant a regeneration). Since this allows our use to be very ‘greedy’ — as we can get updated data for every map tile without performing any new calculations — units can be more accurate and flow more seamlessly.