Space Battle Arena

A Programming Game in Java for AP CS Students.

Download Client Jar Java Docs Download Server (Windows) View on GitHub

Introduction and Connections

Use the first couple of days of class to get students ramped up with the system. The goal of this section is to get students familiar with the system and setup to have a ship successfully connect to the server and have it execute a command.

Objective

Make sure each student can successfully register a ship and appear on the server before continuing.

Suggested Configuration

It is a useful first exercise for the teacher to understand a little bit about how Space Battle configuration works. To do so, you can simply modify the machine_fullscreen.cfg file included with the server to add additional sections to increase the number of objects in the world:

[Asteroid]
number = 8

[Planet]
number = 3

[BlackHole]
number = 1

[Nebula]
number = 2

This helps create a greater visual impact when first introducing students to Space Battle. This can then be used on the command-line:

SBA_Serv machine_fullscreen.cfg

Resources

Classroom Notes

First, get students to start the IDE and add the jars to their classpath (see Client Setup Instruction supplemental document for more info).

Then introduce the BasicSpaceship abstract class and have students implement the registerShip method and the getNextCommand method (return an IdleCommand at first).

After most students have connected, introduce the RotateCommand and start talking about the dynamics of how the system calls the ship responds with a command for the server to execute.

Commands Used

IdleCommand, RotateCommand

API Used

BasicSpaceship, TextClient