Worked out networking
Wasn't thinking straight with the initial approach
Basically:
- Each stratego program is running ONE AI program locally
-> That AI's responses need to be sent accross the network to the other stratego program
-> Each stratego program keeps state seperately and sends instructions to its local AI, so actual instructions (ie: "Its your turn") aren't sent
- A special controller is needed to recieve the responses
So we have NetworkSender, which wraps around an AI_Controller and simply sends its responses (exactly as they are) to the network
and NetworkReceiver which waits for responses from the network.
As far as networking itself is concerned, its not that important who is the Client and who is the Server.
If an IP address is specified, then Client is used, if no IP address is specified, Server is used.
NOTE: It isn't possible to use networking for both AI programs yet.
(ie: stratego @network @network) will fail when the Blue server attempts to bind the socket already used by the Red server.
I may consider fixing this at some point.
Going to test on mufasa.
I've just thought, if the stratego programs have different timeout sequences, there may be problems.
Oh well.
UCC git Repository :: git.ucc.asn.au