Close three holes an unmodified client could walk through
One account is now one session. Two peers signed in as the same account each got their own player built from the SAME character record, so both held a copy of one bag and whichever wrote last won: drop the single potion from both copies and two potions hit the floor. Reconciling two live mirrors of one record cannot be made to work, so the handshake refuses the second connection -- the newcomer, not the incumbent, or claiming an account would be a way to kick anyone off the server. A muzzle offset is a teleport and the bullet pool never sees it: it samples geometry once per tick. Forward that is 19px, but Doubleshot adds up to 45px sideways, wider than a 32px wall plus the 6px hitbox holding you off it. Six Doubleshots, stand flush against a wall, fire along it, and live shots came out the far side. Shots now start from the shooter when geometry stands in the way, which keeps the count honest. Bullet-spawn events carry the firing actor's exact position, and they were filtered by a flat 2900-unit radius against an 800-unit actor cull. A depth-1 map's diagonal is about 2521, so that radius culled nothing: every enemy that fired was pinpointed for every player, through fog, on terrain the client was deliberately not streamed. The test is now per bullet -- can THIS one reach ground you can see -- which keeps the guarantee the wide radius existed for and drops the radar. Found while fixing the above: a rejection never reached the client. The RPC is queued and only leaves on the frame's flush, so kicking in the same call threw the reason away, and _on_server_disconnected overwrote last_error anyway. Both were true of protocol mismatch too, which is the one message a player most needs. Smoke asserts the reason arrives. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b8332b697d
commit
ef28970654
9 files changed
+357
-21
No files matched your search
+29
-4
@@ -177,7 +177,31 @@ func slide_circle(pos: Vector2, delta: Vector2, radius: float) -> Vector2:
|
||||
|
||||
## Bresenham-style sight test between two world points. Used for fog on the
|
||||
## client and for aggro on the server, so it has to agree on both.
|
||||
##
|
||||
## [param include_end] is false here: the endpoints themselves never block, so
|
||||
## standing in a doorway, or shooting at something embedded in a wall, still
|
||||
## resolves.
|
||||
func has_line_of_sight(from: Vector2, to: Vector2) -> bool:
|
||||
return _walk_clear(from, to, BLOCKS_SIGHT, false)
|
||||
|
||||
|
||||
## Whether a bullet could travel from [param from] to [param to] without
|
||||
## crossing geometry.
|
||||
##
|
||||
## Needed because a muzzle offset is a teleport: [BulletPool] samples position
|
||||
## once per tick and never sees the jump from a player's centre out to where the
|
||||
## shot is actually born, so anything that places a bullet away from its shooter
|
||||
## has to ask this first. Unlike sight, the DESTINATION counts -- a bullet born
|
||||
## inside a wall is exactly the case being ruled out.
|
||||
func bullet_path_clear(from: Vector2, to: Vector2) -> bool:
|
||||
return _walk_clear(from, to, BLOCKS_BULLET, true)
|
||||
|
||||
|
||||
## Shared Bresenham walk behind both tests above, so the two can never disagree
|
||||
## about which tiles a straight line crosses. [param flags] is one of the
|
||||
## BLOCKS_* tables; [param include_end] decides whether the destination tile is
|
||||
## allowed to stop the walk.
|
||||
func _walk_clear(from: Vector2, to: Vector2, flags: Array, include_end: bool) -> bool:
|
||||
var a := to_tile(from)
|
||||
var b := to_tile(to)
|
||||
var dx := absi(b.x - a.x)
|
||||
@@ -192,12 +216,13 @@ func has_line_of_sight(from: Vector2, to: Vector2) -> bool:
|
||||
var limit := width + height + 4
|
||||
while steps < limit:
|
||||
steps += 1
|
||||
if x == b.x and y == b.y:
|
||||
var at_end := x == b.x and y == b.y
|
||||
if at_end and not include_end:
|
||||
return true
|
||||
# The endpoints themselves never block: standing in a doorway, or
|
||||
# shooting at something embedded in a wall, must still resolve.
|
||||
if not (x == a.x and y == a.y) and blocks_sight(x, y):
|
||||
if not (x == a.x and y == a.y) and bool(flags[at(x, y)]):
|
||||
return false
|
||||
if at_end:
|
||||
return true
|
||||
var e2 := 2 * err
|
||||
if e2 >= dy:
|
||||
err += dy
|
||||
|
||||
Reference in new issue
Block a user