100 Experience Points
An Adventure in Indie Game Development

Ship Building Q&A

Windwalker asked a whole pile of questions in the comments to yesterday’s post, and I think they’re interesting enough to discuss in a full blog post. So here it is.

This is essentially a piece straight out of my design document, for your viewing pleasure.

Will I be able to make any kind of shape as the basic hull? Or are we going to choose from some existing hull models?

Great question that I can’t definitively answer right now. Once I’ve got a working prototype, and as the game development progresses, I’m really hoping that I get feedback from people about what they’d be most interested in.

The shipyard, where you design your ships, is loosely based on the Spore Creature Creator. In that, you can make your creature’s body virtually any size and shape, but does so in a way that it always looks nice. At the present time, I’m not seeing an intelligent way to build that for ships.

A couple of things worth thinking about here… I don’t really have that much time to build this game. I probably need to stick with techniques and tools that I know I can accomplish, rather than spending my time researching ways to procedurally generate ship hulls.

Two, I don’t necessarily want to shove too much of the burden off to the player. It shouldn’t be their job to build ship hulls that look nice.

So the way I imagine it right now, it would be a little more like Legos. Especially the more recent sets where you get big pieces that already have a lot of shape to it, rather than assembling the shape from lots and lots of smaller pieces.

So not any and every shape, but it’s not just limited to a small set of hulls. You’ll be able to piece things together in whatever way you like.

How do you save the crafted ship into a functional 3D entity in the code so that player can spawn it?

You can’t yet.

To answer the question of how does a ship go from the design stage to being deployed in combat, I need to answer a more fundamental question first: Are you using the shipyard to build individual ships, or to design ship classes? That is, are you bringing the HMS Beagle in to the shipyard and actually ripping guns off of it to replace with more powerful engines, or are you designing Nimitz-class carriers, which you can then stick multiple of in your fleet?

On one hand, I like the idea of having a stockpile of designs that you can pull out whenever, and build a new one when you want one/many in your fleet.

But on the other hand, one of my goals is that you feel invested in your fleet. I think you’ll feel more invested in a ship if it isn’t “just another Imperial Class Star Destroyer”. Rather, if you’ve got the Iron Fist and the Grey Wolf, which are both similar, but that you work on, and modify separate from each other.

And perhaps there’s room for both. Can you design ship classes, but then customize individual ships? Can you build a specific ship, but then clone it? Can you set aside a ship in some sort of dry dock, where it isn’t considered a part of your fleet, but you can pull it back out between campaigns (like you would, a ship design/blueprint)? I’d just hate to (a) have to implement both types of ship building, and (b) make the game more complicated than it needs to be. So I don’t really know yet.

Oh. Perhaps you were just asking what the code for saving a ship is like, and how they get loaded into an actual battle…. Who knows. Right now my priority is getting something put together that will show what it feels like to build/design ships. I’ll worry about the details of saving/loading/managing ships later. I’m less worried about the technical aspects of reading and writing files than I am about how the player is going to actually construct these beasts.

The turrets and other modifications will have to work on their own, so the ship class will have to be a class of some intricate design. how will it come together? I can’t wait to see your class diagrams!

Yes, the data structure that I’m building to represent ships is fairly complicated, and it’s loosely based on the mesh and bone structure that is common in 3D modeling. Basically, you’ll have a root element. This is the central piece of the hull. The player may not necessarily see a particular chunk of the hull as the “root” element, but from a programming standpoint, it’s there. This would be the equivalent of the human backbone.

From there, you could attach other hull pieces. These pieces would be attached to a parent “bone” (starting at the root element/backbone) at a particular location, and with a particular orientation. You’d be able to customize the location as well as the rotation to some degree, to make your ship look like you want. You’d also be able to scale the individual pieces, which would affect it’s visual size and it’s mass, as you’d expect, based on the Principle of Immediate Recognition.

More hull pieces can be attached to these pieces. Like how your femur in your upper leg connects to your pelvis, which connects to your spine. (Isn’t there a song about this?) Now here’s where things get interesting. (And mathematically complex. Time to become a transformation matrix ninja.) When you move one bone, say the thigh bone, everything attached to it downstream moves along with it. The tibia, the fibula, the cuboid, metatarsals, the whole bit. Along the same lines, when I have a hull piece and slide it back further along the ship, all of the guns attached to it need to slide as well.

And of course, things get even more interesting when you consider that a turret is it’s own little system of bones, with a base that stays put, relative to it’s spot on the ship, a turret that can rotate around one axis, and the gun barrel that can rotate along another one. Ultimately, the gun will need to rotate to face it’s target, and getting all of the transformations correct to get everything facing the way it should is going to be one of the biggest technical challenges of this game. But I like game math, so bring it on.

You said, “I can’t wait to see your class diagrams!” But there probably won’t be any. I’m using scrum, which is agile, which means you don’t design, just write code!

Wait… no… I’m being told that’s not what it means.

But it does mean design is done in a different way. I’ve got a high level design written out (in wiki form). Design is done through sketches, and notes on a whiteboard, and UML-like class diagrams is fairly limited. The focus is on a working product, not design artifacts. UML isn’t a deliverable.

So if there are class diagrams, it will probably be generated from the code, after the fact.

But knowing that this is one of those areas that I think people will be curious about, because it causes most of the game’s programmatic complexity, I plan on revealing the details of it somehow. I just don’t know how yet. So ask this question again in a month or two or three.

And how will you handle computer AI to make it’s own ships?

Once again, this is another great question that I don’t have an answer to yet. 100 days is a really aggressive time frame. I don’t know what I’ll be able to do, as far as AI goes. In a perfect world, the computer would be able to build interesting ships. In fact, in a perfect world, it would be able to learn from its last encounter with you to make changes to fix it’s own weaknesses while exploiting yours, like another human would do. This actually is not an impossible task. But more importantly, the AI will need to be able to handle combat in a fun and interesting way, so ship design may not be the place to invest my AI time on.

A step back from this would be that I (or some other human) design the ships that the AI uses, and not have the AI build its own. Less cool, I know. We’ll have to see how much time there is.

Of course, depending on timing, maybe there won’t be an AI. Maybe it will just be multi-player, and you always play against another human. Then there’s no AI at all. (I don’t know whether AI or managing networked game state is going to be tougher to implement.)

We really need to just wait and see how things go, and how much time is left for different things. Combined with feedback from potential players.

And here’s the other thing: version 1.0 doesn’t have to contain everything. I just needs to be a fun and interesting game. If it’s successful, there will be time (and maybe even money) for updates, expansions, and sequels.




21 February 2013 at 06:53 am

Wooot! I feel encouraged to ask even more, but I feel you will need every little bit of time to develop things, so I will try to restrain the questioning beast inside me. Sometimes I feel like I have been bitten by a radioactive question mark…

RB Whitaker

21 February 2013 at 06:58 am

You definitely should ask questions if you have them. If I don’t have time, I won’t take the time to answer them. Besides, sometimes, questions like this help me to flesh out the ideas for my game myself. Being forced to write about it means I need to formalize it in actual words, instead of thoughts in my head. While I’ve got a wiki that contains my documentation, it’s far from complete. So by all means, ask away!