Astraeus Player's Guide

My First Unit

CUSTOM UNITS

The Basics


  • In Astraeus your team can have as many unit types as you would like, and each unit is defined in its own class.

  • Units are really defined by a few attributes:

    • Frame - Each unit is either LIGHT, MEDIUM, HEAVY, or ASSAULT.

    • Style - Each unit can choose one of several images to set its appearance.

    • Weapons - Each unit can have up to two weapons that can be used

    • Upgrades - Each unit has passive upgrades that improve defenses or provide bonuses

    • Behavior - Each unit has unique code in its action method and can behave in its own way


You may also want to explore the Units, Weapons, and Upgrades reference pages.

EXAMPLE: THE TANK CLASS

Getting Started

  • Find your Fighter Unit and make a copy of it in the Unit folder. Let's call this unit TANK.

  • Make sure you modify your team's code rather than copying the code below!


Customizing the Tank

  • The tank is going to get up close to enemies rather than running away

  • It is using more of its slots on defenses than the Fighter class.


public class Fighter extends MyTeamUnit

{

public Fighter(MyTeamPlayer p)

{

super(p);

}

public void design()

{

setFrame(Frame.MEDIUM);

setStyle(Style.WEDGE);

addWeapon(new MachineGun(this));

addWeapon(new SmallLaser(this)); // remove this line

addUpgrade(new Plating(this));

addUpgrade(new Plating(this));

addUpgrade(new Shield(this));

}


public void action()

{

Unit enemy = getNearestEnemy();


if(enemy != null)

{

moveTo(enemy);

getWeaponOne().use(enemy);

}

}

}

Player Class - Building the Tank

  • We decide which units to build in the player's strategy method

  • Add the tank as an option to build. You can certainly change the ratios!


public void strategy()

{

if(getFleetValuePercentage(Gatherer.class) < .2f)

{

buildUnit(new Gatherer(this));

}

else if(getFleetValuePercentage(Miner.class) < .2f)

{

buildUnit(new Miner(this));

}

else if(getFleetValuePercentage(Tank.class) < .2f)

{

buildUnit(new Tank(this));

}

else

{

buildUnit(new Fighter(this));

}

}

Run your code. How does this unit work with the other fighters?

SPECIALIZING UNITS

Some Unit Ideas

  • Snipers have a long range weapon like a Railgun, Brightlance, or Missiles but do not have any defenses. They try to keep their distance and stay behind the tanks.

  • Skirmishers are very quick and try to strike weak opponents like Collectors or Snipers.

  • Support units might only have weapons that assist allies or disable opponents, such as the Repair Beam or Anti Missile System. They have very different behavior from other combat units.