Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (17 sloc) 1.42 KB
title tags hide_sidebar summary permalink
Stateless system
topics
ECS
true
A [system](system) is called *stateless* if the side effects of all of its [systematic functions](systematic_function) are limited to the [cosmos solvable](cosmos#solvable) or [message queues](message_queue); objects that are usually given as input through a [logic step](logic_step) object.
stateless_system

Overview

As opposed to member functions of an audiovisual system, the member functions of a stateless system are required to be deterministic.
A common pitfall here is to define a static RNG within the body of a systematic function, later to only produce divergent results for two cosmoi run with identical inputs.

Usually, the systematic functions of all stateless systems are called inside solve, so every time the game performs a step.

Conventions

A stateless system is usually an empty class without member fields, only member systematic functions.
Thus the name stateless.
In this case these member functions could as well be free-standing functions in the global scope.

If a stateless system needed to initialize some heavy data to be used once by all of its member functions, having those functions as members allows us to do so transparently to the system's client; though to date, no stateless system needs that.

You can’t perform that action at this time.