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
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
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
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 ![]()
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! ![]()
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
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.
Popular in Discussions
Other popular topics
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









