...
- In class ctgui.original.BoardWindow there is a responserequired method that handles special messages sent by the server. The command argument distinguishes the different types of messages. In the body of the method, the developer can implement custom functionality in BoardWindow or other UI classes (like TaskBar, BoardPanel, etc.).
- In the OnMessage method of ColoredTrailsClientImpl, you can call responserequired. The OnMessage method is for handling messages received by the client. If you want a particular UI operation after handling a message of a certain type, just add an appropriate call to responserequired at the end of reception.
- On the server side, you can use class ClientCommands to send messages. Making a call to sentChangeMessage sends a message of that type to the client. Just add a method in ClientCommands that calls sentChangeMessage.
- Finally, from the configuration file, call the method you created to communicate a message with your custom-made parameters to the client.
Handling messages from the client to the server follows a similar path.
Building a computer agent
The easiest way to build a computer agent is to inherit from class SimplePlayer, under edu.harvard.eecs.airg.coloredtrails.agent. Then you overload the following methods:
- phaseAdvanced to handle what the client needs to do when a phase begins (e.g., calculate the best path and move along it).
- onReceipt to handle discourse messages, like responding to a received offer (optional).
You can also add your own methods. Under edu.harvard.eecs.airg.coloredtrails.agent you can find many examples of proposer and responder types of agents that will help you understand how to build computer agents in CT.