With the planned end of support for Flash and the removal of the plugin from all browsers slated for some time in 2020, Battle Pirates needs to evolve so that it can continue to be enjoyed for years to come. With that in mind, we’ve embarked on a plan to convert the game to run entirely in WebGL without the need for any plugins at all. This plan has been in the works for quite a few months already and, as we are fast approaching the end of the conversion process, we thought we would give some insight into the progress and the challenges we’ve faced.
First, some news about where we are at today:
As of this moment we have the game mostly ported over. There are still several expected bugs and artifacts to resolve as a result of the conversion process, as well as the new technology stack, but we are fast approaching a point where we will be able to have the new version available for players to try out.
The game has already seen improved frame rates as a result of the conversion, mostly because a lot of that work is now offloaded to the GPU, instead of running entirely on the CPU like it was in Flash. There are some slight visual differences between the two clients which we are currently fixing up but unless you look closely, it’s hard to tell that it’s not the same client.
Now that you know where we’re at currently, let’s look back at the production thus far. When deciding on how to convert a game, the first thought is to rewrite the game entirely from scratch in a new language or engine. However, for a game as big and long-living as Battle Pirates this is not an option. A complete rewrite of that scale would take years as we try to re-create every single feature piece-by-piece to function the same as Flash, and by the point we had finished we would have missed the Flash deadline. Instead, we set out to find a more automated way to convert the game.
To accomplish the port, we used an automated tool in an open-source software framework called OpenFL to convert the existing Flash codebase into a new language which allowed us to create a WebGL version relatively easy. I say ‘relatively’ because there were plenty of issues with the translation that needed to be fixed manually by Battle Pirates engineers. All the same, it gave us a big jump start on the process.
Once we had the game up and running, we started combing the game feature-by-feature, fixing issues wherever they were encountered. And bonus! We also implemented a few improvements back to the OpenFL project, including a faster glow effect which would run on the GPU via shaders instead of on the CPU, and a new batcher system which allowed us to significantly reduce the number of draw calls. Each of these improvements will be available to anyone using OpenFL project – a neat way that Battle Pirates is giving back to the engineering community.
And so here we are! The game is at the point where all of the features are functional, the framerate is better than it was in Flash, and everything is starting to look really good. There are still a few visual issues and various bugs we would like to fix before releasing it for you all to test, but we are approaching that day quickly and it’s all getting quite exciting.
Below is a screenshot comparison of the current BP game alongside the new HTML5 client, showing that there won’t be much – if any – interruption to your current visual experience of the game.
We’re excited to bring this new client to you and help support BP for many years into the future. As always – thanks for playing Battle Pirates!