World War War

World War War screenshot

Friday 9th of June 2017

I've written another game. It's about countries fighting each other, it's called World War War, and it's not entirely serious.

Link below. There are no instructions, but I recommend you start with sandbox mode to give you an idea of how it works, or read on for some more information.

Overview

The game is deliberately straightforward. Choose a country, choose a game mode, begin. Clicking or tapping on the screen will fire away from your country in that direction. There are no movement controls, so the only way to reposition your country is from the recoil from your firing. Smaller countries are lighter and therefore easier to move, while bigger countries are slower, which is basically the game's difficulty mechanic (if you can survive Extreme mode as Russia, you're pretty awesome).

Every time a country is destroyed a message appears at the bottom of the screen. For some countries, it lists some of the things that were either invented there or are unique to that country (because education). I wanted to do that for every country in the world, but after I'd got through Europe and the Middle East it's actually quite hard to compile such a list for a lot of places.

The game is broadly responsive, so it should scale to fill your screen. I considered making it fully responsive (adapting to screen resize events) but that turned out to be overly complicated. There were a few other features that I wanted to try but decided against, having already spent much longer on the development than I'd first anticipated. I wanted to allow players to limit their skirmishes to a particular group of countries (say, Europe for example) and having more nuanced differences between each country (for example, different health levels or weapon types). It's not really a serious enough game to expend that kind of effort on it. Maybe for the sequel (ha).

World War War screenshot
It's kind of hard to see what's going on here, to be fair.

Background

I had the idea for this game ages ago but only recently realised that I could use Matter.js to do the heavy lifting. Development was very much a learning process - Matter's documentation is, well, it's pretty terrible (sorry. It's still a great engine though). At one point towards the end I almost considered abandoning the project entirely, as it simply wasn't working how I wanted it to. It seemed like no browser could cope with the load of several hundred objects bouncing around the screen, as most collisions weren't triggering, rendering the game unplayable. Eventually I re-read the relevant section of documentation and discovered that collision events could include more than one simultaneous collision, and suddenly everything started working perfectly.

Assembling the map was possibly the most time-consuming part of development. Yes, I did have to individually position each country in the world on the canvas - several times. I started by finding a set of images of the countries of the world, only to realise after assembling most of Europe and the Middle East that the map projection used for them meant they would never correctly fit together. I tried a second time, starting from a fully assembled SVG of the world, which definitely fit together correctly, until I later changed from using polygons to rectangles for country objects, and suddenly everything had moved out of position and needed fixing. So, three complete re-assemblies of the world.

Spending that much time carefully positioning countries in relation to each other leads to some interesting knowledge. Firstly, there are a lot of countries in the world, and I'm sorry, but not all of them are in here - simply because some of them are too small to be visible (see full list below). Here are some other observations, drawn from my very sketchy knowledge of world geography.

  • Croatia is a really awkward shape.
  • Russia appears to own a chunk of land on the coast between Poland and Lithuania, don't know what that's about.
  • Norway is also a really awkward shape.
  • Western Sahara isn't a place? Or is it part of Morroco? Confused.
  • I'm not sure I'd ever even heard of Benin before.
  • Had to take a creative liberty with Iceland - moved it slightly south to be out of the way of Greenland. Apologies, Iceland.
  • Azerbaijan is hugging Armenia.
  • I had to break the US into 3 chunks. No-one else was this unhelpful. Thanks, America.

There's a few oddities that I'm going to blame Matter.js for. Firstly, if an object isn't on screen it doesn't get drawn, but a sprite attached to an object can overlap the boundaries of that object. This means that sometimes larger countries seem to suddenly appear at the edge of the screen, rather than move in. Also, although it's possible to pause the engine, for some reason when I resume it, objects have clearly still been moving during the pause, even if that isn't shown. It's a bit weird. Finally, despite there being a boundary to the world, sometimes if you're playing as a small country it's possible to escape it and fly off into nothing. Again, if this was a more serious game I'd investigate further, but the effort doesn't seem to be justified.

Also, it's just possible that it won't work too well on mobile. It's a fairly resource intensive game, so it might get a bit chuggy. Also I tried very hard to remove the standard touchscreen tap delay, but struggled to find a reliable solution and eventually gave up. It also doesn't seem to work in Internet Explorer or Edge. I currently don't know why (I think it's something to do with the format of the SVG files). I'd like to care enough about those browsers to want to fix it, but I'm too busy right now.

World War War screenshot
It's quite fun to destroy the world, it turns out.

And finally

World War War wasn't originally meant as any kind of political or idealogical commentary. I had the idea for it long before the apparently recent rise of the [insert name of your country here]-first attitudes that seem to be prevailing at the moment. But when I came to write it and first saw countries crashing into each other and pinwheeling around chaotically, it seemed like it would fit perfectly with some kind of satirical wrapping. I pictured hard-line nationalists playing it seriously, cackling with glee as they gunned down other countries, hitting everything but the irony. It's still not meant to be political. It's meant to be fun. But really, do we have to hate everyone else so much?

As ever, the code's on my github page if you're interested.

Full list of the thirty eight 'not included because they were too small' countries

With apologies to their residents.

  • Andorra
  • Malta
  • Kosovo (inside Serbia, I'm confused about this one)
  • Liechtenstein
  • Monaco
  • San Marino (this is apparently a country inside Italy, which I didn't know existed)
  • Vatican City
  • Bahrain
  • Singapore
  • Timor-Leste
  • Brunei
  • Maldives
  • Cape Verde
  • Comoros
  • Mauritius
  • Sau Tome and Principe
  • Seychelles
  • Lesotho (literally inside South Africa)
  • Swaziland
  • Fiji
  • Kiribati
  • Marshall Islands
  • Micronesia
  • Nauru
  • Palau
  • Samoa
  • Solomon Islands
  • Tonga
  • Tuvalu
  • Vanatu
  • Barbados
  • Dominica
  • Antigua and Barbuda
  • Grenada
  • Saint Kitts and Nevis
  • Saint Lucia
  • Saint Vincent and the Grenadines
  • Trinidad and Tobago

Related