F3: Architecture document

Add docs/ARCHITECTURE.md covering the tick rate, simulation and presentation split,
command stream, entity IDs, snapshot format, seeded RNG rules, module map and
performance budgets. A test scans src/sim for presentation dependencies and unseeded
randomness, so the separation is enforced.

Closes #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 17:12:59 -05:00
co-authored by Claude Opus 5.5
parent 0052624662
commit 1d3bee3c8d
2 changed files with 159 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
extends TestCase
## Identifiers from the engine's rendering, audio, UI and scene-tree areas.
const FORBIDDEN: Array[String] = [
"RenderingServer", "PhysicsServer3D", "AudioServer", "AudioStream", "DisplayServer",
"Node2D", "Node3D", "MeshInstance3D", "Camera3D", "Control", "CanvasItem", "Viewport",
"SceneTree", "get_tree", "Input.",
]
const NONDETERMINISTIC: Array[String] = [
"randf(", "randi(", "randf_range(", "randi_range(", "randomize(", "Time.", "OS.get_ticks",
]
func test_simulation_has_no_presentation_dependency() -> void:
_scan(FORBIDDEN)
func test_simulation_has_no_unseeded_randomness() -> void:
_scan(NONDETERMINISTIC)
func _scan(needles: Array[String]) -> void:
var paths: Array[String] = _scripts_under("res://src/sim")
assert_true(not paths.is_empty(), "expected scripts in src/sim")
for path: String in paths:
var source: String = FileAccess.get_file_as_string(path)
for needle: String in needles:
# Comments may mention these; only code counts.
for line: String in source.split("\n"):
var code: String = line.get_slice("#", 0)
if code.contains(needle):
fail("%s uses %s: %s" % [path, needle, line.strip_edges()])
func _scripts_under(dir_path: String) -> Array[String]:
var found: Array[String] = []
for name: String in DirAccess.get_files_at(dir_path):
if name.ends_with(".gd"):
found.append(dir_path.path_join(name))
for name: String in DirAccess.get_directories_at(dir_path):
found.append_array(_scripts_under(dir_path.path_join(name)))
return found