Initial commit: Transcience MVP
Top-down twin-stick bullet-hell, Godot 4.7, server-authoritative dedicated server with client-side prediction. Clients send input only; the server resolves every hit for both players and enemies (no PvP). - SimWorld: whole simulation as plain RefCounted objects (no nodes, no physics server), ~0.24ms/tick at peak load -- runs headless for free and drives 78 tests in under a second - BulletPool: struct-of-arrays bullet storage, replicated as spawn/despawn events rather than per-tick state - Emitter framework (Ring/AimedSpread/WallGap/ArcSweep) shared by trash enemies and bosses -- a new boss is data in src/content/content.gd, no simulation changes - The Warden of the Fold: stationary 4-phase boss built entirely on that format - Lobby hub with a portal into on-demand dungeon instances; one process hosts the hub plus every concurrent dungeon - Emergency escape: 3s server-owned channel, cancelled by damage - tools/check.sh, test.sh (GUT), smoke.sh (real server + bot clients over ENet), bench.gd; git hooks wired to the same scripts - docs/ARCHITECTURE.md, NETCODE.md, WORKFLOW.md, ROADMAP.md
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
extends GutTest
|
||||
## The input packet is the only thing a client can put on the wire, so its
|
||||
## bounds are a security surface as much as a format.
|
||||
|
||||
|
||||
func _round_trip(f: InputFrame) -> InputFrame:
|
||||
var b := StreamPeerBuffer.new()
|
||||
b.big_endian = false
|
||||
f.write(b)
|
||||
b.seek(0)
|
||||
return InputFrame.read(b)
|
||||
|
||||
|
||||
func test_round_trip_preserves_tick_and_buttons() -> void:
|
||||
var f := InputFrame.make(123456, Vector2(0.5, -0.25), 1.75,
|
||||
InputFrame.BTN_FIRE | InputFrame.BTN_ESCAPE)
|
||||
var out := _round_trip(f)
|
||||
assert_eq(out.tick, 123456)
|
||||
assert_true(out.pressed(InputFrame.BTN_FIRE))
|
||||
assert_true(out.pressed(InputFrame.BTN_ESCAPE))
|
||||
assert_false(out.pressed(InputFrame.BTN_INTERACT))
|
||||
|
||||
|
||||
func test_move_survives_quantisation_within_tolerance() -> void:
|
||||
var out := _round_trip(InputFrame.make(1, Vector2(0.5, -0.25), 0.0, 0))
|
||||
assert_almost_eq(out.move.x, 0.5, 0.01)
|
||||
assert_almost_eq(out.move.y, -0.25, 0.01)
|
||||
|
||||
|
||||
func test_aim_survives_quantisation() -> void:
|
||||
var out := _round_trip(InputFrame.make(1, Vector2.ZERO, 2.5, 0))
|
||||
assert_almost_eq(out.aim, 2.5, 0.001)
|
||||
|
||||
|
||||
func test_oversized_move_cannot_be_expressed_on_the_wire() -> void:
|
||||
var out := _round_trip(InputFrame.make(1, Vector2(50.0, 50.0), 0.0, 0))
|
||||
assert_lt(out.move.length(), 1.45, "the byte encoding must cap the move vector")
|
||||
|
||||
|
||||
func test_frame_is_exactly_the_declared_size() -> void:
|
||||
var b := StreamPeerBuffer.new()
|
||||
InputFrame.make(1, Vector2.ONE, 1.0, 7).write(b)
|
||||
assert_eq(b.data_array.size(), InputFrame.SIZE)
|
||||
Reference in New Issue
Block a user