Hi Antonio,
Your proposal sounds awesome!
1.
I haven't looked much into AI yet. But it looks like ai.h/ai.cpp are implementing the game AI. I don't think we've got a bot interface.
2.
in GAME::NewGame(bool playreplay, bool addopponents, int num_laps)
Code:
//load AI cars
if (addopponents)
{
int carcount = 1;
for (std::vector <std::pair<std::string, std::string> >::iterator i = opponents.begin(); i != opponents.end(); ++i)
{
//int startplace = std::min(carcount, track.GetNumStartPositions()-1);
int startplace = carcount;
if (!LoadCar(i->first, i->second, track.GetStart(startplace).first, track.GetStart(startplace).second, false, true))
return false;
ai.add_car(&cars.back(), settings.GetAIDifficulty());
carcount++;
}
}
in GAME::UpdateCarInputs(CAR & car)
Code:
carinputs = ai.GetInputs(&car);
in GAME::AdvanceGameLogic()
Code:
ai.Visualize(rootnode);
ai.update(TickPeriod(), &track, cars);
in GAME::LeaveGame()
3.
I hope Joe can comment on this one. The most simple/lazy way would be to hack the MainLoop I guess.
Code:
///the main game loop
void GAME::MainLoop()
{
while (!eventsystem.GetQuit() && (!benchmode || replay.GetPlaying()))
{
CalculateFPS();
clocktime += eventsystem.Get_dt();
eventsystem.BeginFrame();
Tick(eventsystem.Get_dt()); //do CPU intensive stuff in parallel with the GPU
gui.Update(eventsystem.Get_dt());
FinishDraw(); //sync CPU and GPU (flip the page)
BeginDraw();
eventsystem.EndFrame();
PROFILER.endCycle();
displayframe++;
}
}
PS: Please feel free to ask Joe for SVN access. I would love to see an AI branch.