Procedural generation of an infinite world

Procedural generation is a technique that can be used in video games to create an infinite amount of data for maps, textures and sounds to make game worlds that never end.

As described in my previous post, I recently entered the JS13k Games competition and I wanted to make a game that felt big but would fit within the 13 kilobytes size limit imposed by the competition. I chose to use procedural generation since it meant I could generate the game world within the game code, thereby keeping the size of the overall package small.

A screenshot from my JS13k game “Back from Kooky Island” showing the procedurally generated terrain

Here I discuss some of…

“Back from Kooky Island” — JS13k Games 2019

During my daily commute to and from work I have been writing a game to enter into the Js13k Games competition.

The competition runs for a month every year, at the end of which entrants must submit a complete game using only 13 kilobytes. The competition has been running since 2012, and this year 245 games were entered.

The standard of games in JS13kGames varies but is generally high, with some of the games being as good as commercial products. …

Photo by John Tuesday on Unsplash

I recently went to a conference where one speaker began their talk with “Some people say Javascript isn’t for Machine Learning. I’m here to tell you that it is….”

That got me thinking. Why are people so keen to have solutions to problems available in a particular language? Why focus on the language not the problem? Then I realised — we make a big investment when we learn a programming language. We put in so much effort that the language begins to define us. We think of ourselves as “Javascript developers,” “Java developers,” “Ruby developers.” …

Kind of…

Photo by Alex on Unsplash

State can be thought of as any value that a system “remembers”. In Javascript, variables are used to keep state. The browser also keeps its own state, for example, the URL of the current page, the content of the page, whether a link has been visited before, and which form element has keyboard focus.

CSS doesn’t define any way to keep state. CSS has some notion of variables, but these are actually more like constants, and it doesn’t make sense to do things like:

body {
--my-size: calc( var(--my-size) + 40px);

The purpose of CSS to alter…

Drawing pixel graphics on an HTML canvas

As I described in a previous post, Web Assembly is intended as a target language for compilers, not as a general-purpose language for programmers. In other words, you’re not supposed to write programs in Web Assembly itself but instead write in a higher-level language then compile it into Web Assembly.

I first met assembly languages on 8-bit microcomputers where they were used to write software that ran as fast as possible on what was by modern standards very slow hardware. Since then assembly language has had a special appeal to me, so even though Web Assembly is not intended as…

What is Web Assembly, and what is it for?

Photo by Alexandru-Bogdan Ghita on Unsplash

Before Web Assembly

For over twenty years, the only programming language universally understood by web browsers was Javascript. Anyone wanting to program for the browser either had to write in Javascript or else use a tool to convert (compile) their preferred language into Javascript.

Either way, a Javascript interpreter (runtime) needs to examine the running program in order to map Javascript's syntax and abstractions to the memory and processor of the underlying hardware. …

Photo by Oleg Sergeichik on Unsplash

The following is a simple command that I find useful to clear out unused node_modules directories. I have quite a few NPM projects on disk, but most of them aren’t being actively worked on, so to free up space I delete the contents of these directories. I can always re-populate them later as I need them, using the usual npm install.

find . -type d -name node_modules -exec rm -rf {} \; -exec mkdir {} \;

WARNING: This deletes files from disk, so use it at your own risk!

This uses the find tool to recursively search the current directory…

Alexander Curtis

Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store