Astraeus Player's Guide

Dynamic Units

DYNAMIC UNITS

The Design Method


  • When a unit is first built, the design method is called which sets the unit's attributes.

  • You can modify this based on the game conditions, so that units won't always use the same weapons


public void design()

{

setFrame(Frame.MEDIUM);

setStyle(Style.WEDGE);

// This unit will use a different weapon against fast teams and slow teams

if(getPlayer().getAverageEnemyMaxSpeed() > 40)
{

addWeapon(new MachineGun(this));

addWeapon(new MachineGun(this));

}

else

{

addWeapon(new Megacannon(this));

}


// You can write code that keeps adding something until there is no space left.

while(hasComponentSlotsOpen())

{

addUpgrade(new Plating(this));

}

}

Things To Watch Out For...


  • If you have conditionals, make sure you're not leaving component slots open

  • When you exceed max slots, an error is printed to the console. In game, it simply isn't added.

  • Frame can be dynamic too, but it must be set before adding any weapons or upgrades

  • Any units created on the first frame won't have information about your enemy.

    • Consider delaying unit production over time if you want to make sure every unit is tailored to your opponent's build

You can even make the same unit have two different frames. In this example, Ares' Phalanx changes from Medium to Heavy based on what the opponent builds.

Example #1: Countering Light Units

Example #2: Against Medium or Heavy Units

UNIT ROLES vs. UNIT EQUIPMENT

Define Units By Role, Not Equipment


  • You'll want to have a lot of different units, but there's a point where it will get very confusing to manage in your Player class. Making each unit more flexible provides the best of both worlds. Your Player defines the type of unit to produce, then the unit chooses the best gear for the job.

  • Remember units aren't just defined by equipment but by the code your write to determine their behavior

  • Define units by a role, archetype, or behavior. Not their damage type!


Example Unit Roles


  • Tank - A unit with lots of defense who tries to take hits for more fragile teammates.

    • Uses slowing or pulling weapons like the Energy Siphon, Mass Driver or Pullbeam.

  • Gunship - A balanced unit that fights in mid range with a mix of damage and defense.

    • Uses balanced weapons like the Large Laser, Autocannon, or Long Range Missile.

  • Sniper - Long range attacks with little defense.

    • Uses long range weapons like the Brightlance or Railgun.

  • Artillery - Damages units that are clumped up in an area with explosives

    • Uses explosives like Antimatter Missile or Cataclysm Rocket to attack enemies in a large radius.

  • Skirmishers- A fast moving ship with a light frame. Uses speed to hunt down vulnerable enemies.

    • Favors Small Laser, Machine Gun, or Short Range Missiles.

    • Might use a Shield for defense or rely on SpeedBoost to keep moving.

  • Healer - A unit that heals your other units. Avoids direct combat!

    • Favors Shield Battery or Repair Beam

In this image you'll see two types of Units that Dionysus controls - the Centaur (Tank) and the Satyr (Damage).


Both can change out their gear, but has code to make them perform their specific role regardless of the exact weapon.

In this example, the Centaur identified the opponent was mostly small units with shields.

In this example, the Centaur identified the opponent had a lot of structure and range.