Jump to content


Photo

Random % LPs/Turrets upgraded


28 replies to this topic

#1 Corsix

Corsix

    Code Monkey

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

Posted 17 January 2005 - 08:39 PM

How to setup the space marines so that they upgrade a random percent of their LPs and turrets to anti-vechicle.

----------------------------------------
-- File: 'ai/strategies/marinebuildbasestrategy.ai'
-- Edited by Thudmeizer @ 01.01.2005
-- Edited by Corsix     @ 15.01.2005
Changed/added functions:
function MarineBuildBaseStrategy:__init( baseinfo ) super( baseinfo )

	--self.armoury_id = cpu_manager.stats:GetBuildingID( "space_marine_armoury" )
	--self.armoury_name = "space_marine_armoury"
	
	self.generator_name = "space_marine_generator"
	self.bigger_generator_id = cpu_manager.stats:GetBuildingID( "space_marine_thermo_generator" )
	
	self.vehicle_building_id = cpu_manager.stats:GetBuildingID( "space_marine_vehicle_building" )
	self.vehicle_building_name = "space_marine_vehicle_building"
	
	self.barracks_id = cpu_manager.stats:GetBuildingID( "space_marine_barracks" )
	self.barracks_name = "space_marine_barracks"
	
	self.post_addon_id = cpu_manager.stats:GetAddOnID( "space_marine_list_post_addon_1" )
        self.post_addon_2_id = cpu_manager.stats:GetAddOnID( "space_marine_list_post_addon_2" )	

        self.turret_id = cpu_manager.stats:GetBuildingID( "space_marine_turret_bolter" )
        self.turret_name = "space_marine_turret_bolter"
        self.turret_addon_2_id = cpu_manager.stats:GetAddOnID( "space_marine_turret_addon" )
	
	self.hq_addon_1_id = cpu_manager.stats:GetAddOnID( "space_marine_hq_addon_1" )
        self.hq_addon_2_id = cpu_manager.stats:GetAddOnID( "space_marine_hq_addon_2" )
	
	self.max_weapons_research_name = "marine_max_weapons_research"
	self.max_weapons_research_id = cpu_manager.stats:GetResearchID( self.max_weapons_research_name )
	
  --Corsix Added
  self.post_id = cpu_manager.stats:GetBuildingID( "space_marine_listening_post" )
  self.percent_turr_upgraded = math.random(55,75)
  self.percent_post_upgraded = math.random(55,75)
  self.upgraded_posts = {}
  self.upgraded_turrets = {}
  --End
	
end

function MarineBuildBaseStrategy:DoUpgradesAndAddons()

	if cpu_manager.cpu_player:IsResearchComplete( "squad_cap_research" ) then

  local id = self.post_addon_id
  if( self:PlanExists("Build AddOn Plan", id) == false ) then 
 	 self.AddPlan( self, BuildAddOnPlan( id ) )
          end
       
        if not cpu_manager.cpu_player:IsResearchComplete( self.max_weapons_research_name ) then
 	 local id = self.max_weapons_research_id
 	 if( self:PlanExists("Build Research Plan", id) == false ) then 
    self.AddPlan( self, BuildResearchPlan( id ) )
                      
                      --don't build other research items
                      return true 	 

                        end
                  end


	if self:IsInSecondTier() then
	
  --Corsix Added
  local num_turr = 0
  local num_up_turr = 0
  local num_post = 0
  local num_up_post = 0
  
  
  for build_channel in build_manager:GetBuildChannelAIs() do
 	 if build_channel:GetBlueprintID() == self.turret_id then
    num_turr = num_turr + 1
    for tabitr = 1, table.getn(self.upgraded_turrets) do
   	 if self.upgraded_turrets[tabitr] == build_channel:GetID() then
      num_up_turr = num_up_turr + 1
   	 end 
    end
 	 end
 	 
 	 if build_channel:GetBlueprintID() == self.post_id then
    num_post = num_post + 1
    
    for tabitr = 1, table.getn(self.upgraded_posts) do
   	 if self.upgraded_posts[tabitr] == build_channel:GetID() then
      num_up_post = num_up_post + 1
   	 end 
    end
 	 end
  end
  --End
  
  --Corsix Modded
  local id_2 = self.post_addon_2_id
  -- Added these two lines
  local before = math.abs(self.percent_post_upgraded - (num_up_post/num_post*100))
  local after = math.abs(self.percent_post_upgraded - ((num_up_post+1)/num_post*100))
  
  --Added "and"... + changed plan type
  if( self:PlanExists("Build NotifiedAddOn Plan", id_2) == false ) and after <= before then
 	 self.AddPlan( self, BuildNotifiedAddOnPlan( id_2 , 0) )
  end

        local id_2 = self.turret_addon_2_id
        
        -- Added these two lines
  local before = math.abs(self.percent_turr_upgraded - (num_up_turr/num_turr*100))
  local after = math.abs(self.percent_turr_upgraded - ((num_up_turr+1)/num_turr*100))
        
        --Added "and"... + changed plan type
        if( self:PlanExists("Build NotifiedAddOn Plan", id_2) == false ) and after <= before then 
 	 self.AddPlan( self, BuildNotifiedAddOnPlan( id_2 , 1) )
  end
  
  --End
  
       end

end
	
	BuildBaseStrategy.DoUpgradesAndAddons( self )
end

--Corsix Added
function MarineBuildBaseStrategy:AddOnNotify( addon_id, notify_code , build_channel)
	if addon_id == self.post_addon_2_id then
  self.upgraded_posts[table.getn(self.upgraded_posts)+1] = build_channel:GetID()
  return
	end
	if addon_id == self.turret_addon_2_id then
  self.upgraded_turrets[table.getn(self.upgraded_turrets)+1] = build_channel:GetID()
	end
end
--End

----------------------------------------
-- File: 'ai/strategies/buildbasestrategy.ai'
-- Edited by Thudmeizer @ 01.01.2005
-- Edited by Corsix     @ 17.01.2005
Added function:
--Corsix Added
function BuildBaseStrategy:AddOnNotify( addon_id, notify_code , build_channel)
	aitrace("this race does not have an addon notify!")
end
--End

----------------------------------------
-- File: ai/plans/'buildnotifiedaddonplan.ai'
-- Created by Corsix     @ 17.01.2005
Has this code:
import ("Plans/BuildPlan.ai")

class 'BuildNotifiedAddOnPlan' (BuildPlan)

function BuildNotifiedAddOnPlan:__init( addon_id , nofity_code ) super(  CpuPlayer.CT_BuildAddOns )

	BuildPlan.SetItemID( self, addon_id )
	BuildPlan.SetItemName( self, cpu_manager.stats:GetAddOnName( addon_id ) )

	Plan.SetNeeds( self, "Asking for builder", BuildNotifiedAddOnPlan.ObtainBuilder )
	Plan.SetState( self, "Wanting to build: "..self.item_name, BuildNotifiedAddOnPlan.BuildAddOn )

	Plan.SetName( self, "Build NotifiedAddOn Plan" )
	
	self.notify = nofity_code
end

function BuildNotifiedAddOnPlan:ObtainBuilder()
	
	for build_channel in build_manager:GetUnlockedBuildChannelAIs() do

  --don't queue
  if( build_channel:IsBuilding() == 0 ) then
 	 
 	 --now build something!
 	 local item_index  = build_channel:GetItemIndexFromID(BuildChannelAI.PQ_AddOn, self.item_id )
 	 
 	 if( item_index ~= BuildChannelAI.INVALID_INDEX ) then
  
    if( build_channel:CanAddToQueue( BuildChannelAI.PQ_AddOn, self.item_id ) == BuildChannelAI.CANBUILD_Ok ) then
   	 
   	 --lock and save it!
   	 BuildPlan.SetBuilder( self, build_channel )
   	 
   	 --no needs
   	 Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled )

   	 return
   	 
    end
    
 	 end  
 	 
  end
 	 
	end
	
end

function BuildNotifiedAddOnPlan:Retry()
	if( self.builder:CanAddToQueue( BuildChannelAI.PQ_AddOn, self.item_id ) == BuildChannelAI.CANBUILD_Ok ) then
  self.builder:BuildAddOn( self.item_id )
	end
end

function BuildNotifiedAddOnPlan:BuildAddOn()

	if self.builder ~= nil then
  --build it!
  self.builder:BuildAddOn( self.item_id )

  --change state
  Plan.SetState( self, "Building a "..self.item_name, BuildPlan.BuildingState )
  
  cpu_manager.build_base_strategy:AddOnNotify(self.item_id,self.notify,self.builder)
  
  return
	end
	
	aitrace( "can't build "..self.item_name )

end

And finally...
----------------------------------------
-- File: ai/'cpu_manager.ai'
-- Edited by Thudmeizer @ 01.01.2005
-- Edited by Corsix     @ 16.01.2005
Changed pre-functions:
--utility
import( 'utility.ai' )

--unit statistics
import( 'unitstats.ai' )

--strategies
import( 'Strategies/strategy.ai' )

import( 'Strategies/BuildOrderStrategy.ai' )
import( 'Strategies/BuildBaseStrategy.ai' )
import( 'Strategies/MarineBuildBaseStrategy.ai' )
import( 'Strategies/ChaosBuildBaseStrategy.ai' )
import( 'Strategies/OrkBuildBaseStrategy.ai' )
import( 'Strategies/EldarBuildBaseStrategy.ai' )

import( 'Strategies/DesignerStrategy.ai' )

import( 'Strategies/AttackStrategy.ai' )

import( 'Strategies/DefendStrategy.ai' )

--plans
import ("Plans/Plan.ai")

import( 'Plans/ResourcePlan.ai' )
import( 'Plans/CapturePlan.ai' )
import( 'Plans/BuildAddOnPlan.ai' )
--Corsix Added (1 line)
import( 'Plans/BuildNotifiedAddOnPlan.ai' )
import( 'Plans/BuildUnitPlan.ai' )
import( 'Plans/BuildBuildingPlan.ai' )
import( 'Plans/BuildResearchPlan.ai' )
import( 'Plans/AttackPlan.ai' )
import( 'Plans/DefendPlan.ai' )
import( 'Plans/DefendChokePointPlan.ai' )

--tactics
import( 'Tactics/Ability.ai' )

import( 'Tactics/Tactic.ai' )
import( 'Tactics/InfantryTactic.ai' )
import( 'Tactics/EngineerTactic.ai' )
import( 'Tactics/VehicleTactic.ai' )

import( 'Tactics/SpaceMarines/ForceCommanderTactic.ai' )
import( 'Tactics/SpaceMarines/LibrarianTactic.ai' )
import( 'Tactics/SpaceMarines/ApothecaryTactic.ai' )

import( 'Tactics/ChaosMarines/SlaveTactic.ai' )
import( 'Tactics/ChaosMarines/ChaosLordTactic.ai' )
import( 'Tactics/ChaosMarines/SorcererTactic.ai' )
import( 'Tactics/ChaosMarines/BloodThirsterTactic.ai' )
import( 'Tactics/ChaosMarines/CultistTactic.ai' )

import( 'Tactics/Orks/BadDokTactic.ai' )
import( 'Tactics/Orks/WarBossTactic.ai' )
import( 'Tactics/Orks/MekBoyTactic.ai' )
import( 'Tactics/Orks/GrotTactic.ai' )
import( 'Tactics/Orks/StormBoyzTactic.ai' )

import( 'Tactics/Eldar/FarSeerTactic.ai' )
import( 'Tactics/Eldar/GravPlatformTactic.ai' )
import( 'Tactics/Eldar/GravPlatformBLTactic.ai' )

Attached Files


Posted Image

#2 Grey

Grey
  • Members
  • 29 posts
  • Location:Århus C, Denmark

Posted 17 January 2005 - 08:59 PM

Thats quite a read. :blink:
Havent got the time right now, but it'll be fun to go through later.

What was the problem you mentioned in the other thread?

Really nice job, and so we're one step closer to a better AI.

#3 Corsix

Corsix

    Code Monkey

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

Posted 17 January 2005 - 09:02 PM

I just wanted to make the code neater and more generic:
- changed BuildFinalPostAddOn to BuildNotifiedAddOn
-- added support elsewhere for this
- remove all commented out old code
- change some global variales to local ones
Posted Image

#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 18 January 2005 - 01:23 AM

Outstanding work, Corsix! Outstanding! I'll be testing this shortly for the SM's then for every other race to ensure consistency. I'll also have to have the ORK do the same although Corsix I think we want the ORK to update all Banner Towers to Tier1 *BUT* then randomize the Tier2 upgrade. An unupdated Banner Tower is next to useless but in Tier1 they are pretty good troop-killers so lets ensure we force the Tier1 update BUT randomize the Tier2.

Btw, what is the percentage chance of upgrading the turrets? 50-50?

Otherwise, superb work! Will be testing this out shortly.

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

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#5 Corsix

Corsix

    Code Monkey

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

Posted 18 January 2005 - 03:34 PM

It chooses what percent of LPs/turrets that it would like to be upgraded in these two lines:
self.percent_turr_upgraded = math.random(55,75)

self.percent_post_upgraded = math.random(55,75)
. It then upgrades as many as possible to get as near as it can to its target.
Posted Image

#6 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 19 January 2005 - 02:06 PM

Fabulous! Just tested it with the SM and works great! Turrets and LPs all randomly upgraded! Excellent work Corsix - very elaborate bunch 'o' scripts!

That should be a wiki/tut for having the AI do random strategies/addons/upgrades.

Now we have to get the Orks to update all their Banners to Tier1 *then* make them randomly uodate some of them to Tier2. That would be superb!

Edited by thudo, 19 January 2005 - 02:06 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!

#7 Corsix

Corsix

    Code Monkey

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

Posted 19 January 2005 - 04:27 PM

The only concern I have is on game load / save....
Posted Image

#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 19 January 2005 - 07:03 PM

Hmm.. yes I could see that being a concern. Something to certainly test for.
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 Corsix

Corsix

    Code Monkey

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

Posted 19 January 2005 - 08:07 PM

Damnit, why does Relic take so long to answer questions?
Posted Image

#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 19 January 2005 - 10:56 PM

I think they're working on the expansion.. I'm sure they'll get back to us. For now, we work with what we have. Damn though: I'd give up a 24 case of our primo domestic beer just to talk for many minutes with one of the DoW LUA scripters. The API (terrain.analyser/vectorXf) is really critical to understanding how to build buildings out on expansions and moving troops to reflex changing strategy.

Edited by thudo, 19 January 2005 - 10:58 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!

#11 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 27 January 2005 - 09:24 PM

Btw, just to inform you that the SAVE/LOAD works fine. I'll try it some more but my biggest concern is multiplay so I've schedule some of local buds to try to see what happens. SHould be bloody fun! heheh
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#12 giskard

giskard
  • Members
  • 155 posts

Posted 28 January 2005 - 06:04 AM

Hi all :rolleyes:

Thud asked me to drop by.

Corsix, talk about timing.

I was just working on the problem of upgrading half my AI turrets and randomly selecting them tonight. Didnt have a lot of luck though.

And heres your post. :p

Lol.

Hope you dont mind if i use your code as a reference for my own work ?
Should help speed things up for me.

Giskard

#13 Corsix

Corsix

    Code Monkey

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

Posted 28 January 2005 - 03:23 PM

Personally, I think that it is horrible code.
But use it as a base if you wish...
Posted Image

#14 giskard

giskard
  • Members
  • 155 posts

Posted 28 January 2005 - 05:55 PM

Thanks :laugh:

I'll try it, if i make improvements i'll repost them for you to view or use.

I want my AI to build a few turrets early on but put the bulk down after the power goes up. So the AI never runs out of power and is left waiting.

Talking of power: When i did my max units mod i noticed power is a major controling factor for the AI. Building those big generators could unballance your skirmish AI and lead to massive tank rushes.

Other resources are not so important since power is the primary requisit for most common vehicles.

PS i think your missing an END in function MarineBuildBaseStrategy:DoUpgradesAndAddons() above.

Giskard

Edited by giskard, 28 January 2005 - 06:17 PM.


#15 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:39 PM

Talking of power: When i did my max units mod i noticed power is a major controling factor for the AI. Building those big generators could unballance your skirmish AI and lead to massive tank rushes.

Other resources are not so important since power is the primary requisit for most common vehicles.


I usually like to give the AI a generator right at the start - giving the AI power is key to his longevity and its not meant as a cheat. The DoW does not cheat (except for that little economy variable that Relic put in).

Its essential the AI gets power coming in. The game I've played with him were good determinants of how crucial power is like req. If the AI is gonna tank-rush me then thats my fault - any player would do that if the other side is just turtling waiting for the inevitable beating to slam down. :laugh:

Edited by thudo, 28 January 2005 - 06:40 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!

#16 giskard

giskard
  • Members
  • 155 posts

Posted 29 January 2005 - 12:11 AM

Yes those early gens are important, without them you dont get the best stuff and the AI just sits there.

BTW heres the work in progress turret entry for my marine base file.

function MarineBuildBaseStrategy:DoDefTurretsBuildings()

	--build a second machine pit
	
	--check that we have one and only one machine cult
	local num_turret2_buildings = 0
	local num_upgrades = 0
	local actualupgrades = 0

	for build_channel in build_manager:GetBuildChannelAIs() do
	
  if build_channel:GetBlueprintID() == self.turret2_id then
 	 num_turret2_buildings = num_turret2_buildings + 1
  end

	end
	
	--build a second turret
	if num_turret2_buildings < self.set_turret_numbers and
  resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 150 and
  resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Power ) > 75 then

  local build_type = CpuBuildType()
  build_type.btype = CpuPrerequisites.BT_Building
  build_type.name = self.turret2_name
  self:TryBuild( build_type )

	end
	
	actualsupgrades = self.set_turret_numbers - self.set_turret_upgrademodifier

     if  num_upgrades <= actualupgrades then

              local id = self.turret2_addon_id
                     num_upgrades = num_upgrades +1

                     if( self:PlanExists("Build AddOn Plan", id) == false )then
                     self.AddPlan( self, BuildAddOnPlan( id ) )
                     end
      end

end

The upgrade part upgrades everything and not just few so its not working as intended yet.

A randon number of turrets are built by the AI and its supposed to use a second modifier to reduce the number of turrets it can upgrade. So each game the AI builds a different number of turrets and upgrades a different number of turrets.

Thats what i have done with corsix code so far, not a lot like his i know but you can see the bits i borrowed.

self.set_turret_numbers = math.random(10,25)
	self.set_turret_upgrademodifier = math.random(1,9)

These are my random enteries from the same file. I didnt edit any other files since the buildbase strategy already has a function to call the turret functions from the marine or any other race strat file.

I tested the code 3 times and the AI build 21 turrets in one game, 18 in another and 12 in the last game so the random number of turrets is working.

In case you want to see the buildbase strat entries that makes them work here they are.

function BuildBaseStrategy:DoDefTurretsBuildings()
	aitrace("this race does not have any turrets to build!")
end

I just call that function from the update state in the buildbasestrat file to get it to build the turrets.

Its one of 2 turrets for my 2 step turret building idea but they get build so fast im questioning the need for the first entry.

Giskard

#17 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 - 12:44 AM

Some questions:

a) Can you limit the # of turrets produced as your script keeps building them. We don't need to many as DoW is about infantry/vehicles. Turrets are a nice bonus but the gameplay is about moving units. I know your mod deals with turrets being uber-like but is there a way the AI can generate a random turret limiter between say 6-14 turrets per game? It would build a random # of turrets per game between 6-14 turrets?

b) The only place turrets are needed really are at the following: MAIN BASE, RELICS, LARGE THERMO REACTORS, Closet LP to ChokePoint near enemy (provided its not on a StrategyPoint which cannot be built on except for Eldar and Webgates). To me, this is so critical being able to achieve.

c) Larkin was able to force the AI to build buildings closest to the main base with this:

File: strategy.ai

Change this:

self.AddPlan( self, BuildBuildingPlan( id, nil)
to this:
self.AddPlan( self, BuildBuildingPlan( id, cpu_manager.cpu_player:GetStartingPosition() ) )

In other words as he put it: "no more generators on the front line".

However, doing so the AI on some confined starting point maps (ie. 4p_Biffy's Peril) will crunch everything together at their main base instead of building on even semi-vulnerable LPs. We need some sort of solution to be able to extend, with reason, the main base and allow the AI to be aware of close-by LPs to build turrets and extra buildings that cannot be build at their startpoint.

I believe we are getting closer to this BUT Relic needs to go one step beyond and as Corsix and I have been asking since Nov -> WE NEED DOCUMENTATION ON THE GAME'S API ! This deals with terrain.analyser and vectorXf()!

Keep plugging away! We're making progress.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#18 giskard

giskard
  • Members
  • 155 posts

Posted 29 January 2005 - 07:11 PM

Hi Thudo.

The codes work in process, just wanted to give you guys an update by way of putting something back after using your work.

As for turret numbers, the line ...

self.set_turret_numbers = math.random(10,25)

just needs changing to

self.set_turret_numbers = math.random(6,14)

and it should work.

Becareful you use the right vars for the turret number checks though, one mistake causes the AI to just keep building the turrets. Made that mistake my self in my first test :grin:

It worked fine after if corrected that mistake.

BTW i dont check for HQ upgrades yet before allowing them to run rocket upgrades on them since im testing turrets and want to run the tests as quickly as possible.

I have found its easier to track stuff when you add your functions rather than edit existing functions when adding new features. Editing existing features is of course a different matter.

Its a question of control, making your own functions means you know exactly where the parts that make them work are and can setup one system to run each races functions yet have those functions customised for each race. So whilst the code that runs them is all the same, the code that does the job can be very different indeed.

Giskard

#19 giskard

giskard
  • Members
  • 155 posts

Posted 29 January 2005 - 07:15 PM

Nearly forgot.

Points B and C are things on my todo list.

I like to get one part right before moving on to the next, i find it allows me to focus on the problem at hand better and the work goes much faster that way.

I do agree with you about where the AI should build though.

Personally id like the AI to choose a second base site and defend that too.

So its an area i'll get to in time.

Perhaps creating a new base file a simple list of stuff you want at the second base is the way to go. Call it from a function that has first looked for and found a save area on the map and have it build there.

PS thanks for the Larkin quote. I'll give that try when i move on to points B and C. :grin:

Giskard

#20 Corsix

Corsix

    Code Monkey

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

Posted 29 January 2005 - 08:14 PM

Are you working with us or on your own Giskard?
Posted Image



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users