- runtime: HEADLESS_FRAME_PATH, STICK_DEADZONE / STICK_LEFT_X/Y, key and byte codes as char literals throughout (`k == 'w'`, `fill(rt_map, ' ', …)`) - ludic.gameplay/stats: drop the duplicate `stat_field` (it answered "atk" for every build stat); Stats.base uses stats_field_name - ludic.shooter: compare aim modes and fire patterns with AimMode.* and WeaponPattern.* instead of raw ints; STICK_RIGHT_X/Y - ludic.npcai: DecisionMade / brain_set_state use AiState.* - examples/games/menu.ludic uses Font.load / Ui.* with FONT_PATH and BACKDROP named; strings.ludic header says what it prints - whole tree: `x = x + 1` → `x += 1` (single-term right-hand sides only), `0 - x` → `-x`, ASCII codes → char literals; every .ludic and every ```ludic fence reformatted with the fixed formatter (whitespace only) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
24 lines
969 B
Text
24 lines
969 B
Text
# net_echo.ludic — N0: the transport seam (NETWORKING-DESIGN §5, §13 N0).
|
|
#
|
|
# The transport is two calls — net_send puts a datagram on the wire, net_poll
|
|
# takes the next one off. A production build binds them to a real socket with
|
|
# `extern fn net_send/net_poll` (UDP native, WebRTC/WebSocket wasm); absent that,
|
|
# the compiler supplies a built-in in-process loopback, so a program is networked
|
|
# end to end with NO foreign host — pure Ludic. This sends four bytes and polls
|
|
# them back through the loopback: prints 4, then 10 20 30 42.
|
|
program NetEcho {
|
|
entry {
|
|
let out = bytes(4)
|
|
out[0] = '\n'
|
|
out[1] = 20
|
|
out[2] = 30
|
|
out[3] = '*'
|
|
net_send(0, out, 4) # onto the wire (the built-in loopback)
|
|
|
|
let inb = bytes(64)
|
|
let n = net_poll(inb, 64) # take the next datagram back off
|
|
print(n) # 4
|
|
var i = 0
|
|
while i < n { print(inb[i]); i += 1 } # 10 20 30 42
|
|
}
|
|
}
|