Battle Pirates

From about the end 2017 to the start of 2021 I was working for KIXEYE - a (at the time) California based gaming company - thay had just opened an office in Melbourne. It was so new, that for a while there it was just me and Pete in an office by ourselves.
I was brought on to help out with their flagship game (pun intended) - Battle Pirates.
Battle Pirates was a a super popular flash game that was available on Facebook and Kixeye’s own website. In fact, it was one of the first really huge games on Facebook, and had thousands of people playing it everyday. It allowed users to build bases, create fleets and explore online maps where they could battle it out with NPCs and other online players.
As you can expect with a game like this, there were a lot of moving parts. It was pretty daunting. It took me a while to get a handle on where everything lived and how it all worked - but with the help of the team I managed to get up to speed.
The game was constantly evolving and was running on a fortnightly release cadance. New content, features and events were constantly going out. The whole thing was an international effort, with the team split between the USA, Canada, Vietnam and two offices in Australia.
My focus was mainly on the flash client component, mainly implementing new features and fixing bugs. Whilst there are heaps of things I could talk about, there were two major things I helped work on that I was really proud of.

Secure Base
One of the funny things I can talk about now is just how “inscure” the game was. Nearly all the logic ran on the client side. It was pretty trivial to hack elements of the game to try and speed up your progress.
About 6 months in (I think) me and one of the back end devs were given the task of trying to make the content more secure. This meant retro-fitting the game to do nearly all of the important calculations on the server side.

The two of us came up with some much more generic approaches to the existing systems and set about making the client maintain state much better. One of the things I was particulary happy with was the method we came up with for dealing with timers.
The original system was a bit complicated and flakey. I think it stored a start time and tried to calculate the progres based on the current time - which kinda worked. It fell apart a bit when it came to allowing the player to buy speed ups, which were stored in some weird way and was easy to break (I’m going from memory here, to the details are a bit flakey)
The solution we came up with was to store a start and end date it UTC. We knew how long something would take, so when it started, we just stored the current time, and then added the duration to make the end time. This made it very easy to calculate the progress by comparing it to the curretn time.
Speedups also became easy - all you had to do was time shift the start and end dates by the duration you were speeding it up by. Nothing else had to be changed or stored.
The whole process took months - it was one of those projects that you kept finding new things just when you thought you were almost finished. After a lot of work / testing / swearing we were able to finally launch.
All in all, it went exceptionally well.
The Death of Flash
In 2020 I think, Adobe announced the end of flash. This wasn’t great for a game like Battle Pirates.
A few of the senior devs had been working on various arrpoaches to try and port the game but had very mixed results. Finally somone came across as3hx and OpenFL - converters and languages that allowed us to transpile our AS3 scripts into HAXE, which would then output to HTML5 / Javascript.
It was not perfect - not by a long shot. But it worked.
Some of the devs in Canada managed to push the system to handle some of the more advanced AS3 techniques that we had been using. Converters were made to help create bitmaps from animations and other art.
I still don’t know what voodoo that actually used, but it was impressive and showed that the conversion may have been possible. I believe they even hired the author of OpenFL to work with us for a while to help speed up the development of the game, and the OpenFL framework.
Me and some of the other Australian Devs set up a bit of a work flow using Visual Studio Code and some haxe plugins (I think we used Lime for some of the build tools). We got the project set up in a way that we could iterate oin the client pretty rapidly and run it locally for testing. We also ended up getting the a whole debug suite working which made life 1000x easier.
Once that was all set up, we just had to slog it out. We went through every part of the game, updating anything that didn’t work - which at the start was almost everything.
We had to write shims to support features that JS didn’t support, write new bitmap memory management - one of the super smary guys in Canada evern reproduced Flash’s graphics API so we could do a bunch of our runtime graphics generation.
Side note: Write that gave me a flashback to a partically nasty bug where the map in the game would occassionally go black. You couldn’t see anyting. We were going nuts and runnin out of time before launch when I accidentally stumbled upon the cause - the map drew a line between where you were and where you were going, and in certain circumstances this would get so large that it would break the size of the bitmap buffer… it makes total sense in hindsight, but at the time it made me question my existence.
So, after almost a year of slogging it out alongside our other work we got it all working with a few weeks to spare.
We softlaunched the new HTML version beside the original flash game so people could test it for us and it all went really well. There were a few minor issues - but that was to be expected.
Summary
My time at Kixeye was a strange one. I can’t say i enjoyed it all the time, but I got to work with some amazing people and did some amazing things. I also got to travel to San Francisco for the end of year Christmas Party, which was a lot of fun.
