Skip to content

v0.1.5 "Formations"

Pre-release
Pre-release
Compare
Choose a tag to compare
@cdsupina cdsupina released this 15 Apr 15:10
· 80 commits to master since this release

Focus

The focus of this release was to organize how Spawnables are spawned into the level. Previously, levels only contained a phase of randomly spawning enemies and a boss. In the Formations update there are four types of phases that can be used to construct a level:

  • InvasionRandom
  • InvasionFormation
  • Rest
  • Boss

The InvasionRandom phase takes in an InvasionRandomPool parameter and spawns Spawnables from that pool at random. Below is an example of an InvasionRandomPool called Level1Easy defined in spawner.ron.

Level1Easy: [
            (
                spawnable_type: Some(Mob(Enemy(Drone))),
                weight: 1.0,
                period: 1.5,
            ),
            (
                spawnable_type: Some(Mob(Enemy(Pawn))),
                weight: 0.9,
                period: 2.0,
            ),
            (
                spawnable_type: Some(Consumable(Money1)),
                weight: 0.2,
                period: 0.3,
            ),
            (
                spawnable_type: None,
                weight: 0.5,
                period: 0.3,
            )
        ],

The spawnable_type property is the type of spawnable in the pool. The weight property is how likely the Spawnable should spawn relative to other Spawnables. The period property is how long the spawner will wait before spawning something else.

Similarly, the InvasionFormation phase takes in an InvasionFormationPool parameter and spawns a vector of Spawnables with positions from that pool at random. Below is an example of an InvasionFormationPool called Level1Easy defined in spawner.ron.

Level1Easy: [
            (
                formation_spawnables: [
                    (
                        spawnable_type: Mob(Enemy(Drone)),
                        position: [150, 310],
                    ),
                    (
                        spawnable_type: Mob(Enemy(Drone)),
                        position: [180, 300],
                    ),
                    (
                        spawnable_type: Mob(Enemy(Drone)),
                        position: [210, 310],
                    ),
                    (
                        spawnable_type: Mob(Enemy(Pawn)),
                        position: [100, 390],
                    ),
                    (
                        spawnable_type: Mob(Enemy(Pawn)),
                        position: [260, 390],
                    ),
                ],
                weight: 1.5,
                period: 10.0,
            ),
            (
                formation_spawnables: [
                    (
                        spawnable_type: Mob(Enemy(Pawn)),
                        position: [110, 390],
                    ),
                    (
                        spawnable_type: Mob(Enemy(Drone)),
                        position: [150, 370],
                    ),
                    (
                        spawnable_type: Mob(Enemy(MissileLauncher)),
                        position: [180, 300],
                    ),
                    (
                        spawnable_type: Mob(Enemy(Drone)),
                        position: [210, 370],
                    ),
                    (
                        spawnable_type: Mob(Enemy(Pawn)),
                        position: [250, 390],
                    ),
                ],
                weight: 0.8,
                period: 12.0,
            ),
            (
                formation_spawnables: [
                    (
                        spawnable_type: Mob(Enemy(StraferRight)),
                        position: [180, 300],
                    ),
                    (
                        spawnable_type: Mob(Enemy(StraferLeft)),
                        position: [180, 320],
                    ),
                    (
                        spawnable_type: Mob(Enemy(StraferRight)),
                        position: [170, 340],
                    ),
                    (
                        spawnable_type: Mob(Enemy(StraferLeft)),
                        position: [190, 360],
                    ),
                    (
                        spawnable_type: Mob(Enemy(StraferRight)),
                        position: [160, 380],
                    ),
                    (
                        spawnable_type: Mob(Enemy(StraferLeft)),
                        position: [200, 400],
                    ),
                ],
                weight: 1.0,
                period: 8.0,
            )
        ],  

The formation_spawnables property is a vector of spawnable_types paired with an x y coordinate position. When a formation is spawned, each spawnable in this vector is spawned at the same time at its position, creating a formation. Formations also have a weight and period that works the same as in the InvasionRandomPool.

The release makes adding a formation by far the most straightforward contribution a contributor can make to the game.

Change List

  • New InvasionFormationPhase
  • InvasionRandomPhase updated to use periods and weights
  • Minor refactors of the PhaseManager
  • Add spawner pools defined in spawner.ron
  • Strafer enemy divided into variants: StraferLeft and StraferRight
  • Add parent SpawnableType for enemies and allies called Mob
  • Data ron files now included in the binary
  • Config files now generate at runtime