Development > Newbie Coding

Artificial Intelligence

<< < (9/11) > >>

Leviathan:
I will give it some thought.  I am still learning that part of how the AI behaves.

ShipIt:
Nice first step would be to see aliens using their granades again.

DarkRain:
Actually aliens already use grenades.... in the (very rare) cases when they decide to come into throwing range, it's usually the first thing they'll do (even against single targets) because it maxes the expected damage

Harkhanam:
Hello, I'm trying to dig in the AI code. Originally created a new topic but this one is good enough :p

It's been a long time since I coded in C++ and I'm a little bit confused about a function call.


--- Code: ---g_ai.cpp AI_PrepBestAction(...)
[...]
G_ActorMoveLength(...)
=>  g_move.cpp G_ActorMoveLength(...)
= = > const pos_t length = gi.MoveLength(path, to, crouchingState, stored);

--- End code ---

I can't find what is "gi" nor any "MoveLength" function in the source.

I'm trying to figure out which case create the "null or "ROUTING_NOT_REACHABLE" returns.
more specifically, I want to make sure the code doesn't discard the current position of an alien while looking for a best action : I read somewhere they were discarding position already occupied, and I want to check if this include his own position.

I'm using the 2.5 source code provided with the downloaded game from the site.

The general goal is to get familiar enough with the AI code to fix some weird behavior, no revolution yet.

DarkRain:
Hi Harkhanam, welcome to the forum

Lets see: gi is the game import (see sv_game.cpp: SV_InitGameProgs()) you will find the implementation you are looking for at: grid.cpp: Grid_MoveLength(), as for ROUTING_NOT_REACHABLE it is returned only when there aren't ehough TUs to move to that position or if the position is blocked (the actor for which the move table was calculated is skipped in when checking for obstructions)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version