I made a Boulder Dash type of game in Elm!


#1

Hi Folks!

Since a few months I have been working on creating a Boulder Dash type of game in Elm. I wanted the game to be played on a 12 by 12 pixel grid and there for the menu (and some of the levels are in a pixel style). But I also added images to make it more look-a-like to old Boulder Dash.

I really like reading game programming books (although I’m not a game programmer for my profession). And I tried to add lots of game programming tricks to this game. Like it has the “Actor/Component” system which allows you to configure “actors” and their behaviour in assets like json. It has a game loop which can skip “view ticks” if the logic falls behind. To make sure the game plays at the same speed even if you have a slower device. And I added “prime search” to add “semi random” behaviour to the game.

I recently added a small visual editor (not in elm) to allow others to create and play they own games.

Because of the whole asset configuration system you could define other type of behaviour. Which does not have a real editor but you can supply the json to the “advanced editor” screen.

Oke enough talk let’s show some links!

The code is here on github, where the readme does a bit better in explaining the story. And it also holds links to the demo, easy editor and advanced editor.

You can play the game here:

https://jordymoos.github.io/elm-pixel-boulder-game/?startLevel=official%2F001&hideDebug=1

The easy editor is over here:

https://jordymoos.github.io/elm-pixel-boulder-game/?hideDebug=1

And if you like to rule the world you should go over here:

https://jordymoos.github.io/elm-pixel-boulder-game/?editorMode=advanced

And if you like to watch Game of Life for a few hours then you should go over here:

https://jordymoos.github.io/elm-pixel-boulder-game/?startLevel=test/game-of-life&pixelSize=10&width=40&height=17&hideDebug=1

Please let me know your thoughts and I would like to play your custom levels and add them to the game!

Cheers!


#2

Awesome! I loved to play this game as a kid! I also did take a look at the code and it looks very clean and comprehensible. Great piece of code to learn from how to code in elm and how to name things! I’m not sure why this code is so readable … maybe because of elm as a language or because of the great naming of thing… or maybe both!

Thanks for sharing!


#3

Thanks for you reply @ni-ko-o-kin,
I played this game as a kid a lot too!

I think Elm is mainly the cause of the code being so readable. (there are some bad parts to the code base which is mainly my fault lol). I like to see that I did learn a lot about Elm and the functional style while building this game. Which is visible if you compare some of the older files to the newer ones.

This new file:

Is way cleaner than this older one:

Cheers!


#4

I updated the logic of the camera which will make it way smoother. Give it a try :wink:

https://jordymoos.github.io/elm-pixel-boulder-game/?startLevel=official%2F001&hideDebug=1