Monday, September 19, 2011

Starship Builder - New Art (again)

My previous attempt at creating a new art style for Starship Builder was such a failure that I figured I'd try again! I'm not thrilled with the result, but I do think it's better than the original, and much better than that previous attempt.

Here's what it looks like:

Future Walt thinks that those sickly green people are really ugly.

Download this latest version for PC and Mac.

Thursday, September 15, 2011

Starship Builder - Multi-Ship!

The past few days I've been working on a big new feature that I've been wanting to add for quite a while: multiple ships! That is, each player can now control up to four ships. I think supporting multiple ships per player is important because 1-vs-1 ship combat, while fun to watch, can be a bit dull and non-interactive to actually play. By allowing multiple ships, I'm opening up more tactical possibilities, such as flanking and maximizing the strengths and weaknesses of different ship designs.

Once in the simulator, you can add a friendly or enemy ship by pressing either the "Spawn Friendly" or "Spawn Enemy" buttons. Once you have more than one ship, simply click on a ship to select and control that ship. The rest of the game works just the same.

Download for PC and Mac.

Here's a full list of the latest changes:

  • Added support for up to 4 ships per player.
  • Ships are now more intelligent about how they fly to a location: they will fly directly to the location at the maximum speed and then will rotate into final position once arrived.
  • Bullets now fly through space twice as fast.
  • Big performance improvement to physics calculations.

Monday, September 12, 2011

Starship Builder - Automated Crew

Before I talk about the latest new features of Starship Builder, I want to mention that I decided to dump the new art style that I tried in my previous post. While much cleaner and more "slick"-looking than my original uber-crappy programmer art, the new style just didn't *feel* right for a game based on a detailed starship simulation. Also, it reminded me too much of the art style of Captain Forever.


In recent versions, it was possible to directly control the crew of your ship, explicitly assigning them to various stations. This proved to be too hard to manage, especially as ships were constantly moving about and rotating -- it was too hard to select the desired crew and tell them where to go.

So in this latest version, you no longer have any control over the crew on your ship, who are now completely automated. The crew will now by themselves seek out jobs to perform -- you don't have to worry about that. Different jobs have different priorities so that, for example, the person manning the Cockpit will never leave his job to man a cannon. Eventually you may have a way to adjust the priority of what jobs the crew is performing -- say, manning weapons versus repairing systems -- but this feature is not implemented yet.

However, you do have control over which systems are activated and which are not. By default all systems are active, but if you select one or more systems and press the C key, then any crew manning those systems will automatically leave and find other jobs to perform. Press the C key again to re-active the selected systems.

Download for PC and Mac.

Here's a full list of changes:

  • Player no longer has control over crew. Crew is now completely automated.
  • Select systems and press C to toggle them on and off. Deactivated systems use no crew.
  • To move the ship, press M and click the destination.
  • Can double-click a system to select similar systems.

Saturday, July 30, 2011

Starship Builder - New Art?

Wow, it's been almost 3 months since I posted anything about Starship Builder! Mostly I've just been taking a break from the project.

I would like to share with you a new art style that I'm experimenting with. I'm not sure if I like it yet, but figured I'd share it to get feedback. (Click the thumbnail to view full size.)

Future Walt says: It sucks.

This build also has a few other changes:

  • Removed the concept of ship control "modes".
  • Double-left-click to move the ship to a location.
  • Left-click and drag to select weapons.
  • Hold C while left-clicking and dragging to select people.
  • Removed Repair Bays and Small Cannons.

Download this build for PC and Mac.

Wednesday, May 4, 2011

Starship Builder - UI Revamp & More

I've spent the past couple weeks making a lot of little improvements to Starship Builder. Most importantly, the game's user interface has been totally revamped to be a lot cleaner and more self-explanatory. Here's a full list of improvements:

  • Added repair bays. Crew stationed at repair bays will automatically seek out systems needing repair.
  • Lots of user interface improvements, including tooltips for just about everything.
  • Movement is now back to using the left mouse button. Future Walt wonders why he kept changing this.
  • Can right-click to target all weapons while in movement mode.
  • New thruster particle effects.
  • You can pick what team you want to play on in multiplayer.
  • Can now play with up to 8 players. (But only 4 teams are supported.)
  • Added an observer mode to multiplayer.
  • New blue-ish background image.
  • Lots of bug fixes, performance improvements, and tweaks.

A screenshot showing off the new Builder user interface:

And another showing the new background:

Download this build for PC and Mac.

Monday, April 18, 2011

Starship Builder - Ion Beams and Substructure

Another week, another round of improvements to Starship Builder! There are two significant new features in this week's build...

The most fun of the new features is a new type of weapon, the Ion Cannon! Ion Cannons are large, powerful energy weapons that deal great damage over time. Their disadvantage is that they consume very large amounts of ammunition and also can only fire directly forward. This means that it is much more difficult to target specific systems on an enemy ship, and they also may be less useful when built on larger, less maneuverable ships.

The other big new feature is less fun, but arguably more important: Substructure. I've done a number of playtests since adding multiplayer, and the biggest imbalance issue was that ships would break apart into multiple pieces too quickly. My solution to this was to add a layer of "substructure" underneath the existing systems. When a system is destroyed, it reveals the substructure underneath. The substructure itself can also be destroyed, but doing so takes longer, and the ship will not break apart until the substructure is destroyed. In this way, the substructure acts as a kind of glue, holding the ship together even under considerable damage. I'm still working out the exact balance between substructure and regular systems, but it seems to basically solve the problem.

Here's a screenshot showing both the new Ion Cannons and the exposed substructure. Click on the image to get a better view of the substructure.

Download this latest build for PC and Mac.

Sunday, April 10, 2011

Starship Builder - Multiplayer!

I've spent the past few weeks doing a massive overhaul of Starship Builder's code to support networked multiplayer. It's been a very long process, requiring a lot of code to be rewritten. But thankfully, and finally, everything seems to be working pretty much okay. Here's a glorious screenshot of two ships in the heat of combat, each belonging to a different player:

Download this latest build for PC and Mac.

Here's a more complete changelist:
  • Added basic network multiplayer.
  • Can specifically target a part of the enemy by right-clicking on that part.
  • Added armor pieces that do nothing but provide lots of protection.
  • Press F to make the camera follow your ship.
  • A black hole is now spawned after 3 minutes. It's not very powerful, but will suck in stray debris. Whatever you do, don't touch the black hole!
  • A massive asteroid swarm now spawns after 5 minutes. Good look surviving it!
  • Ships now maintain some amount of thruster stability even as many thrusters are destroyed.
  • Added a basic minimap.
  • Added small and big cannons.
  • A single enemy ship can now be spawned in the simulator.
  • Added a new mode that allows you to directly control your ship using the WASDQE keys.

If you want to play multiplayer yourself, here's some basic instructions for setting up a match:
  1. On one computer, start the game and click the "Multiplayer" button once the game is loaded.
  2. Select the ship you want to play.
  3. Type a game name where it says "Host a game".
  4. Click "Create".
  5. On another computer, follow steps 1-2.
  6. Click the button matching the game's name under "Connect to".
  7. Repeat steps 5-6 for up to 2 additional computers. (Total of 4 max players.)
  8. On the first computer, click "Start!".
  9. Have fun!

Friday, March 18, 2011

Starship Builder - UI Modes

This is a somewhat experimental release of Starship Builder, focused primarily on trying out different levels of control that players have over ships, systems on ships, and people in ships.

Here's a rundown of what's changed:

  • Added two separate "modes":
    • Combat: Allows you to select and give targets to specific weapons. Left-click and drag to draw a box around and select the weapons. Right-click on a target to focus-fire on that target.
    • People: Allows you to select and give orders to specific people. Left-click and draw a box around the people to select them. Right click on a system order some of the selected crew to operate that system. Hold U to select only those crew without any orders.
  • Ship movement (when in "Movement" mode) is back to right-click.
  • Crew can now be ordered to operate specific systems such as weapons, thrusters, ammo supplies, and cockpits.
  • Crew's Quarters have been removed. All parts requiring crew now automatically start with their required crew. Crew can also be added and removed manually in the Builder. Hold P when placing a part to not create the default number of crew for that part.
  • Crew must be assigned to specific Ammo Supplies. Those crew will then supply ammo to nearby weapons.
Here's a screenshot of the player selecting a handful of cannons:

And here's a screenshot of the player selecting a handful of people: (If you look closely, you can also see lines indicating the paths that the people are travelling.)

Here are download links for PC and Mac versions of this build.

I'm unsure yet whether the player should have this level of detailed control over ships, and I'm especially not sure about whether the individual crew members should be directly controllable or whether they should be completely automated. The direct control of crew in this build seems unnecessarily tedious, so I think I'm leaning towards totally automatic for the future.

Tuesday, March 1, 2011

Starship Builder - Crew Congestion & More

It's been a couple weeks since I last posted about Starship Builder, mostly because my progress since then has been lots of little improvements and not many big new features. But all those new improvements have added up, and I also have working on a significant new mechanic that I'd like to talk about, especially with regard to how it's programmed.

Here's a rough list of what's changed since the last post:

  • Added crew congestion mechanic. (See below.)
  • Replaced that ugly purple grid with a much nicer space background. A simple grid is overlayed on top of the background.
  • Bullets fired from cannons now inherit the ship's velocity. (This is more physically realistic.)
  • Tons of bug fixes and performance improvements.

Feel free to download the latest PC and Mac builds.

The significant new mechanic I mentioned above is "crew congestion". Essentially how it works is that, whenever two people are passing through each other in opposite directions, they will slow each other down. This is to emulate tight corridors where two people have to squeeze past each other to get by. But the people are smart, and they will try to avoid other people going in the opposite direction by taking a different route if they can. The result is that creating double-wide corridors or alternative paths can significantly increase the efficiency of your crew.

In the previous version of Starship Builder, a single person wanting to travel from point A to point B used a basic A* pathfinding algorithm to determine the shortest path from A to B, taking into account only the distance between points and travel speed (the rate at which the person can move through different parts of the ship, such as corridors vs thrusters).

In this new version, the A* algorithm is still used for pathfinding, but it also takes into account an estimated "congestion level" for each grid location. A grid location's congestion level is used to reduce the assumed speed at which the person can travel through that location. If the assumed speed is low enough, then the A* algorithm will naturally attempt to route around that location.

The way that congestion is estimated for grid locations is inspired by the way that ant colonies lay down scents to mark paths leading to food. After an ant finds a source of food, the ant will return to the colony, laying down a weak pheromone trail on its way back to the colony. This trail is a small suggestion for other ants to follow. Most ants won't follow, since the trail is very weak, but a few will, and when they find the food, they'll return, laying down more pheromone over top of the trail. As more and more pheromone is laid down, more and more ants will follow it to the food.

Congestion estimation in Starship Builder is inspired by these ant colonies, but it works in almost the exact opposite way. Whenever a person plans a path from point A to point B, a "virtual pheromone" is instantly applied to the entire path, but instead of persuading fellow crew to follow the path, it actually dissuades fellow crew from following the same path. The more virtual pheromone there is on any given grid location, the slower the "assumed speed" will be when the A* pathfinding algorithm runs. So the more people that travel along any given path, the more likely it will be for others to try to take a different path.

Tuesday, February 15, 2011

Starship Builder - Crew & Ammo

My biggest accomplishment this week has been to add crew and an "ammunition" mechanic to weapons for my Starship Builder game prototype.

Your ship now needs crew for most systems, such as weapons and thrusters, to be able to operate. Crew can now be added by placing "Crew's Quarters" rooms into your ship. Each Crew's Quarters comes with a set number of crew, who will automatically find systems to operate.

Additionally, your ship's cannons can now only store a limited amount (5) of ammunition. If a cannon runs out of ammunition, then a crewmember must hand-carry a "ammo ball" from a nearby "Ammo Supply" (another new kind of room) to the cannon. (Yes, this is way in the future, but for some reason there are no systems to automate this.) This way you have to think about placing Ammo Supplies near enough to cannons so that they don't run out of ammo in the middle of a fight.

While crew can travel through any part of the ship, they travel much faster through corridors than through any other parts. If you want your ship to operate efficiently, then you'll have to think a lot about planning your corridors to give your crew quick access to the ship's systems.

Changes from the previous version:
  • Added "Crew's Quarters" rooms that each come with 8 people.
  • Added "Ammo Supply" rooms that store an infinite amount of ammo.
  • Ammo must be hand-carried by crew from Ammo Supplies to the cannons.
  • Click on any cannon or thruster to deactivate or re-activate it. (Deactivated systems don't require crew.)
  • Limit of 32 thrusters. Also added "wide" thrusters.
You can download this latest build for PC and Mac.

Monday, February 7, 2011

Starship Builder - Guns & Asteroids

This past week I added cannons and asteroids to my "Starship Builder" game prototype. Cannons are a new piece that can be added to ship designs, and asteroids are targets for the cannons to shoot at.

A ship brimming with cannons:

And the same ship blowing up some asteroids:

You can download PC and Mac builds of this new version and try it out for yourself!

Here are all the big changes from the previous version that I can think of:

  • You can now add cannons to your ship in the builder.
  • In the simulator, press R to spawn an asteroid at the mouse cursor.
  • If an asteroid hits your ship, it will do serious damage!
  • Parts of your ship can be destroyed by asteroids, and your ship can actually break into multiple pieces!
  • Right-click in the simulator to move your ship. (Hold and drag to adjust orienation.)
  • Left-click on an asteroid to target that asteroid specifically. Otherwise your weapons will automatically target nearby asteroids.

Tuesday, February 1, 2011

Starship Builder - Early Designer Interface

In a previous post I talked about an idea I have for a new game. In this game players are able to design their own space ships by placing rooms, weapons, engines, corridors, and other systems onto a grid. Everything in the game is very flexible (you can make ships of any shape, size, and configuration) and dynamic (realistic physics, weapon damage is inflicted to specific components on the grid). You can read a more detailed description in that post.

I've started to implement a very rough prototype of an interface "builder" that allows you, the player, to design your own ship and then test it in a separate "simulator" mode.

Here's what the "builder" looks like right now:

Future Walt asks you to please excuse the really horrendous purple grid background.

And here's the "simulator" showing the ship from above flying through space:

If you want to try it out yourself, here are links to PC and Mac builds.

Some basic instructions:

  1. The first piece you place must be the "Cockpit". You can place it anywhere. (Click on "Cockpit" on the left and then click to place it onto the grid.)
  2. Continue adding corridors and thrusters. These must be placed adjacent to already-placed pieces. Make a ship in whatever shape you want! But keep in mind that the thruster physics are fairly realistic, so if you want your ship to be maneuverable, then make sure to place thrusters spread out in various locations and facing various directions.
  3. Press the < and > buttons to rotate the selected piece before placing it.
  4. Hold the middle mouse button and drag to pan the view. Use the scroll wheel to zoom in and out.
  5. When you want to test your ship, type in a name and press the "Save & Test" button.
  6. Once in the simulator, click the left mouse button to move your ship to a location in space. Hold it and drag to adjust your ship's orientation.

Sunday, January 2, 2011

Starship Builder - Idea & Thruster Algorithm

I have an idea for a game that I've been wanting to make ever since I was a kid. I've actually tried to make it several times as a pen & paper tabletop game, but it's just too complex of an idea for pen & paper. It's only recently that I've become a good enough programmer to tackle the idea as a computer game, and so I've been thinking more about it lately.

The core idea of the game is that the player designs and builds a space ship on a 2D grid. Think SimCity, but instead of placing buildings and roads onto a grid, you're placing corridors, weapons, engines, crew's quarters, and other ship systems onto the grid. Unlike many games, which only let you place systems onto pre-assigned "hardpoints" of the ship's hull, my game will allow the player to completely customize the ship's size, shape, and the location of internal systems.

Where you place engines, weapons, and other systems on your ship will really matter. Engine physics will be accurate, so that you have to actually think about exactly where the best place to put that thruster will be. Weapon damage will be localized, so that weapon fire from an enemy ship will strike a particular part of a ship and damage whatever systems are there. You'll have to think about what systems you want to put near the outside of your ship, and what systems you'll want to protect deeper inside.

Inside the ship will be dozens, possibly hundreds of crew members scurrying about from one system to another, keeping everything operational. You'll have to think about the corridor layout inside your ship so that your crew can easily travel from one system to another.

The key to this idea is that the player has complete flexibility and customization when designing ships. The only game I know of that even barely resembles this is Captain Forever. But Captain Forever is a fairly simple arcade game, whereas my game, if I ever make it, will be much more of a tactical strategy and simulation game.

I actually just threw together a very rough prototype to prove to myself that I could solve what I think will be the hardest programming problem to solve: that is, how to make a ship realistically fly to a desired location no matter where the player places the ship's engines and no matter how many and what size they are. Future Walt laughs at his past-self's naiveté. This was far from the hardest problem to solve. You can try out this prototype right here.

The algorithm I came up with actually seems to work pretty well. Sure, it could use a lot of tweaking and some higher-level intelligence, but basically I think it proves that I can make it work within a larger game.

The basic algorithm works like this, assuming you have a number of thrusters that each can be "activated" from between 0.0 and 1.0:
  1. Calculate a desired force to exert on the ship (X, Y, Rotational) based on the desired location and/or velocity.
  2. Build a list of all the thrusters on the ship and sort it by how much more closely a change in the thruster's activation can bring the ship's current force to its desired force.
  3. Iterate through each thruster in that sorted list, setting its activation to the value that brings the ship's current force as close as possible to the desired force.
  4. Repeat steps 2-3 at least a few times so that the thrusters can "approach" and eventually "settle in" to a near-optimal set of activation levels.
This whole algorithm is run once every frame to constantly adjust the thruster's activation levels.