Jump to content


Photo

Please don't hack files like this


9 replies to this topic

#1 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 18 January 2005 - 07:11 PM

Thud changed cost = cost + 250 to cost = cost + 0

a.) If he really intended to make this function useless I would suggest to comment its call and write some comment for the reason instead of this hack. Corsix is basing his changes on this file too.

b.) The comment says it should add 150 instead of 250 as coded in the original.
Why not try this value ?

c.) I don't think Thuds change is of any help. Even worse it might be bad if you take a closer look at what this function is used for.

--utility function used to account for defensive buildings
function CpuManager:GetDefensiveBuildingsCostAt( player, pos, tolerance )

	profile_start( "GetDefensiveCost" )
	local cost = 0
	
	local tolerance_sqr = tolerance*tolerance
	--for every defensive building in range, add 150
	for building in player:GetBuildingsWithGuns() do
	
  if distance_sqr( building:GetPosition(), pos ) < tolerance_sqr then
 	 cost = cost + 0
  end
	
	end

	profile_end( "GetDefensiveCost" )
	return cost
	
end


#2 Grey

Grey
  • Members
  • 29 posts
  • Location:Ã…rhus C, Denmark

Posted 18 January 2005 - 08:00 PM

Maybe it was a typo.
Or an experiment.
None of these files are to be released yet anyway.

#3 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 18 January 2005 - 08:29 PM

I justed wanted to point to the problem that the codebase may already be spoiled. Its very important that changes are well documented at least. Using a version control system like subversion may be usefull and steps must be taken before it will get chaotic.

#4 Corsix

Corsix

    Code Monkey

  • Hosted
  • 290 posts
  • Location:Berkeley, UK
  • Projects:DoW AI, DoW Mod Studio
  •  Blue Text :)

Posted 18 January 2005 - 08:34 PM

A) All I did to the file was add an import statement at the very top

B) My editing conventions would have prevented this
Posted Image

#5 Grey

Grey
  • Members
  • 29 posts
  • Location:Ã…rhus C, Denmark

Posted 18 January 2005 - 09:06 PM

But thx for pointing it out Larkin.

Guess we need a little of the old "if its not broke, dont fix it"-rule. ;)

But seriously we need to have that AI debug output working...

#6 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 18 January 2005 - 09:27 PM

AI debug output is working.

Set self.debug = true and add ailog() like this and you will get all text displayed on screen in a logfile. Add ailog() at other locations of the code as needed.

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
 ailog("d:\\aidebug.log", text)

end


#7 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 18 January 2005 - 09:42 PM

Note that I didn't want to critizise thuds initial efforts at all.

#8 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 18 January 2005 - 11:11 PM

No probs LarkinVB.. I'm glad to see there is debate! Yes that value was changed and not documented although its the only one. I left it as when I changed it I saw no difference although I believe to effect the way the AI values defensive buildings and thus a higher value the more it will not assault near to enemy ones.

Btw, as mentioned on Relic forums, the above self.debug file dump gives me a AI Execution error. Need to figure out what gives?
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#9 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 18 January 2005 - 11:22 PM

Of course you have to add this in utility.ai too :

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


#10 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 18 January 2005 - 11:30 PM

Finally! Working like a charm! Beautiful! Now I can check major crashes with this! Thanks guys! Should be a tut/wiki for advanced AI troubleshooting!
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



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users