Home For Fiction – Blog

for thinking people

Patreon LogoPatreon

March 21, 2022

Forbidden Island JavaScript App: An Experiment in Creation

Programming

art, game, javascript, programming

First of all, a necessary disclaimer: If you came here expecting to find a ready video game version of the popular board game, Forbidden Island, I’m afraid I’ll disappoint you. This post does show my efforts in creating a Forbidden Island JavaScript app, but I can’t share the program with you. I can’t even share the JavaScript code with you.

You see, the game is – obviously enough – copyrighted. It would be both illegal and unethical to the creator of the game, Matt Leacock, to offer anything I’ve made (even for free).

However, worry not. Not only will I describe my thought process behind turning Forbidden Island into a JavaScript/PHP app – which might help you code one yourself, if you so wish – but, more importantly, I’ll share with you a discovery I’ve made.

This discovery is useful to all of us, gamers or not, coders or not.

I discovered that the most genuine form of creation comes when not only do you have no expectations, but when you can’t even have any expectations. In other words, the most genuine way to create something artistic is a result of knowing it will only be made for the sake of making it.

Forbidden Island JavaScript app
Here’s what the main screen of my Forbidden Island JavaScript app looks like. Notice that neither images nor (most) of the locations correspond to the actual game.

Why I Wanted to Make a Forbidden Island JavaScript App

Because I could; that’s the answer.

It was also the answer to why I made a JavaScript iambic pentameter generator, my Medēn art project, and basically everything else I’ve done, from writing books and composing music to all the programs I’ve made.

Because I wanted to.

In our result-driven world, we often forget the power that lies in art for art’s sake. Forget about sales, traffic, boost-your-CVs, followers, likes, shares, and every other instance of narrow-mindedness and mediocrity.

I’m talking about art; doing something just because you want to.

Forbidden Island App Programming Decisions

Note: I assume you are familiar with this magnificent board game. If not, and you’d like to learn more about it, I can really recommend it. It’s certainly one of the best games I’ve come across lately (15 years too late!). In a nutshell, it’s a cooperative game in which the players must obtain treasures from an island before it sinks beneath the ocean.

Though I never planned to share a Forbidden Island JavaScript app with anyone, I still wanted to make an app I could play with friends on the local network. This means, some sort of back-end is needed to keep track of player movements and overall maintain a central “view” of the game.

I decided to use PHP for that, both because I’m more familiar with it, and also because it was already installed. I’m sure you can use something else (Node.js, for instance) for the same purpose. The details are beyond the scope of this post (not to mention, I want to keep it accessible to a general audience), but basically your thought process should be like this:

Forbidden Island is a fairly structured game in terms of what happens at which point. In other words, there is a linear flow of actions. This obviously helps programming it.

Challenges I Faced

Generally speaking, there wasn’t anything too challenging. One thing that did trouble me for a couple of days was finding a way to control the diver’s movement. If you’re not familiar with the game: One of the possible player roles is that of the diver, who can swim through one or more flooded tiles.

For humans playing on a board, it’s trivial to see where you can move. It’s not as easy as it would seem when you program it. I found the solution when I realized that the number of tiles is actually low: 24. So I used some for-loops that

It was more complicated than I describe it here, but that’s the basic gist of it.

So, What Can We Learn from All This?

This isn’t the first time I do this. I once spent a couple of weeks — and many hours every day – coding another board game. Again, as the game is copyrighted, I can’t share it with anyone. I only made it because I felt like doing it.

To paraphrase from that post, we have a problem in that it has become really hard to do anything when we don’t see a clear path to some sort of graspable reward. We have lost the capacity to create for creation’s sake, which is by far the most dangerous kind of creativity. Why? Because it has disobedience in its core.

Art cannot be dependent on results; art is a process – a holistic one. Admittedly, we live in a world predicated on results. Indeed, we often rely on these results one way or another. If you don’t secure income (and you don’t have the outrageous luck to be living in a country with an advanced social system), you’ll be facing some serious problems. I’m not in a position to judge anyone because they value results.

Having said that, we shouldn’t fool ourselves, either. Art that is à la carte, made because someone pays someone to perform it, has to abide by rules – and there shouldn’t be any rules in art. If Michelangelo didn’t have to rely on the Vatican, who knows what he would’ve truly painted.

Other Games

Interested in getting your hands on some games you can actually play? Take a look at my adventure game Mansion Escape!