#
# Allows for fast support of a large number of entities with rare actions,
# such as a forest with many individual trees.
-module bucketed_game
+module bucketed_game is serialize
import serialization
# Something acting on the game
class Turnable[G: Game]
- auto_serializable
# Execute `turn` for this instance.
fun do_turn(turn: GameTurn[G]) is abstract
# Something acting on the game from time to time
class Bucketable[G: Game]
super Turnable[G]
- auto_serializable
private var act_at: nullable Int = null
# Optimized organization of `Bucketable` instances
class Buckets[G: Game]
super Turnable[G]
- auto_serializable
# Bucket type used in this implementation.
type BUCKET: HashSet[Bucketable[G]]
# Event raised at the first turn
class FirstTurnEvent
super GameEvent
- auto_serializable
end
# Game logic on the client
class ThinGame
- auto_serializable
# Game tick when `self` should act.
#
# Game turn on the client
class ThinGameTurn[G: ThinGame]
- auto_serializable
# Game tick when `self` should act.
var tick: Int is protected writable
# Game turn on the full logic
class GameTurn[G: Game]
super ThinGameTurn[G]
- auto_serializable
# Game that `self` belongs to.
var game: G
# Full game logic
class Game
super ThinGame
- auto_serializable
# Game type used in this implementation.
type G: Game