Repolode
karl-zylinski

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. 1

    Install the Odin compiler from odin-lang.org

  2. 2

    Put the karl2d repository into a subfolder named karl2d inside your game folder

  3. 3

    Create game.odin with the hello world code from the README

  4. 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

#gamedev#2d-games#game-library#odin#webgl#beginner-friendly#odin-lang#odin-programming-language

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