A refreshing question!
You're looking for game engines that are declarative (as opposed to imperative) and non-OOP (no Object-Oriented Programming). That's a bold move, as most game engines out there are built around OOP principles. But, I'll highlight some interesting alternatives that fit your criteria. Buckle up!
What does "declarative" mean in this context?
In declarative programming, you describe what you want, not how to achieve it. You define the desired state, constraints, or rules, and the engine figures out the execution. Think of it like specifying a query (e.g., "I want all enemies within a 5-meter radius") instead of writing a procedure (e.g., "loop through all enemies, check distance, add to list").
What does "non-OOP" mean?
No classes, objects, inheritance, polymorphism, or encapsulation (the usual OOP suspects). Instead, we'll look at engines using functional programming, data-oriented design, or other paradigms.
Now, onto the list!
1. ClojureScript's Purgatory (cljs-purgatory)
Purgatory is a declarative, data-driven game engine built on ClojureScript (a Lisp dialect). It uses a Entity-Component-System (ECS) architecture, but without OOP. Entities are plain data structures (maps), components are mere data, and systems operate on that data using pure functions.
- Declarative: Define game state, rules, and behaviors using data (e.g., EDN files).
- Non-OOP: ClojureScript is functional; Purgatory leverages immutable data structures and functions.
2. Flix (The Flix Game Engine)
Flix is an open-source, Haskell-based game engine. Yes, Haskell! A purely functional programming language. Flix uses Functional Reactive Programming (FRP) to describe game logic.
- Declarative: Express game behavior using time-varying values (Behaviors) and events.
- Non-OOP: Haskell is functional; Flix relies on algebraic data types, pattern matching, and higher-order functions.
3. Enki
Enki is a Rust-based, data-oriented game engine. Although Rust supports OOP, Enki avoids it entirely. Inspired by ECS, Enki represents game state as plain data (structs, enums) and uses systems (functions) to manipulate that data.
- Declarative: Define entities, components, and rules in RON (Rusty Object Notation) files.
- Non-OOP: Rust's ownership model and functional patterns (e.g.,
match, closures) replace OOP.
4. Diligent Engine (DE)
Diligent Engine is a C++14, data-driven engine using a declarative API. Although C++ is OOP-friendly, DE sidesteps classes for most of its API. Instead, it relies on structs, free functions, and generic programming.
- Declarative: Describe graphics pipelines, resources, and render passes using structs and constexpr data.
- Non-OOP: C++ features are used, but in a non-OOP way: think
std::tuple, std::array, and function templates.
5. PlayCanvas's Scripting (JavaScript, but not quite OOP)
PlayCanvas is a cloud-based game engine with a component-based architecture. While JavaScript is OOP-capable, PlayCanvas encourages a more functional style for scripting.
- Declarative: Attach plain data (components) to entities; write event handlers (functions) to react to state changes.
- Non-OOP: Although JavaScript classes are available, PlayCanvas tutorials and examples promote a struct + functions approach.
Honorable mentions:
- LÖVE (Lua): While not strictly non-OOP, LÖVE's API is data-oriented, and Lua is prototype-based (not classical OOP). You can easily write declarative code using Lua tables and functions.
- PICO-8 (Fantasy Console, Lua): This tiny game environment uses functions and data to define game logic. No OOP in sight!
Keep in mind that some of these engines might still use OOP under the hood (e.g., for internal implementation details). However, their public APIs are designed to be declarative and non-OOP, which is what matters for your use case.
Before diving in, consider the trade-offs:
- Smaller communities: Non-OOP, declarative engines might have fewer resources, tutorials, and assets.
- Steeper learning curve: You'll need to adapt to new paradigms (e.g., FRP in Flix or ECS in Purgatory).
- Performance: Some engines (e.g., Enki, Diligent Engine) are designed with performance in mind, but others might not be optimized yet.
Now, go forth and explore these innovative game engines! You might discover a new favorite programming paradigm.
Happy game dev-ing!