Pirate Empires: Part 4 - When Push Comes to Shove

Views: Date: Apr 24 2009 07:16:15
KeyWord: Pirate Empires, When Push Comes to Shove
Summary: Yar, tis the next entry in this here diary: The History of the Pirate Empires (game development cycle).

Pirate Empires: Part 4 - When Push Comes to Shove

That's one nasty collision.

Yar, 'tis the next entry in this here diary: 'The History of the Pirate Empires (game development cycle)'. Turning to part four this week reveals an entry from Mod Dunk...

As you know, I've been working on Pirate Empires alongside Mod Wivlaro, who has most recently been putting together the world map that joins up the various battles around the map. To avoid the tedious act of sailing to distant islands, players who leave an island will zoom out to see a map of the whole world. From here you'll be able to quickly travel to places you can trade, pillage, bury treasure and fight. For now, here's a little more about those fights.

As the enemy is closing in fast and your guns can't reload in time to stop them, you expect but one thing: collision. It doesn't bear thinking what would happen to the people on board if the ships were to pass through each other – it'd be gruesome, no doubt. Of course, in the real world, pirates can rest easy thanks to the miracle of physics – in the game world, it's a constant worry. This is where simulation comes in.

To begin with, every physical object needs to store a position, velocity and orientation in 3D space. This information is updated every frame according to rules that we write. We put in rules for gravity, friction, wind, etc, but the most complicated is collision.

In real physics, everything is composed of countless tiny particles that apply forces to their neighbours – resulting in the collisions you see every day. Unfortunately, simulating this level of detail for a ship-sized object would require years of computation on the fastest supercomputer, so to achieve 50 frames per second on a normal computer we have to go with an approximation.

The anchor-brake turn in action, setting up a great shot down the bows of two enemy ships.

To do this, our ships are given invisible outlines that move along with them during the game. Whenever a cannonball crosses one of these lines, we know we have a hit. Likewise, whenever a line from one ship crosses a line from another ship, we have a collision. Now we know the ships have collided, we can move them away from each other and apply some forces (changing our values for the position, velocity and orientation of both ships).

With the right forces, the ships should look as if they're crashing into each other with a believable reaction. Although cannon fire, collisions and boarding are all important parts of a pirate's day, the smart ones know they'll need to do something special to gain the upper hand in battle.

The screenshots show new icons on the left that represent some of the orders you might be able to use in the final game. My favourite orders involve using the anchor. It's not just an essential tool for parking a ship on the coast; daring captains can use it to perform the infamous anchor-brake turn (with the help of a little spring physics simulation).

Mod Dunk
FunOrb Developer
(Favourite pirate movie: Arrrmageddon)

Why did the pirate think there was something wrong with the triangle? Because it wasn't ship-shape.

send to friend print top

Player Comments