Networking N2–N6, and a fully C-free toolchain
Implement the rest of NETWORKING-DESIGN.md (N2–N6) and eliminate every
`.c` file from the repo. clang remains only the LLVM-IR assembler; no C
is compiled anywhere.
Networking (selfhost/emit_net.ludic + parser/emit changes):
- N2 @Sync: per-model serialize/apply + by-kind dispatchers; POD-scalar
compile error and empty-participation warning; selective replication.
- N3 @Owned: @L_owner array + owner/set_owner/is_owner; owners snapshot.
- N4 @ToServer/@ToClients remote events: framed net_send + net_pump re-emit.
- N5 @Server/@Predicted role guards + drivable sim (tick_fixed/tick_render,
entry-owns-the-loop).
- Built-in loopback transport so multiplayer runs with zero foreign code;
extern fn net_send/net_poll still overrides it for a real socket.
- N6 blessed runtime (examples/net_rt.ludic) + end-to-end demo (net_demo).
- Fix: llty("entity") is now i32 (entities are i32 handles), so let e = self().
C elimination:
- Networking + foreign-mod-ABI tests rewritten as self-contained pure-Ludic
programs (examples/net_*, world_*, mod_events, scoped); tests/ removed.
- Reflection ABI exposed to Ludic as world_* builtins (Ludic-to-Ludic modding).
- Formatter rewritten C→Ludic: tools/ludic-tools/fmt.ludic.
- Language server rewritten C→Ludic: tools/ludic-tools/lsp.ludic (lexer, index
parser, cross-file workspace resolver, JSON, all LSP handlers).
- Obsolete migrate_*.c codemods deleted; ludic_syntax.h kept as vocabulary data.
Suites: ./test.sh 44/44, ./tools/test-tools.sh 28/28 (LSP 42/42), fixpoint holds.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
96d01e45ab
commit
bca8f126fc
67 changed files with 24066 additions and 9309 deletions
33
examples/net_roles.ludic
Normal file
33
examples/net_roles.ludic
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# net_roles.ludic — N5: handler roles + the drivable sim (NETWORKING-DESIGN §6.2,
|
||||
# §5, §13 N5).
|
||||
#
|
||||
# A handler's network role is a declarative annotation, never a runtime branch in
|
||||
# ordinary code:
|
||||
# (unmarked) runs on every peer — the shared, deterministic simulation
|
||||
# @Server runs only on the authority (clients get the result via @Sync)
|
||||
# @Predicted runs on the owning client and the server (auto-reconciled)
|
||||
# The runtime sets the peer's role register (set_role); offline it defaults to
|
||||
# server, so guards collapse to "run here" and a non-networked build is unchanged.
|
||||
#
|
||||
# The per-frame phases are also exposed as callables — tick_fixed() runs the sim
|
||||
# phases — so this game owns its own loop via `entry` (for prediction/rollback,
|
||||
# replay, headless tests). Acting as a client then the server: 1, then 102.
|
||||
program NetRoles {
|
||||
property Score { n: int = 0 }
|
||||
model Board { Score }
|
||||
|
||||
handler Both phase Update { for (Score) in query [Score] { Score.n = Score.n + 1 } } # runs everywhere
|
||||
@Server handler ServerOnly phase Update { for (Score) in query [Score] { Score.n = Score.n + 100 } } # authority only
|
||||
|
||||
entry {
|
||||
spawn Board { Score { n: 0 } }
|
||||
|
||||
set_role(0) # act as a client
|
||||
tick_fixed() # Both(+1); ServerOnly skipped
|
||||
for (Score) in query [Score] { print(Score.n) } # 1
|
||||
|
||||
set_role(1) # act as the server
|
||||
tick_fixed() # Both(+1) + ServerOnly(+100)
|
||||
for (Score) in query [Score] { print(Score.n) } # 102
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue