harrisi

harrisi

OpenGL-rendered Breakout clone in Elixir

I made a breakout clone in Elixir with no dependencies. It’s mostly terrible, but I’ve tested it on macOS, Windows, and Ubuntu. Find it here: GitHub - harrisi/elixir_breakout: OpenGL-rendered Breakout port in Elixir. · GitHub. You can clone the repo and run the game with iex -S mix or mix run --no-halt. A/D, H/L, or left/right arrows to move left/right, space to launch the ball, N to switch levels, and P to profile for ten seconds (if you’re interested).

The code is quite bad. It’s a mostly straightforward port of the breakout implementation on https://learnopengl.com. My intention is to now make it more “BEAM-y”, but I think it’s an interesting project already.

Let me know if you have any problems running it or playing it. My machines are reasonably powerful, so I’m not sure how it runs in general.

EDIT: I posted in the blog post thread, but if anyone’s interested in random thoughts about this, Breakout Musings.

First Post!

rvnash

rvnash

I honestly had no idea that OTP had an OpenGL library in it. Thanks for sharing. Ran fine on my Macbook Air.

Most Liked

andyleclair

andyleclair

This is extremely cool and inspiring!

Don’t be so hard on yourself, plenty of production code around the world is “bad” and nobody will ever notice. Focus on what you did right, which is make a working game with Elixir! Very few people have done that.

andyleclair

andyleclair

I have such dreams of writing a game in Elixir, and you’ve basically followed the exact path I’ve envisioned (compiling for each platform with Burrito)

I’d thought it would be more straightforward to wrap something like Raylib, but mostly because I didn’t know about using OpenGL directly.

What’s keeping me from making a game? A full time job and a baby :sweat_smile:

harrisi

harrisi

Thanks for the kind words!

I’m not too worried about the code quality. I’m not new to programming, but I’ve only recently started working with Elixir, OpenGL, or any sort of game development, so I don’t expect much.

This is really the continuation of an exploration into what the BEAM can do in a game development situation. It started with a triangle, went to a (bad) ray tracer, the start of some 3d physics simulations, 3d modeling, and now a 2d game. Slightly going backwards, but it’s good progress I think.

I pushed an update with some text rendering. It’s basically a copy of the OpenGL text rendering in the :wx demo. There’s also a menu for selecting levels, and some more bugs! :slight_smile:

Text rendering is the last main thing I can do without bringing in some dependencies. I think it’s worth mentioning all the things Elixir can do by itself:

  • OpenGL Core Profile rendering with shaders
  • Windowing
  • Input handling
  • Text rendering
  • All the other normal things Elixir is good at

Really the only thing missing is audio playback. I’ve already tested Membrane, which seems to be the best (only?) option. I really wish there was a way to do audio playback without any dependencies. Oh well.

I’ll be adding audio playback soon, which will, I think, put this over the line into the lonely category of “finished games written in Elixir”.

Last Post!

heilong

heilong

There is a PNG reader in pure Erlang in Wings3D E3D utils. Totally solid, written by dgud, same author/project as WX OpenGL. On github and MIT-ish license with US Gov caveat.

https://github.com/dgud/wings/blob/master/e3d/e3d__png.erl

Easy to wrap in Elixir.

Where Next?

Popular in Discussions Top

ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
lorenzo
Hey everone! I created a prototype for my app using Nodejs for the api. But the framework I chose wasnt great (in general theresnt any g...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
RudManusachi
What configs will make sense to put to runtime.exs? – A bit of how I configure apps: I have generic configs in config/config.exs, dev...
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement