Jump to content


Photo

print(), aitrace() and what not...


3 replies to this topic

#1 kreative

kreative
  • Members
  • 27 posts

Posted 28 January 2005 - 03:46 PM

Has anyone been able to implement some feedback onscreen while testing the ai?
I noticed the topic abobout aitrace, but that just left me with a nice "ai fatal error" and crashed the game....

I've been working a bit on the ai, and it's going quite well, but I would really need some way to debug it. So that I can se what the ai does.
Iv'e noticed there's a print() function several places in the ai code but I can't seem to "activate" it.

Any help on the matter would be greatly appreciated.

Regards,
kreative

#2 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 28 January 2005 - 06:48 PM

Kreative! Wow.. man.. nice seeing ya drop by! Hows the AI total re-code going? How far are you through it?

Btw, you've seen this thread right?

http://forums.revora...showtopic=16053

Further, are you talking about getting an aidebug.log dump of the AI's functions as your playing a game?

Essentially it looks like this:

File: cpu_manager.ai
self.debug = false
Set this to True

File: cpu_manager.ai
function CpuManager:Print( x, y, text )
	
	-- the selected color of the text:
	local colour = {255,255,192}
	
	dr_text2d( "aidebug"..self.player_id, x, y, text, colour[1], colour[2], colour[3] )

        -- log debug output to file (turn self.debug=true to activate!)
        ailog("e:\\aidebug.log", text)

	
end
Add the above near the same location. Change the "e:\\" to whatever location you want to save the .log file as it writes to the drive.

Finally, add this too to utility.ai:
--AI log dump to text file (activate in cpu_manager.ai when self.debug = true)
function ailog( logfile, msg ) 
  local log log = io.open( logfile , "a+" ) 
  if player_id == nil then 
     log:write("AI"," ", tostring(msg) , "\n") 
  else 
     log:write("AI"..player_id," ", tostring(msg) , "\n") 
  end 

  log:close() 

 end

As mentioned in the above link, Larkin is able to take it a step further and get to record a timeline so one can tweak based on a time reference.

Edited by thudo, 28 January 2005 - 06:49 PM.

Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#3 kreative

kreative
  • Members
  • 27 posts

Posted 29 January 2005 - 08:42 AM

I tried the steps provided with aitrace, but I just get a fatal error.
What I do now is just play with an ally and keep an eye on his moves.

The project is going quite well now though, but I still need to set some new rules since I'm basing my AI on my mod.

However, I hope to create it in such a way that others will test it aswell.

#4 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 29 January 2005 - 10:49 PM

Please keep us informed, kreative. Since early Jan I've been totally entralled by your work to fully and completely re-write DoW's LUA AI structure. Looking so forward to seeing how you can make it far more readable than what it currently is.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!



Reply to this topic



  


2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users