Kyd
A 2D game engine. Write games in Kotlin and run them as a standalone applications or inside a web browser.
Goal
Make writing games easy (ish) and fun.
I want to cater to the missing middle-ground between the novice-friendly Scratch and the powerful, but daunting Godot.
Structure
As with most game engines, there is a built-in editor where you set up the resources that your games
needs, in a tree-structure, with Game
being at the root of the tree.
Class names use theatre metaphors. (This game engine is named after the Elizabethan playwright Thomas Kyd)
A game consists of Acts
. The first act might be a menu. Click the play
button to start the next Act
.
An Act
is composed of many Stages
, stacked one on top of another. Simple games may only need 1 stage.
A Stage
is populated by Actors
and each actor has a Behaviour
.
Behaviour
is where most game-logic resides.
Each actor has an Appearance
, in many cases this will be a simple Graphic
(loaded from a .png file).
To animate the actor, change the actor's Appearance
each frame.
The classes Game
, Actor
, Appearance
, and Stage
are all pre-defined.
In some cases you cannot create subclasses, and for the others you could, but probably won't.
This is a deliberate design choice (to meet the easy and fun!
goal).
If Behaviour
governs the be behaviour of a single Actor
, where does the remaining game-logic live?
There are two interfaces Director
and Management
.
A Director
is in charge of a single Act
. It is created at the start of the Act
, and destroyed
when the Act
ends.
For example, if you have to collect N objects to win, Director
will keep track of the counter,
and when it reaches the goal, it will start the next Act
.
Management
is in charge of the game as a whole. It is created when the program starts and is never destroyed.
This is often quite dull, because Behaviour
and Director
handle all the fun game-logic.