Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My AI Thesis
03-08-2010, 11:57 AM,
#2
 
Hi Antonio,
Your proposal sounds awesome! Big Grin

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()
Code:
ai.clear_cars();

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.
Reply


Messages In This Thread
My AI Thesis - by fresbeeplayer - 03-07-2010, 10:49 PM
[No subject] - by NaN - 03-08-2010, 11:57 AM
[No subject] - by fresbeeplayer - 03-08-2010, 04:33 PM
Re: My AI Thesis - by joevenzon_phpbb2_import3 - 03-08-2010, 11:18 PM
[No subject] - by fresbeeplayer - 04-23-2010, 07:01 PM
[No subject] - by NaN - 04-24-2010, 02:29 AM
[No subject] - by fresbeeplayer - 04-24-2010, 06:19 AM
[No subject] - by NaN - 04-24-2010, 07:03 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)