Odin is a general-purpose, data-oriented systems programming language positioned as a C alternative, with a built-in standard library.
karl-zylinski/karl2d
A beginner-friendly 2D game library for the Odin programming language, targeting Windows, Linux, Mac and the web.
- Stars
- 724
- Forks
- 66
- Open issues
- 37
- Last commit
- 2 days ago
What is it?
Karl2D is a 2D game creation library written for the Odin programming language. It handles windowing, drawing, input, audio and asset loading so that developers can build simple games without assembling a large stack of dependencies. The library is designed to talk directly to operating system and rendering APIs rather than wrapping an intermediate layer such as GLFW.
The same codebase can produce desktop executables and web builds. Web builds use a WebGL backend and the official Odin JS runtime, so no Emscripten toolchain is required. A bundled build_web tool packages a game for the browser, and assets can be embedded at compile time with #load for web use.
The project is in beta. Its API overview is generated as karl2d.doc.odin, and the repository includes a range of examples such as a tilemap editor, positional audio and a small top-down game.
Key features
- 01Load and draw textures and geometric shapes
- 02Camera support for moving, rotating and scaling the view
- 03Audio playback for sound clips and music, including a software mixer
- 04Mouse, keyboard, gamepad and touch input (touch on web)
- 05Desktop builds for Windows, Linux and Mac, plus web builds without Emscripten
Use cases
- Learning game development with a small, readable codebase
- Building simple 2D games that can ship to both desktop and browser
- Prototyping 2D gameplay in Odin without a heavy engine
- Modifying the library internals to fit a custom game engine stack
Quick start
- 1
Install the Odin compiler from odin-lang.org
- 2
Put the karl2d repository into a subfolder named karl2d inside your game folder
- 3
Create game.odin with the hello world code from the README
- 4
Run the game from your game folder
odin run .
Things to know
- The README describes the library as being in beta, so expect bugs and possible API changes.
- Hot reload is only experimental and lives in a separate repository.
- On Linux you may need to install the lld package to get wasm-ld for web builds.
In collections
Topics
FAQ
- What is karl2d?
- A beginner-friendly 2D game library for the Odin programming language, targeting Windows, Linux, Mac and the web. Karl2D is a 2D game creation library written for the Odin programming language. It handles windowing, drawing, input, audio and asset loading so that developers can build simple games without assembling a large stack of dependencies. The library is designed to talk directly to operating system and rendering APIs rather than wrapping an intermediate layer such as GLFW.
- Is karl2d free to use? What license does it have?
- karl2d is open source under the Zlib license. Check the license terms before using it in commercial products.
- Is karl2d still maintained?
- Actively maintained. The last commit to karl2d was on Nov 5, 2026.
- What can I use karl2d for?
- Learning game development with a small, readable codebase Building simple 2D games that can ship to both desktop and browser Prototyping 2D gameplay in Odin without a heavy engine Modifying the library internals to fit a custom game engine stack
- How do I install karl2d?
- Install the Odin compiler from odin-lang.org Put the karl2d repository into a subfolder named karl2d inside your game folder Create game.odin with the hello world code from the README Run the game from your game folder: odin run .
- Where can I get karl2d?
- The source code and installation instructions are on GitHub: https://github.com/karl-zylinski/karl2d
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A fun-first 2D game library for JavaScript and TypeScript that provides a component-based API for building games in the browser.
A game engine built on Flutter, providing a game loop, component system, collision detection, effects and input handling for 2D games.
A free TypeScript 2D game engine for building games that run in the HTML5 canvas in the browser.
A simple 2D game engine for the D programming language, with built-in physics, animation, tilemaps and dialogue.
LÖVE is a free, open-source framework for making 2D games in Lua, running on Windows, macOS, Linux, Android and iOS.