Good morning seafarers! I’ve been pleasantly surprised with the early reaction to the game from people on Twitter and Facebook, it’s really encouraging. So, cheers to you all!

In last week’s post, we created a vast ocean.  This week, I decided to put on my deity hat and populate that ocean with more items from the sea. Since the ocean itself is going to essentially be the ‘overworld‘ part of the game ( the section that interconnects all the various game locations ) , I thought it important to have this section feel both huge but populated. The problem with creating a map that’s 100,000 by 100,000 pixels in dimensions is that it takes a long time to sail around. I timed it on my watch – if you’re sailing at 3 pixels a frame for 60 frames a second, it takes nearly 9 minutes to sail across the entire map.

So, in essence, the map is going to need to have a lot of stuff in there to make it feel less empty. As I mentioned in the last update, I created a class called a ‘seaItem’  which contained the basic properties anything existing in the world would want to have ( a grid position, the ability to check collisions with other sea items, the ability to move if required, and so on). I then extended this seaItem into a bunch of subgroups:


Islands are the various landmasses scattered throughout the world. They stay where they are and aren’t rendered by the display list at all most of the time – they exist only as co-ordinates on a grid. When the player’s boat gets within a certain distance of the island, they are added to the display list (just above the water but below the boats) and become visible. At the moment when testing this on mobile devices I’m noticing a very slight frame jitter while it adds these islands but I’ll look to optimise that later – it’s because I’m creating the island texture at runtime and adding it in ( I can’t have 100 big images all in the texture memory all at once ) .

For the visual look and feel of the island, I thought long and hard about creating them procedurally and actually changing the colour of the water around them, having them as a series of connected tiles with heightmaps and images ( beach, jungle, rock and so on ). I did lot of searching on google for procedurally generating world maps and found some good stuff but in the end I decided it would be far too process intensive to create these at runtime when the actual benefit to the player was minimal. They’re essentially just images a player wants to land near , once reached, another screen opens with a bunch of things for the player to do. Knowing this, I still wanted to have them look random, varied and geographically interesting. Doing that all by hand was going to be really time consuming ( for now I’m doing all the art for this game myself ) , so I kept searching for a way to procedurally generate islands as images which I could then edit in Photoshop.

An amazing programmer called Amit Patel had the answer. His blog post on polygon map generation proved to be the answer – you could type in a bunch of variables and generate a landmass with rivers, mountains, snow and so on. Taking this image and editing it in Photoshop produced the effect I was after – what I’ll do later is go back and add my own artwork over the top of this, things like fortresses, volcanos, castles and towns that the generator couldn’t create. For now, here’s the result:



An ocean without waves might as well be a giant, boring pond, and we can’t have that. Firstly, I needed a weather system so I created a class that kept track of the time in the game and as time elapsed, this class would change the weather in the game. I set up five constants for weather ( SUNNY, LIGHT_RAIN, HEAVY_RAIN, STORM and SNOW ) and added a few particle systems I’d used in other games to add rain , snow and lightning effects. Incidentally, it’s really easy to create a simple but effective lightning flash in your game. Here’s a code snippet I wrote if you’re interested.

[code language=”actionscript3″]

public function doLightning() {

if (!lightningQuad) {
lightningQuad = new Quad(GlobalVars.fullScreenWidth * 1.2, GlobalVars.fullScreenHeight * 1.2, 0xFFFFFF);
lightningQuad.pivotX = lightningQuad.width * 0.5
lightningQuad.pivotY=lightningQuad.height * 0.5
lightningQuad.x =GlobalVars.stageWC
lightningQuad.y =GlobalVars.stageHC

// play your thunder sound here
GlobalVars.gameSounds.playSound(“thunder”, 1)

// use whatever shake screen function you have to shake the world a bit when it flashes
lightningCounterMax = snippets.randomBetween(10, 50)


private function update(){

//call this every frame, check if there’s a storm and if so there’s a random chance of lightning
if (currentWeather == WEATHER_STORM) {
if (lightningCounter > 0) {
if(lightningCounter==0) removeChild(lightningQuad)



In addition to the weather, the class also included parameters for windStrength and windAngle, which would change randomly depending on the weather conditions.

With my weather system in place, I then created a wave class that extended the seaItem. These waves had their own special functions for moving ( they move in the same direction as the wind and at twice the speed, and then when greater than a certain distance away from the player, they spawn again in a constant loop. I decided to only use waves in big storms – when they hit a player, the boat actually jumps and your hull takes damage ( and crew may or may not fall out of the boat ).

Clouds behave in a similar way to waves except they float above everything else on the display list. They move in the same direction as the wind and at the same angle, then loop back when offscreen and away from the player. If you’re wondering how I move the clouds, it’s a simple bit of trigonometry as follows:

[code language=”actionscript3″]

public function moveCloud():void
currentMoveSpeed =weather.windStrength
this.xVel= currentMoveSpeed * Math.cos(weather.windAngle);
this.yVel= currentMoveSpeed * Math.sin(weather.windAngle);
this.x+= this.xVel
this.y += this.yVel




The player’s primary mode of transportation/exploration in this game is, of course, a boat. Since you’re not alone in the world, I created roughly 500 or so other boats that would sail around the world exploring – I might just spawn these at random through the game so it doesn’t seem to crowded. Boats extend the seaItem class and add a few other functions such as a particle effect for seaspray when moving across the water, the ability to ‘jump’ out of the water when hit by a big wave and the functionality to rotate and move to a point when the user taps the screen.

The boat class is going to have a lot more detail in it later as I start adding statistics to it like ‘number of cannons’, ‘hull strength’, ‘number of cargo holds’ and so on, but for now it’s enough that it can sail around and interact with the world. When two boats meet, a bunch of options will appear such as ‘parley’, ‘attack’ and ‘trade’, but that’s a fair ways away.

Anyway, as a special bonus this week, here’s a bit of very early gameplay footage showing the weather, islands and boats all working together.


Next week I’ll talk a bit more about the RPG elements and play cycle of the game and perhaps even a bit about… sea monsters!

As always, thanks for reading and happy journeys.

Cheers, Oliver Joyce
Whiskeybarrel Studios