Space War starting in Episode 55 of cleancoders.com
Branch: master
Clone or download
Pull request Compare This branch is even with unclebob:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources/public
src/spacewar
test/spacewar
.gitignore
README.md
project.clj

README.md

Space War

A Star Trek Game.

The Borg have been defeated; but the federation fleet has been destroyed. The enterprise is the only star ship left in service.

The Klingons in Federation space took a beating as well. But the Borg didn't like the taste of Klingons in the "collective" so they simply left many crippled Klingon ships stranded in Federation space rather than assimilating them.

There are rumors that the Klingon fleet escaped total destruction and that the remaining ships are regrouping in Klingon space in order to form an invasion fleet. If so, it won't be long until they arrive in force.

All Federation shipyards were obliterated. No new ships can be ready in time.

Your mission is to rebuild federation defenses by constructing a network of bases that you can use to supply yourself with antimatter, dilithium, and weapons. Harvest what you can from the crippled Klingons. Then, if the invasion fleet comes -- defeat it.

Sensors

You have three views.

  • Front view, which shows you a pretty picture of stars, but is otherwise useless.

  • STRAT. is the strategic view of the whole galaxy. You can zoom in and out using the slider. You cannot see any weapons in this view; but you can see Klingons, stars, and bases.

  • TACT. This is the tactical view. You can see what is nearby, including all weapons that you or your enemies have fired. You'll also see explosions.

Engines

You have two modes of movement. Warp, and Impulse.

  • The WARP engines move you in a sequence of leaps. Each leap is the same size. The more power you use the faster those leaps are made. Be careful, the energy consumed is not linear. Warp 10 uses a lot more antimatter than Warp 1. And, remember, rapid energy consumption increases the Core Temperature; especially if are low on Dilithium.

  • The Impulse engines are reaction thrust engines. They consume antimatter and can propel you at speeds that are a significant fraction of C. At those speeds space itself has a viscosity. The ship feels a drag that limits the velocity, and will rapidly slow the ship when the engines are turned off.

  • The Heading control turns the ship. Both the Impulse and Warp engines move the ship in the direction it is facing.

Weapons

You have three weapons. Phasers, Torpedos, and Kinetics.

  • Phasers are powerful rays that move quickly and do a lot of damage. However, they are short range and lose effectiveness rapidly with distance. If you want to use them, get close. They are great in a stern chase.

  • Torpedos are slow, but pack a significant punch.

  • Kinetics are just cannon balls moving at relativistic velocity. They do a small amount of damage but are cheap to shoot.

You can fire all of these weapons in a spread if you like. Choose the number of shots and the spread angle with the sliders. Aim by clicking on the screen where you want the center of your spread to hit, and remember to lead your target.

Be careful, you can use your torpedoes up fast; and shooting phasers really heats up the core.

All weapons consume antimatter.

Weapons are not very accurate when fired from within a warp field.

Status

There are four things you need to watch at all times.

  • Antimatter is your fuel. If you run out, you'll be stranded. Don't run out.

  • Dilithium is the catalyst for the antimatter reaction. It gets gradually consumed by all operations. When you start running low you'll notice your core temperature increasing. This is because the antimatter reaction becomes less efficient.

  • Core Temperature needs to stay out of the red. Get too hot and you blow.

  • Shields. Shields absorb the energy of hits against you. They automatically replenish by consuming antimatter. You will start to experience real damage if the shields get below 50%.

Damage

There are six damage indicators. LIF, HUL, SEN, WPN, WRP, IMP. These indicators have four states. Green, Yellow, Red, and Black. As you might imagine, black is bad. It means the system is entirely non-functional.

  • LIF - Life support systems. The more damaged this system is, the slower repair operations are performed. If it goes black, you die. Don't let it go black.

  • HUL - This is the hull. It is the first thing repaired after LIF. If the HUL goes black, you die. Don't let it go black.

  • SEN - These are the sensors. As they degrade, you'll know it. If it goes black, you'll be blind.

  • WPN - These are your weapons. As they degrade the weapons will misfire and misbehave. Be careful!

  • IMP - Your impulse engines. As they degrade, you'll note a pronounced tendency for the ship to stall.

  • WRP - Your warp engines. As they degrade you'll notice the warp leaps become erratic.

As long as LIF is not black, these systems will be gradually repaired. So it is often a good idea to warp away from a bad situation and wait the repairs out.

Docking

To replenish your antimatter, and weapons, you'll need to dock at a base. You do this by warping close and then using your impulse engines to approach the base as closely as you can. Put the ship on top of the base. Watch for the DOCK button to show up in the Engine Control Panel. Hit that button and you'll be refueled and restocked.

Bases

There are three kinds of bases. Antimatter factories, Dilithium factories, and Weapon factories.

  • Antimatter factories manufacture antimatter using the power from nearby O, B, or A class stars (the big blue or white ones).
  • Dilithium factories harvest dilithium from the atmospheres of nearby K or M class stars. (the little red or orange ones.)
  • Weapon factories manufacture Kinetics and Torpedos. They require the elements found around the planets of F or G class stars (The medium sized yellow stars like our Sun).

You can deploy a base by gradually approaching the appropriate kind of star. When you are in deployment range, the appropriate deploy button will appear in the Deploy panel.

Deploying a base uses up a lot of antimatter and dilithium; so be careful.

Bases do not start making products right away, there is a startup time. During that time you will see the base partially obscured. Afterwards the bases start slowly manufacturing products.

Transport routes

On the strategic display you will find green lines that connect some of the bases. Cargo transport vessels follow these routes to supply the bases with the resources they need. Yellow transports carry dilithium. Orange transports carry antimatter. They travel at just over Warp 1.

Factories prefer to transport goods along short routes. Be careful how you lay them out. It is possible to deprive bases of resources by connecting them by long routes to bases that have short routes to other bases.

Production

Weapon bases use antimatter to create kinetics. This production is quite rapid. Torpedoes require substantial amounts of both antimatter and dilithium to create. Make sure you have the weapon factories connected, either directly, or indirectly, to antimatter and dilithium factories. Take care, a weapon factory can consume large amounts of dilithium.

Dilithium factories require small amounts of antimatter to produce dilithium. Dilithium production is slow, so you will likely need many of these factories.

Klingons

Some of the crippled Klingons are still pretty strong. Be careful. Others are so weakened that they'll run from you and won't put up much of a fight. They can't detect you at long range; but they can detect bases. So once you place a base down, you can expect visitors. Perhaps lots of visitors.

Blockades

Eventually, unless you stop them, the Klingons will invade your bases and take them over. Blockaded bases will not ship any materials to other bases. Materials manufactured by, or shipped to a blockaded base will be acquired by the occupying Klingons.

Beware, more than one Klingon can occupy a base. If you challenge a base with three or four Klingons occupying it; be prepared for a pitched battle.

Klingon Battle Strategy

Once your ship is in range of a Klingon's detectors, it will head towards you to do battle.
The Klingon strategy is to confuse and delude you. They accomplish this by continuously changing tactics. Stay alert to their movements in the heat of battle; and don't let them get too close. At short range their phasers are devastating.

When a Klingon is critically low on resources, there is a good chance it will run away. This is a good time to attack them. Be careful though, the retreat may be a ruse.

Dilithium Clouds

When you destroy a Klingon vessel, their on-board dilithium will disperse amidst the cloud of debris. You can harvest this dilithium by easing yourself as close as possible into the center of the cloud. Dilithium, when exposed to the vacuum, has a half-life of about a minute. So hurry.

Romulans

Romulans are marauders. Their ships are cloaked and quite difficult to detect. They are quite deadly, due to an omni-directional energy weapon that does tremendous damage and moves at roughly Warp 7. Fortunately they cannot remain cloaked while energizing or firing their weapon. During that very brief period they are quite vulnerable. A single shot will kill them.

A hit at short range from their weapon will completely drain your shields, do significant damage to your systems, and has a one in three chance of killing you outright. When they appear, you have two options: Fight, or run. If you choose to fight, make sure you hit them before they fire their weapon. If you choose to run, run fast and far; the weapon loses potency with distance.

Saving and Pausing

The game is saved every five seconds. You pause the game by quitting. Your previous game will resume when you start the program up again. If you lose the game, then the next time you start up you'll be in a new universe, starting over.

On the desktop, the game is saved in a file named: spacewar.world. You can delete this file if you want to start a new game. You can rename this file if you want to set the current game aside and start a new one. You bring a set-aside game back by renaming it to spacewar.world.