How to use
New Kingdoms helps rapidly iterate iOS games prototyping. It requires minimum effort to publish the game on an iOS device (together with template-love-game repository) and allows you to think of objects and their behaviours as in real life. You will need basic programming skills to code in Lua and advanced ability to analyze and model your objects and game rules. With all capabilities of the LÖVE engine you can easily create visual representation to see the objects’ life unfold.
You can skip visualisation and use CLI output if you want pure NPC simulation without user interaction. You can also change behaviors and visualisations independently.
Where to edit what / Folder structure
The folder layout is organized by “place of change” (often to rare):
- Change visuals or visual-related feedback:
src/ui/(often) - Change how model state becomes screen views:
src/app/GameLayout.lua - Change input mapping to game actions:
src/app/GameController.lua - Change inter-object gameplay rules, turn logic:
src/app/GameRules.lua - Change game world elements’ behavior:
src/entities/ - Change internal “heartbeat” coordination:
src/engine/Engine.lua - Change LÖVE framewok, only in:
src/main.lua,src/conf.lua,src/ui/ - Change core primitives, why?:) :
src/core/ - Change shared independent value helpers, per need:
src/shared/(rare)
Architectural intent
This project follows a pragmatic Clean Architecture split: keep gameplay rules/model independent from rendering/runtime, and keep framework/UI concerns at the edges. There is also a class dependencies diagram on GitHub.
Clean architecture mapping
- Entities (inner):
src/entities/ - Use cases / application rules (inner-ish):
src/app/GameRules.lua - Interface adapters (outer-ish):
src/app/GameLayout.lua,src/app/GameController.lua,src/ui/ - Frameworks & drivers (outermost):
src/engine/Engine.lua,src/main.lua,src/app/compose.lua
Important decisions:
- Entities and rules should NOT know about UI/rendering.
- The engine stays reusable by depending ONLY on the minimal interfaces (Ruleset/Layout/Controller) and
coreprimitives. - Layout and Controller are allowed to know both Entities + Views because they are adapters.
Dependency rules
Rules of thumb:
- if you’re editing
coreorengine, it should still make sense for another game. - if it would still make sense in a headless simulation, it’s not layout/controller.
- if it still makes sense without something higher-level (outer ring, abstracted), put it below (inner ring).
Allowed directions (conceptual):
core→ depends on nothing else insrc/entities→ may depend oncore,sharedengine→ may depend oncoreonly (runtime host + contracts)ui→ may depend oncore,sharedapp/GameRules.lua→ may depend onentities,core,shared(noui)app/GameLayout.lua,app/GameController.lua→ may depend onentities,ui,core,shared(they are adapters)main/compose→ may depend on everything (composition root)
History of development
In two articles referenced below, you can read the full story of its design, understand the final implementation down to classes, how they depend on each other, and how the engine is intended to be used. There is also a demo app to make it easier to start (based on v0.1), but it is not updated for the latest version of the engine.