Add a second dungeon: the Proving Grounds, a test harness you walk into
ci / verify (push) Successful in 47s
ci / verify (push) Successful in 47s
Two labelled portals now stand side by side in the hub. The Proving Grounds runs the same generator, the same rooms, the same enemies and the same four-phase Warden -- enemies at a fifth health, the boss at 288 instead of 3600, and trash dropping potions 80% of the time instead of 8%. A manual pass over loot, the inventory, dropping and every boss phase takes a couple of minutes rather than a quarter of an hour. It is multipliers over the shared content rather than a parallel copy: a duplicated Content would drift the first time anything was tuned, and "identical but easier" would quietly stop being true. And it is a portal rather than a launch flag, so the two can be compared back to back without restarting the server -- which is most of the point. Which dungeon you enter is resolved from the player's server-side position, and PORTAL_USED carries the answer. There is deliberately no client message that names a dungeon: one would let any client ask for the generous loot table and bring the results back to the hub. Instance matching compares dungeon ids too, so walking into one entrance can never drop you into the other's run on timing alone. SimWorld.portals replaces portal_pos/portal_enabled, enter_instance carries the portal list and the dungeon id (the client needs the latter to scale the boss bar's ceiling the way the server scaled the boss), and Protocol.VERSION goes to 7. Also pins what happens when two players reach for one item on the same tick: exactly one gets it -- the loop is sequential and the pickup erases the entity before the next player looks. The tie-break is join order rather than distance, which is arbitrary rather than designed, so it is recorded as such. Stale doc fixed while here: MapGen.build() still claimed the client rebuilds the map from the seed, which has not been true since map streaming landed and is the opposite of the rule. check.sh clean, 288 tests, SMOKE PASS (18 assertions, both dungeon kinds opened over a real socket), all three diagnostics green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+23
-7
@@ -33,10 +33,10 @@ var events: Array[Dictionary] = []
|
||||
## unit test build a world without thinking about terrain.
|
||||
var map: MapGrid = null
|
||||
|
||||
## Set on a lobby world so the interact button can open a dungeon.
|
||||
var portal_enabled: bool = false
|
||||
## Where the hub's dungeon portal sits. Per-world now that maps vary in size.
|
||||
var portal_pos := Vector2.ZERO
|
||||
## Dungeon entrances standing in this world. Empty everywhere but the hub.
|
||||
## A list rather than a single position because which dungeon an entrance opens
|
||||
## is the whole reason there is more than one.
|
||||
var portals: Array[SimPortal] = []
|
||||
var spawn_point := Vector2(0.0, 240.0)
|
||||
## Arrival protection granted to players entering this world. 0 in the hub,
|
||||
## SimConfig.SPAWN_GRACE_TICKS in a dungeon.
|
||||
@@ -117,6 +117,20 @@ func spawn_boss(def: BossDef) -> SimBoss:
|
||||
return b
|
||||
|
||||
|
||||
## The portal [param at] is standing on, or null. Nearest wins, so two
|
||||
## entrances placed close enough to overlap still resolve to one answer instead
|
||||
## of to whichever happens to be first in the list.
|
||||
func portal_at(at: Vector2) -> SimPortal:
|
||||
var best: SimPortal = null
|
||||
var best_d := SimConfig.PORTAL_RADIUS * SimConfig.PORTAL_RADIUS
|
||||
for portal in portals:
|
||||
var d := at.distance_squared_to(portal.pos)
|
||||
if d <= best_d:
|
||||
best_d = d
|
||||
best = portal
|
||||
return best
|
||||
|
||||
|
||||
func alive_player_count() -> int:
|
||||
var n := 0
|
||||
for p in players.values():
|
||||
@@ -226,9 +240,11 @@ func _step_players() -> void:
|
||||
if edge & InputFrame.BTN_INTERACT:
|
||||
took_item = _try_pickup(p)
|
||||
|
||||
if portal_enabled and not took_item and frame.pressed(InputFrame.BTN_INTERACT):
|
||||
if p.pos.distance_to(portal_pos) <= SimConfig.PORTAL_RADIUS:
|
||||
events.append({"t": SimEvent.Type.PORTAL_USED, "peer": p.peer_id})
|
||||
if not took_item and frame.pressed(InputFrame.BTN_INTERACT):
|
||||
var portal := portal_at(p.pos)
|
||||
if portal != null:
|
||||
events.append({"t": SimEvent.Type.PORTAL_USED, "peer": p.peer_id,
|
||||
"dungeon": String(portal.dungeon)})
|
||||
|
||||
|
||||
## Pull the next input for this player, or coast on the last one. Coasting is
|
||||
|
||||
Reference in New Issue
Block a user