|
| Server (AIRegistry &aiRegistry, short port=10001, const std::string &hostname="0.0.0.0") |
|
bool | start () |
| Start to listen on the specified port.
|
|
bool | updateNode (const CharacterId &characterId, int32_t nodeId, const std::string &name, const std::string &type, const std::string &condition) |
| Update the specified node with the given values for the specified ICharacter and all the other characters that are using the same behaviour tree instance. More...
|
|
bool | addNode (const CharacterId &characterId, int32_t parentNodeId, const std::string &name, const std::string &type, const std::string &condition) |
| Add a new node with the given values to the specified ICharacter and all the other characters that are using the same behaviour tree instance. More...
|
|
bool | deleteNode (const CharacterId &characterId, int32_t nodeId) |
| Delete the specified node from the ICharacter's behaviour tree and all the other characters that are using the same behaviour tree instance. More...
|
|
void | addZone (Zone *zone) |
| Adds a new zone to this server instance that can be debugged. The server does not own this pointer so it also doesn't free it. Every Zone that is added here, will be part of the AINamesMessage. More...
|
|
void | removeZone (Zone *zone) |
| Removes a Zone from the server. After this call the given zone is no longer available for debugging purposes. More...
|
|
void | setDebug (const std::string &zoneName) |
| Activate the debugging for this particular zone. And disables the debugging for every other zone. More...
|
|
void | reset () |
| Resets the AI states.
|
|
void | select (const ClientId &clientId, const CharacterId &id) |
| Select a particular character (resp. AI instance) and send detail information to all the connected clients for this entity.
|
|
void | pause (const ClientId &clientId, bool pause) |
| Will pause/unpause the execution of the behaviour trees for all watched AI instances.
|
|
void | step (int64_t stepMillis=1L) |
| Performs one step of the AI in pause mode.
|
|
void | update (int64_t deltaTime) |
| call this to update the server - should get called somewhere from your game tick
|
|
|
void | resetSelection () |
|
void | addChildren (const TreeNodePtr &node, std::vector< AIStateNodeStatic > &out) const |
|
void | addChildren (const TreeNodePtr &node, AIStateNode &parent, const AIPtr &ai) const |
|
void | broadcastState (const Zone *zone) |
|
void | broadcastCharacterDetails (const Zone *zone) |
|
void | broadcastStaticCharacterDetails (const Zone *zone) |
|
void | onConnect (Client *client) override |
|
void | onDisconnect (Client *client) override |
|
void | handleEvents (Zone *zone, bool pauseState) |
|
void | enqueueEvent (const Event &event) |
|
The server can serialize the state of the AI and broadcast it to all connected clients.
If you start a server, you can add the AI instances to it by calling addZone(). If you do so, make sure to remove it when you remove that particular Zone instance from your world. You should not do that from different threads. The server should only be managed from one thread.
The server will broadcast the world state - that is: It will send out an AIStateMessage to all connected clients. If someone selected a particular AI instance by sending AISelectMessage to the server, it will also broadcast an AICharacterDetailsMessage to all connected clients.
You can only debug one Zone at the same time. The debugging session is shared between all connected clients.