Astraeus Player's Guide

My First Team


Renaming Package and Files

  • All of your code should live inside the package called myTeam.

  • Please rename your package, Player, and Unit classes in Eclipse.

    • Right Click --> Refactor --> Rename

      • Make sure you check the box to rename subpackages

  • Update the file path for your image in MyTeamPlayer to reflect your new package name


The Constructor

The constructor is called before the game begins.

public MyTeamPlayer(int team, Game g)


super(team, g);

// Your team name and image. The image should be in a 4:3 ratio.



// You can set your team colors here as RGB values.

setColorPrimary(150, 150, 150);

setColorSecondary(255, 255, 255);

setColorAccent(255, 255, 255);


Strategy Method

This method is called every frame. It is used to help set your team's strategy and build order.

There are many ways to decide which units to build. The example team simply tries to keep units at a certain ratio to each other. You may also consider...

  • Time passed in the game

  • Your team's relative strength to the opponent

  • The types of components your opponent favors

pulic void strategy()


// In this example our player is ONLY setting a build order
// However, you may want to determine when to attack or defend here too!

// Checks what percentage of the fleet are each type
// This approach scales by unit cost, not absolute numbers.

if(getFleetValuePercentage(Worker.class) < .5f)


buildUnit(new Worker(this));




buildUnit(new Fighter(this));



When you run the program, you'll see Fleet values at the bottom.

  • Value is the total cost of all your units added up

  • Count is the number of units you have total.

Resources are listed twice

  • Store is the number of resources you have available that are unspent

  • Total is the total amount you have collected over the course of the game.

Draw Method

This method is called every frame when it is enabled. It can be toggled in:

  • Settings (found in the engine package)

  • By pressing "q" or "e" during gameplay for the left and right players respectively.

public void draw(Graphics g)


// You can use ANY drawing method you would like in here

// This is very useful for showing what your units are trying to do



Action Method

This method is called every frame. During a unit's action, it can:

  • Turn any direction freely

  • Accelerate (once per action)

  • Use one or more weapons

public void action()


// If you want all your units to perform a default action, add code here
// Reminder: It won't work unless subclasses call super.action() !


Draw Method

This method is called every frame when it is enabled. It can be toggled in:

  • Settings (found in the engine package)

  • By pressing "q' or "e" during gameplay

public void draw(Graphics g)


// You can use ANY drawing method you would like in here

// This is very useful for displaying data and decisions


An Example Method: Skirmish

This is just an example method, it isn't something that is a core part of Astraeus. This teaches all of our unit types to move and attack.

public void skirmish(Weapon w)


// Find the nearest enemy and store it in a local variable

Unit enemy = getNearestEnemy();

// If the enemy actually exists.... (stops us from crashing if we win)

if(enemy != null)

// Use the selected weapon against the nearest enemy


// if I am far away from the enemy, approach it...

if(getDistance(enemy) > getMaxRange())



// Otherwise run away!









  • The design method determines a few factors:

    • The unit's frame, which describes how large it is: LIGHT, MEDIUM, HEAVY, or ASSAULT

    • The unit's style, which shows its cosmetic appearance

    • The unit's weapons and upgrades

public void design()


// This unit costs 6 credits

// Medium Frame (2) Weapons (2) + Upgrades (2)

// For more information, see the units page.



addWeapon(new MachineGun(this));

addWeapon(new SmallLaser(this));

addUpgrade(new Plating(this));

addUpgrade(new Shield(this));



The action method is called every frame and determines what the ship does. In this case it calls the Skirmish() method from the superclass.

public void action()


// This overrides the basic unit action method.
// Call super.action() too if you want to do your general action first.

// Calls the skirmish method for each weapon.




Making Additional Combat Units

This is going to be a lot of your work in the project. Here are a few basic things you can explore:

  • Make a second combat ship with a more specialized different archetype:

    • A tank that has a lot of defense and tries to stay close to the opponent

    • A sniper that has long range and high damage, but fragile if it gets close

    • A skirmisher that is very quick and tries to avoid damage through dodging and movement.

  • Think about how 2-3 different unit types might work together to be stronger in combat

  • How can the Skirmish method be improved? Do units always want to stay at max range

Basic Worker

Improving Gatherering

  • Watch your worker in action. When it activates the Collector, it will slow down a bit. Is it slowing down too soon? Too late? Is it just right? Is there a way to improve the collect method/

  • Right now your worker completely ignores enemies. Should it run away from threats? If so, what is the trigger? When it takes damage? When an enemy is close? What about the ratio of enemies and allies? Seek a balance of self-preservation but not being too skittish.

Improving Mining

Try watching your worker. If you look carefully, you'll notice that it isn't always mining! It bobs in and out of range. This results in some wasted time. How can you modify the harvest method to be better?