F5: Simulation core and player command stream

Add the fixed-tick Simulation, the EntityRegistry with never-reused IDs, SimRng's named
seeded streams, and the 14-byte PlayerCommand used by humans, bots and the network.
state_hash is a SHA-256 over a canonical encoding of the state. Movement is a flat
placeholder until the v0.2 character controller. Tests replay a 24-player command log
over 10,000 ticks and scan src/sim for unseeded randomness and presentation code.

Closes #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 17:16:03 -05:00
co-authored by Claude Opus 5.5
parent 16ad1b7754
commit 27e08db51d
21 changed files with 686 additions and 9 deletions
+37
View File
@@ -0,0 +1,37 @@
extends TestCase
func test_ids_start_at_one_and_none_is_never_used() -> void:
var registry: EntityRegistry = EntityRegistry.new()
assert_eq(registry.create(1).id, 1)
assert_eq(EntityRegistry.NONE, 0)
assert_null(registry.find(EntityRegistry.NONE))
func test_ids_are_never_reused() -> void:
var registry: EntityRegistry = EntityRegistry.new()
var first: int = registry.create(1).id
assert_true(registry.remove(first))
assert_false(registry.contains(first))
assert_ne(registry.create(1).id, first)
func test_iteration_is_in_ascending_id_order_after_removals() -> void:
var registry: EntityRegistry = EntityRegistry.new()
for _index: int in 5:
registry.create(1)
registry.remove(2)
registry.create(1)
var ids: Array[int] = []
for entity: SimEntity in registry.entities():
ids.append(entity.id)
assert_eq(ids, [1, 3, 4, 5, 6] as Array[int])
func test_removing_while_iterating_is_safe() -> void:
var registry: EntityRegistry = EntityRegistry.new()
for _index: int in 4:
registry.create(1)
for entity: SimEntity in registry.entities():
registry.remove(entity.id)
assert_eq(registry.count(), 0)