Hey,
I now have the AI modularization branch so far, that its usable and working.
The best new thing is dynamic loading of the chosen AI implementation via a dynamic library.
This means I can change the AI code, click into my freespace window, select restart mission and its starting with my new AI :-). (under linux that is, under windows, you'd probably need to change the name in the AI Profile as well)
A new AI implementation that is just hooking into the init_ship_info function could look like:
#include "ai/aibig.h"
#include "ai/aigoals.h"
#include "ai/aiinternal.h"
struct aicode_call_table AICodeNewAITable;
void newai_aicode_init_ship_info()
{
fprintf(stderr, "Init ship info was called\n");
AICodeDefaultTable.init_ship_info();
}
extern "C" {
void ai_module_init();
}
void ai_module_init()
{
fprintf(stderr, "ai_module_init() called\n");
// First make a copy
memcpy(&AICodeNewAITable, &AICodeDefaultTable, sizeof(AICodeNewAITable));
// Now set up our overridden functions
aicode_table = &AICodeNewAITable;
aicode_table->init_ship_info=newai_aicode_init_ship_info;
}
I will probably change the ai_module_init later to be <dllname>_ai_module_init, because like that you could also compile a static version into the binary and use that if no library is available.
AND theproblem with wingmen ignoring friendly ships in-between them and their target?
Anyway, I also looked into this AI behavior and at least when they are standing still the AI is never ever firing on a "same team" ship. It always chooses a vector, which is not hitting a friendly ship.
Are there other AI related issues at hand known?
Best Wishes,
Fabian