Beginner Tutorials: How to build a game in Elm — Part 1
Next: Part 2 — Add Keyboard
This is the first of 12 parts tutorial about making a game in Elm. Pure Functional Programming are a good fit for video games development, as expressed at the QuakeCon Convention by John Carmack.
Couple of disclaimers:
- I’m not a game developer, this was just an exercise that I wanted to do with my children to expose them to video games from a different perspective
- The code is not optimised for performance but it still pretty fast
Let’s get started!
The game loop
Differently from a regular web application that sleep for most of the time and wake up only in case of some event, like an user click for example, a game is always awake.
This is done through a never ending loop, something like (in pseudo-code):
while game is running
process inputs
update game world
generate outputs
loop