Iris: A Minimalist 2D Game Engine for Swift

Hi everyone! I’d like to introduce Iris, a minimalist 2D game engine I’ve been working on.

I wanted an engine that provides the bare minimum needed to make a game—a window, a game loop, drawing primitives, and input—without the overhead of scenes, entity-component systems (ECS), or heavy editors. You write code, you draw pixels.

Why Iris?

Most modern game engines are either massive (Unity/Godot) or require a lot of boilerplate to get a simple square on the screen. Iris is designed for developers who want to jump straight into logic and rendering. It’s perfect for game jams, prototyping, or learning how game loops work under the hood.

Key Features

  • Minimalist API: A single Game protocol with update and draw methods.
  • Metal-Accelerated: Fast rendering on macOS using a custom Metal backend.
  • Comprehensive Collision System: Support for AABB, Circle, Polygon (via SAT), and even Pixel-Perfect Masks generated from image transparency.
  • Advanced Graphics: Support for stroke primitives, linear/radial gradients, and robust triangulation for complex concave polygons.
  • Swift 6.2 Ready: Fully compatible with Swift 6 strict concurrency (everything is Sendable where it counts).
  • Cross-Platform Core: While the renderer is currently Metal-based, the core math and collision modules have been stripped of Apple-specific simd dependencies, allowing the package to build on Linux. Will be adding a web and Linux rendering backend soon.

The repository includes several classic games rebuilt with Iris to showcase its capabilities:

  • Space Shooter: Features parallax backgrounds, sprite animation, and particle-like explosions.
  • Snake: A simple logic-focused implementation.
  • Breakout: Demonstrates the collision system and physics.

GitHub: https://github.com/Chandram-Dutta/Iris
Documentation: https://deepwiki.com/Chandram-Dutta/Iris
Swift Package Index:: https://swiftpackageindex.com/Chandram-Dutta/Iris

14 Likes

Interesting! Will take a look.

Curious to see how it compares to something like Raylib.