This module has been shamelessly ripped off from Sam Streeper's SpaxeWar module. Due to the brilliantly modular way he wrote it (and the power of NeXTSTEP!), it was easy for me to add computer players. Otherwise, the game is the same. The object of the game is to annihilate your opponent before he gets you. In XoxWar (as oppposed to SpaxeWar), the opponent may be a computer instead of another human! The popup lists select the type of computer player. "Commander" means no computer player - the human is in complete control. "CrazyMander" involves random movement "TrackMander" attempts to match velocity then fire on you. In addition, the difficulty switch controls how often the computer player can move, and hence how hard it is to fight him. Other than that, the computer players are "fair" - they are not stronger or weaker than the human players. You can set zero, one, or two computer players. The human controls are always accepted, although they may be overriden by the computer. You can of course choose to play either side: The blue player's controls are: z - rotate left x - rotate right (comma) - thrust (period) - fire (space) - shields The red player's controls (on the keypad) are: 1 - rotate left 2 - rotate right 6 - thrust 9 - fire (enter) - shields
XoxWars extends SpaxeWars in several key ways. It maintains virtually all the old SpaxeWars code, except for eliding items like meteors that are not used. All the names are changed from 'SWxxx' to 'XWxxx' to avoid collisions. The modifications are entirely to the XoxWars.m method, except for some convenience methods for alliance information. There are also several new classes: Tracker and the Commander classes. The scenario class XoxWars now has: 1. A list of the computer player "classes", as well as a list of the commanders in play. 2. A "oneStep" method, so Xox will periodically call it to move the computer players. 3. Methods for initalizing and responding to the "player" PopUpLists. The generic "Commander" class has the basic methods for being "oneStep"ed and owning a Ship, and being assigned "Targets", but no actual order-giving ability. The idea was to make it general enough to allow one commander to move several ships against several targets. CrazyMander simply implements a random choice of actions, between turning, thrusting, or firing. These actions have the same affect as keystroke from a human player. TrackMander makes use of the Tracker class to find information about the relative position and velocity of a Target. It even attempts to compensate for the motion of the target. Its strategy is to match velocity, then move in and fire. The Tracker class can order the owning ship to 'track' the Target in various ways. If one implemented playerClasses as a class which could search for bundles, instead of just filling it in XoxWars, it could easily dynamically load new players. Feel free to use and mangle this source code to do new and interesting things, even as I did to SpaxeWars. -- Ernie Prabhakar December 15th, 1994
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.