Agon wrote:Back to the interface redesigning. How is the progress? What is missing to discuss and what needs to be implemented?
yeah, we all agreed on the same for the D-Bus thing about 6 posts ago already, no need to go on with that :D
i am coding right now. the callback has a lot of functions, and as there will be a separate function for each part of UnitDef, WeaponDef, FeatureDef and the structs in there too, it will take some time till i did all this.
a question...
i have this:
Code: Select all
struct SAIFloat3 {
float x, y, z;
}
how should i convert float3 <-> SAIFloat?
Code: Select all
float3 f3;
SAIFloat3 aif3;
f3 = reinterpret_cast<float3>(aif3);
aif3 = reinterpret_cast<SAIFloat3>(f3);
is this correct? or should it be functions like this:
Code: Select all
float3 SAIFloat3_to_float3(SAIFloat3 aif3) {
float3 f3;
f3.x = aif3.x;
f3.y = aif3.y;
f3.z = aif3.z;
return f3;
}
SAIFloat3 SAIFloat3_to_float3(float3 f3) {
SAIFloat3 aif3;
aif3.x = f3.x;
aif3.y = f3.y;
aif3.z = f3.z;
return aif3;
}
or what else?
left to discuss, are currently the individual functions of the callback, as i see it. of course, the wrapped C++ function will have to look exactly equal to the current one, but we have the possibility to change the C one to be a bit nicer. i am thinking mainly about these functions:
Code: Select all
int (*getCurrentFrame)(int teamId);
bool (*getProperty)(int teamId, int id, int property, void* dst);
bool (*getValue)(int teamId, int id, void* dst);
int (*getFileSize)(int teamId, const char* fileName);
Code: Select all
bool (*readFile)(int teamId, const char* name, void* buffer, int bufferLen);
void* (*createSharedMemArea)(int teamId, char* name, int size);
void (*releasedSharedMemArea)(int teamId, char* name);
in the C interface, we get the frame through the Update event, so there is practically no need to call back to the engine with getCurrentFrame(), and as the C interface is new, ther is no need to have that function. would you keep it?
getProperty() and getValue() are meant for future callback extensions, but i think are not currently used at all. i think they make no sense at all (in the C interface), as the C callback with functions we currently have, can be extended with normal functions without breaking compatibility with old AIs, right?
getFileSize() and readFile(). i guess there is a reason for this (why it should not be done by the AI directly), but i don't know it. can somebody explain?
and of course the createSharedMemArea() and releasedSharedMemArea(), which we started to discuss before. i was the last one who gave some arguments, an after that, nobody commented anymore. in short: it is an unused low level (and as i think complicated and insecure, and for other languages unpractical) way for AI<->AI interaction (eg, the AIs could keep Metal-Spot-Location Cache in a shared area, to speed up overall AI loading and save memory). as we plan to have an event based AI<->AI communication anyway, i though we could get rid of that now, in the C interface (possibly in the C++ one too, some when).