The Any API is quite interesting, it might be made to work.
Game state snapshots are usually generated at the end of a frame from scratch so that fits well.
There is one other bit of added complexity which is the client PVS (potentially visible set) filtering.
Essentially after building the state of the whole game the server filters it per client which has several benefits:
- greatly reduces bandwidth requirements (changes the client won't see don't get sent)
- reduces the ability to cheat (memory inspection or packet sniffing can't reveal information that is never sent)
I suppose this method can handle this case as well by zeroing out any objects excluded from the PVS on the server in the per client copy of the capnproto state object.
Why do you handle pointers differently?
Is it to allow for identical objects to show up at different positions in different capnproto snapshots?