@spratt I could really use your help on working out the future details on this will work.
Current plan:
Host creates calls Router.getHost(port);
Host calls router.start(); //necessary? could be done in static method
HostRouter loops infinitely waiting for clients
Host calls router.startGame
HostRouter loads in all the JSON and creates entire model
HostRouter sends to clients:
{
cards: <as seen in cards.json>
wonders: <as seen in wonderlist.json>
players: {
<player id>: <wondername_wonderside>
<player id>: <wondername_wonderside>
...
}
deck: [
[<cardname_age_minplayers>,<cardname_age_minplayers>,...]
[<cardname_age_minplayers>,...]
[<cardname_age_minplayers>,...]
]
localPlayer: <player id of player this client has> <-- note this is the only unique data in this whole blob, might be worth sending as a separate message for this reason
}
ClientRouter gets this message and responds with "ok" once it's handled parsing that all
HostRouter broadcasts to all ClientRouters to "takeTurn"
HostRouter runs its own model
ClientRouters run their model
ClientRouters tell HostRouter:
{<player_id>: <playercommand>}
when HostRouter has all PlayerCommands, broadcasts:
Clarification: moreso requesting help in the actual implementation of this, as I'm having trouble thinking in terms of multi-threaded networking at the moment.
@spratt I could really use your help on working out the future details on this will work.
Current plan: