[22:58] <Creator> Hello. Can someone explain me some thing about OpenApoc C++ code? [22:59] == Lightkey [~Darklock@p200300F693C9182322CF30FFFE083718.dip0.t-ipconnect.de] has joined #OpenApoc [22:59] <Creator> I want to improove AI. But I have a question. What is currently implemented and which functions are responsible for what? [23:00] <makus> Creator join to discord so you can speak there by voice (1 more discord advantage) [23:06] <@JonnyH> AI in what sense? There's 2 levels, the 'strategic' layer and the 'tactical' layer [23:06] <@JonnyH> IIRc the strategic layer doesn't really do much right now... [23:07] <@JonnyH> At least not a 'global' AI - vehicles and agents are given 'mission' queues, that might be the place to start for that [23:07] <@JonnyH> see /game/state/city/vehiclemission.cpp and /game/state/city/agentmission.cpp for those [23:08] <@JonnyH> for the tactical stuff see the /game/state/battle/ai folder [23:08] <@JonnyH> TBH we don't want it /too/ clever, for the most part verison 1.0 is designed to be as similar to the original as possible [23:08] <@JonnyH> so any 'new' ideas should be disable-able [23:09] <@JonnyH> I mean /completely/ new, clear improvements on vanilla behaviour is fine [23:09] <@JonnyH> and I'm not sure if all the systems are implemented yes - Istrebitel did most of the battle work [23:12] <Creator> Is agentmission.cpp responsible for battlescape? [23:13] <@JonnyH> agentmission.cpp is responsible for the specific movement of agents in the cityscape, not the battlescape [23:13] <@JonnyH> All of the battle stuff is in game/state/battle/ai [23:14] <Creator> ok [23:14] <@JonnyH> if you look much of that is non-implemented stubs though... so lots to improve [23:15] <Creator> Can you tell me which function is initial - which one starts thinking for vehicles and for battlescape units? [23:17] <Creator> I mean something like "AIUpdate" called in each frame. [23:18] <@JonnyH> in GameState::updatE() [23:19] <@JonnyH> you can see "Organisation::updateMissions()" get called on all organisations (that does the initial mission planning and things) [23:20] <@JonnyH> then just after that update() is called on all vehicles and agents, which is the call that performs the task for that 'tick' acording to their current mission (like 'goto place', 'shoot enemy' or whatever) [23:20] <@JonnyH> if that's what you're asking... [23:20] <Creator> As I understand it is for both vehicles in cityscape and units in battlesape. Right? [23:20] <@JonnyH> No, battlespace is different [23:21] <@JonnyH> in GameState::updatE() is calls Battle::update() if in a battle [23:22] <@JonnyH> that calls update() on all units, which does the per-unit already planned actions [23:22] <Creator> Okay. And the last question - which pathfinding algorythm do you use? Does it support weights for cells? [23:23] <@JonnyH> then AIBlockTactical::think() is called that does that does the 'global' AI and assigns plans [23:23] <@JonnyH> It uses a (rather inefficient) A* in TileMap::findShortestPath() [23:25] <Creator> Can I set weight matrix for it? [23:25] <@JonnyH> which can supports weights in the battlescape by using BattleUnitTileHelper::getDistance() [23:26] <@JonnyH> it's split into slightly different versions for a Battle, a generic TileMap (which is also used in the City), one for the city's roadmap... [23:27] <@JonnyH> and code to cope with 'group' moves [23:27] <Creator> My idea is to determine which cells are seen by the enemy and at which cells enemy can fire. Visible cells must be avoided (artifical wall must be created for pathfinding by raising weights in matix). [23:28] <@JonnyH> probably 'visibility' testing should be done by sending a ray throgh the LOS voxel blocks, not the pathfinding code as such [23:28] <Creator> Pathfinding is next step after visibility was determined. [23:29] <@JonnyH> and not sure if the ai discriminates between "Unknown" tiles, and tiles that have known scenery but no longer visible ("Fog of war" style) [23:29] <@JonnyH> Most of this is Istrebitels work, so my knowledge of this area isn't great [23:30] <Creator> Ok then. I'll ask him. [23:30] <@JonnyH> If he's around, he's been busy with other stuff recently... [23:30] <@JonnyH> Might be on discord/whatever more often though [23:30] == nadir [uid134094@gateway/web/irccloud.com/x-zndxjxwpzhvrljqo] has quit [Quit: Connection closed for inactivity] [23:30] <@JonnyH> The firewall here blocks all that, and discord is awful on linux... [23:31] <Creator> Thanks for information. Bye.