Home » MODDING HQ 1.13 » v1.13 Coding Talk » Learning how the tactical AI works
Re: Learning how the AI works[message #274360]
|
Wed, 23 February 2011 21:13
|
|
MorgluM |
|
Messages:24
Registered:March 2004 Location: Qu |
|
|
Buns
Just received my teacher's comment for my master -- looks like I can't procrastinate anymore today.
I'd love to see if I can implement that.
I'm slowly becoming functional. I've installed Visual Studio 2010, and I compiled the "solution" for the latest SVN downloaded with Tortoise.
It runs and the file is called JA2-ENG-DEBUG.EXE. So I assume I compiled the WIN32 DEBUG and not the WIN32 RELEASE version by default, which is great.
Question to coders: When I start JA2-ENG-DEBUG.EXE, it creates a file named AIDEBUG.TXT ("AI DEBUG") in the JA2 program files folder. For some reason it remains empty of text when I play the game. Any reason why?
(some meat that help to answer):
I manually added some text to the AIDEBUG.TXT file and that file was removed (probably by the InitAI method, partially shown below)
I guess this means that "#ifdef JA2TESTVERSION" (from InitAI) is true but "#ifdef DEBUGDECISIONS" (from DecideAction) isnt. I'll dig a bit further to understand what #ifdef means...
here's the code for the DebugAI method, which is called a lot by the DecideAction, but only if "#ifdef DEBUGDECISIONS" is true... any idea how to set it on?
void DebugAI( STR szOutput )
{
#ifdef DEBUGDECISIONS
// Send regular debug msg AND AI debug message
FILE * DebugFile;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, szOutput );
if ((DebugFile = fopen( "aidebug.txt", "a+t" )) != NULL)
{
fputs( szOutput, DebugFile );
fputs( "
", DebugFile );
fclose( DebugFile );
}
else {ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Debug: AIDEBUG.TXT = NULL" );} // SIMON
#endif
}
Here's the beginning of the InitAI method:
BOOLEAN InitAI( void )
{
#ifdef JA2TESTVERSION
FILE * DebugFile;
#endif
#ifdef _DEBUG
if (gfDisplayCoverValues)
{
//memset( gsCoverValue, 0x7F, sizeof( INT16 ) * WORLD_MAX );
}
#endif
//If we are not loading a saved game ( if we are, this has already been called )
if( !( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) )
{
//init the panic system
InitPanicSystem();
}
#ifdef JA2TESTVERSION
// Clear the AI debug txt file to prevent it from getting huge
if ((DebugFile = fopen( "aidebug.txt", "w" )) != NULL)
{
fputs( "
", DebugFile );
fclose( DebugFile );
}
#endif
some code in the DecideAction method:
#ifdef DEBUGDECISIONS
sprintf( tempstr,"DecideAction: selected action %d, actionData %d
",bAction,pSoldier->aiData.usActionData);
DebugAI( tempstr );
#endif
[Updated on: Wed, 23 February 2011 21:23] by Moderator Report message to a moderator
|
Private 1st Class
|
|
|
|
|
Learning how the tactical AI works
By: MorgluM on Tue, 22 February 2011 07:54
|
|
|
Re: Learning how the AI works
|
|
|
Re: Learning how the AI works
By: MorgluM on Tue, 22 February 2011 15:30
|
|
|
Re: Learning how the AI works
|
|
|
Re: Learning how the AI works
By: MorgluM on Tue, 22 February 2011 15:57
|
|
|
Re: Learning how the AI works
|
|
|
Re: Learning how the AI works
By: MorgluM on Tue, 22 February 2011 20:03
|
|
|
Re: Learning how the AI works
By: Buns on Wed, 23 February 2011 15:59
|
|
|
Re: Learning how the AI works
By: MorgluM on Wed, 23 February 2011 17:34
|
|
|
Re: Learning how the AI works
By: MorgluM on Wed, 23 February 2011 17:36
|
|
|
Re: Learning how the AI works
By: Buns on Wed, 23 February 2011 18:24
|
|
|
Re: Learning how the AI works
By: MorgluM on Wed, 23 February 2011 21:13
|
|
|
Re: Learning how the AI works
By: JMich on Wed, 23 February 2011 21:27
|
|
|
Re: Learning how the AI works
By: MorgluM on Wed, 23 February 2011 21:32
|
|
|
Re: Learning how the AI works
By: MorgluM on Wed, 23 February 2011 21:42
|
|
|
Re: Learning how the AI works
By: MorgluM on Wed, 23 February 2011 21:57
|
|
|
Re: Learning how the AI works
By: MorgluM on Thu, 24 February 2011 01:22
|
|
|
Re: Learning how the AI works
By: MorgluM on Thu, 24 February 2011 23:27
|
|
|
Re: Learning how the AI works
By: JMich on Thu, 24 February 2011 23:41
|
|
|
Re: Learning how the AI works
By: tais on Fri, 25 February 2011 00:07
|
|
|
Re: Learning how the AI works
By: MorgluM on Fri, 25 February 2011 06:02
|
|
|
Re: Learning how the AI works
By: MorgluM on Fri, 25 February 2011 06:09
|
|
|
Re: Learning how the AI works
By: JMich on Fri, 25 February 2011 09:05
|
|
|
Re: Learning how the AI works
By: MorgluM on Tue, 01 March 2011 20:08
|
|
|
Re: Learning how the AI works
By: Buns on Tue, 08 March 2011 17:26
|
|
|
Re: Learning how the AI works
By: JMich on Tue, 08 March 2011 17:47
|
|
|
Re: Learning how the AI works
By: Buns on Tue, 08 March 2011 19:39
|
|
|
Re: Learning how the AI works
By: JMich on Tue, 08 March 2011 20:13
|
|
|
Re: Learning how the AI works
By: Buns on Wed, 09 March 2011 14:51
|
|
|
Re: Learning how the AI works
By: JMich on Wed, 09 March 2011 16:05
|
|
|
Re: Learning how the AI works
By: Buns on Wed, 09 March 2011 17:34
|
|
|
Re: Learning how the AI works
By: SharkD on Sun, 20 March 2011 14:57
|
|
|
Re: Learning how the AI works
By: Buns on Sun, 20 March 2011 15:19
|
|
|
Re: Learning how the AI works
By: SharkD on Tue, 22 March 2011 03:08
|
|
|
Re: Learning how the AI works
By: Buns on Tue, 22 March 2011 14:53
|
|
|
Re: Learning how the AI works
By: MorgluM on Wed, 06 April 2011 01:45
|
|
|
Re: Learning how the AI works
By: JMich on Wed, 06 April 2011 10:39
|
|
|
Semi-Success , and question re: working directory
By: MorgluM on Thu, 07 April 2011 15:26
|
|
|
Re: Semi-Success , and question re: working directory
By: JMich on Thu, 07 April 2011 16:29
|
|
|
Re: Semi-Success , and question re: working directory
By: MorgluM on Fri, 08 April 2011 00:46
|
|
|
Re: Semi-Success , and question re: working directory
|
|
|
Re: Semi-Success , and question re: working directory
By: MorgluM on Fri, 08 April 2011 02:28
|
|
|
Re: Semi-Success , and question re: working directory
By: MorgluM on Fri, 08 April 2011 03:06
|
Goto Forum:
Current Time: Sat Feb 15 01:00:40 GMT+2 2025
Total time taken to generate the page: 0.01649 seconds
|