Engine From Scratch
You'll write your own 2D engine with a window, a loop, input, sprites, collision and audio, then ship one game on it.
About
Writing your own 2D engine is a rite of passage, and most people never finish because they build an engine instead of a game. The rule here is to build only what one specific game needs. Use SDL2, Raylib or a browser canvas for the window and input, and your own code for everything else. Ship a game on it, then open a commercial engine again and notice how much it was doing for you.
At a glance
- Per requirement
- 50 XP
- Completion bonus
- 600 XP
- Requirements
- 7
- Takes
- A season
- Skill level
- Advanced (years of practice)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Pick the game first, then list the ten features the engine must have for it. The goal isn't 'an engine', it's 'an engine for this Breakout clone'. Take a photo of the list. Photo
-
2
Open a window, run a fixed-timestep loop and read keyboard input. Use a fixed update at 60 Hz with an accumulator and a variable render, and print the frame time. Record the window with a moving square and a frame counter. Video
-
3
Load and draw sprites from a sprite sheet with a camera transform. That means a texture atlas, source rectangles, and a camera that offsets everything. Record a scrolling scene with sprites in it. Video
-
4
Write AABB collision with resolution that doesn't tunnel at high speed. Use swept collision or sub-stepping. Test it by firing an object at 2000 pixels per second at a wall. Record the fast object stopping rather than passing through. Video
-
5
Play sound effects and loop music through your own audio layer. SDL_mixer, miniaudio or Web Audio all work. Mix two sounds at once without a crackle. Record overlapping sounds with the audio on. Video
-
6
Add a scene system and a simple entity list, then ship the game on it. You need title, play and game over scenes, and entities with update and draw. Don't add a component system unless your game needs one, and it doesn't. Share a link to the public playable game and to the engine's source, with a screenshot or a short clip of the game running. Photo or video
-
7
Write a post on what you'd steal from a real engine next time. Make it the honest list of what was harder than you expected. Take a screenshot of the post and include the link. Photo