hoijui wrote:wow, NICE! :D
good luck wiht that one, i like this approach. i am ready to answer questions if i might be of help, though it seems you do not need that. i can't dedicate a mentionable ammount of time to the project though.
ride on!
As always, I'd be very grateful if someone could take awk part as it is required in this case is well (although in significantly less occasions).
For instance class like following should be created as actual implementation for callback (this is the only part of code that should be created by a coder)
Code: Select all
class CallbackFromHandler : virtual public CallbackFromIf
{
int32_t Engine_handleCommand(const int32_t skirmishAIId, const int32_t toId, const int32_t commandId, const int32_t commandTopic, const std::string& commandData) {
// Your implementation goes here
printf("Engine_handleCommand\n");
}
void Engine_Version_getMajor(std::string& _return, const int32_t skirmishAIId) {
// Your implementation goes here
printf("Engine_Version_getMajor\n");
}
};
So instead of "// Your implementation goes here" there should be a corresponding callback-> call.
gajop wrote:I don't know much about Apache Thrift, but RPC sounds interesting. The data seems to be able to be sent both ways and it should be synced, i.e those RPC calls are blocking, right?
Exactly call to external lib and vise versa blocks execution until code returns.
gajop wrote:Btw, you seem to mention that spring wouldn't be affected that skirmish AI got terminated. That's actually not a bad thing at all, AI crashes/slowdowns shouldn't interfering with the engine. This may be a way to prevent those (sure, java/c# with proper error handling does that as well...)
Good point. I'm working with Thrift only few days, so I'm kind of noob to this lib. Anyway, the way it works now is that if Skirmish gets crashed it raises lots of Exceptions from the lib. I don't know what degree of control Thrift's coder has to handle those Exceptions, how well it's designed to reestablish the connection and restore the AI status...
Yes, the approach is probably the same, however few years back it was able to send out only the basic commands, no pathfinding, etc...
gajop wrote:
Regarding skirmish AI crash detection, wouldn't it be possible to do that with checks on the method return values? Or simply request each AI to send an "i'm alive" package each frame/couple of frames.
I was thinking about ping command, however now I don't see it bringing a big value: either remote call returns or Exception is thrown. But the idea to do some actions every N frames is actually very useful as in case of crash, when restart is required it's quite slow to check if connection has again become available every frame, rather this should be done once a second or smth.
danil_kalina wrote:We are using Protocol Buffer for transmitting data through TCP-IP in our job projects.
ProtoBufs are actually execellent lib, very mature and very-very well documented. Thrift dramatically loses in these criteria. The reason I still choose Thrift is that, it provided in-house RPC for many languages, while in ProtoBuf world RPC implementations are made by 3rd parties and no single solution covers majority of languages.