Jump to content


Photo

Fatal AI Error (oh noes)


20 replies to this topic

#1 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 12 December 2009 - 08:02 AM

Well, thanks to being pointed in the right directions from another DoW forum, I was able to figure out how to make more effective AI modding~! :p

^^; However, in my quest for perfection, I've run into a problem...

Posted Image

The problem's within the lines (at least it should be) :
AI -- *ALERT: [strong "Core/Strategies/BuildBaseStrategy.ai"]:1359: attempt to compare number with string
SCAR -- Could not execute rule: AI_Think

Ignore all the other stuff about donations and unit strengths, I'll fix those later and they were never a problem before (never caused an AI problem pause).

Now see, the thing was, I added a new unit to a race, and I've been poking and prodding to figure out how the skirmish AI would use them.

Well, as soon as I figured it out, I even gave one of them a specialized ai script to use. ...I put everything under the right directory and changed all the names as they should be. ...with me kinda' worried about the direct spawn command I gave it (where it summons troops)... but I'm pretty sure that wouldn't be the problem here as that unit isn't even in summoned whenever the ai plays (as well as two other units I made for the team).

.... let me see if I can make this more specific...

Line 1359 within BuildBaseStrategy.ai would be:
if (iCurrentInstances < iCount and self:RelicRequired(sName)) then


In whole it looks like this:
-- Check if we need a Relic 		
if (iCurrentInstances < iCount and self:RelicRequired(sName)) then 			 			
-- Check AI settings and relics 			
if (not CpuManager.AISettings.bRelicUnits or not self:HasRelic()) then 				
iCount = 0 			
end 		
end


I NEVER touched the Core files, btw. I did exactly what the ReadMes and notices told me: DO NOT touch the Core files.
Never did. So obviously it's having a problem reading my race files.

...now I have a question, would it have anything to do with the
function ChaosBuildBaseStrategy:BuildFlexible()
?

Because I added the unit names in there when they weren't referred to at all within the following strings...
-- Dynamic research item syntax: ResearchName, MinTier, RequisitionCost, PowerCost, MinSquadCap, MinSupportCap, SquadName, SquadMinCount
local iArmyStrength = cpu_manager:GetArmyStrength()
local iCommanderSquads = self:CountSquads("chaos_squad_lord") + self:CountSquads("chaos_squad_sorcerer") + self:CountSquads("chaos_squad_sorcerer1")
local iInfantrySquads = self:CountSquads("chaos_marine_squad") + self:CountSquads("chaos_squad_raptor") + self:CountSquads("chaos_squad_khorne_berserker") + self:CountSquads("chaos_noise_squad") + self:CountSquads("chaos_plague_squad") + self:CountSquads("chaos_rubric_squad")


...sorcerer1, noise squad, plague squad, and rubric squads would be the ones that were never referred in the following strings... not sure if that has anything to do with it.
Afterall, the AI seems to have an easy time spawning my noise squads (despite not knowing how to upgrade them...... could that be another problem?).

Another possibility is the sorcerer1's ability to direct spawn. I haven't added its spawned squad ANYWHERE in the AI yet (which I'm assuming should have its own specialized ai script - much like the honor guard for the ethereal). That might be another problem.

.....yeah, that's a ton of problems now that I list it.
I was just hoping someone with some ai skills could help me out here. ^^;
Just want the darn AI to figure out my new troops by now (I can use them perfectly, obviously).



---of course, if you need extra information, just tell me where you need that information from and I'll gladly post it. Thank you~!
Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#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 12 December 2009 - 11:10 PM

So this is your own custom scripts you have done editing our own? When does this exact error occur? Right at gamestart with the AI using Chaos or delayed? Should be a real easy fix.
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 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 13 December 2009 - 12:02 AM

After playing again: Nothing went wrong... but I think it's because the AI chose a different AI tactic.
There's no problem with the noise marines: The upgrade and work just fine.
There's no problem with the rubric marines: They summon well and reinforce just fine.
There's no problem with the sorcerer1: It summons fine and uses its abilities well.
There's no problem with the direct_spawn: It direct spawns just fine.

...so it might be the plague marines (which were never summoned) or perhaps even something completely different.

________________________________________________

It always seems to happen halfway through the game. It's when the AI uses chaos, not myself.

Naw, it's not my own modding script, I've been tweaking other people's mods.
I've incorporated a little here and a little there and just starting to figure out how they work... ^^;

I'm planning on a few more playthroughs later to see if it occurs specifically against another race (possibly a mix of AI problems causes the crash).
But as I said, it might have something to do with the plague marines (the AI never seems to summon them, and before all this AI-tweaking, the game would always crash when I added the plague marines champion in the game -- I fixed it, but not sure if it's still causing problems for the AI).

I could be completely wrong, no idea.
All I know is that about 40min-to-1hr into the skirmish, the AI just crashes. I can never tell if it's because of all the action going around with me forgetting to put some items in for the AI to calculate/count, or if it's because it's trying to summon a unit that hasn't been implemented well into the AI...

I'll do a few more tests later and post again if it crashes again. ^^ thank you for the consideration~
Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#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 13 December 2009 - 12:22 AM

Well thats simple then: disable the unit that you think is causing the crash OR force the AI to build it so you are assured it is indeed the one causing the crash. Scripting DoW1 Adv. AI is not hard especially when you have 5+ years doing it AND for, oh, 20+ faction mods and 7+ balance mods. :D I've pretty much seen it all and hopefully plan to see more soon. However, what you inquire about sounds easy to resolve.

As for the AI not favouring a unit over another.. real easy to solve that one. :thumbsupsmiley: Troubleshooting AI crashes or Fatal errors is real easy.
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 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 13 December 2009 - 11:37 PM

Well, after a few tweaks (removing unnecessary ai coding that I put there originally "just in case"), it started working just fine (for now, I'll keep an eye out).

The strangest thing is, no matter how I arranged the AI, it would ultimately refuse to build the plague marines! It would avoid it... like the plague! Harhar.

I even removed its restrictions and everything, the AI just wanted nothing to do with it! ...so odd.
I think I'll just remove that squad from the ai script for the sake of the AI...

Edited by SoshiK, 13 December 2009 - 11:37 PM.

Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#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 14 December 2009 - 01:55 AM

I even removed its restrictions and everything, the AI just wanted nothing to do with it! ...so odd.
I think I'll just remove that squad from the ai script for the sake of the AI...

Why? Then the AI defeated you as a coder especially at such a rudimentary level. Don't give up because I KNOW why the AI doesn't build X unit of this or Y of that. Its easy.

Try this.. look at the unitstats.ai of the faction where your X unit is. Look at the "Rating =" line and the first line of 17 values of the first weapon hardpoint.
Now increase both the rating to 10 and the 17 values of the first hardpoint all to, say, 9 or 10 each. Play the game.. guess what? The AI will basically then build that unit now. Why? Because you drastically made that unit QUITE interesting to the DoW1 AI to build it. Period. One of the tricks and art of DoW1 AI coding is in the unitstats.ai is to keep all units interesting for the AI to build so you have to juggle like-wise and tech tree-similar units so the AI doesn't always favour the same unit.

ie. if your mod you have, say, 4-5 units become available at the same time in, say, Tier2, you have to juggle the values of all 4-5 units so the AI will pick/choose them without totally forgetting about another. Its not hard to do.. its all about the rating = and first 17 hardpoint line values. Keep them slightly different based on the units available at that point in the tiers AND in the building. I learned this years ago and it varies the AI super-nice.
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 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 14 December 2009 - 02:30 AM

OH!!!! Oops, I totally realize that I accidentally put the rating a bit low when I first implemented it!

I've been jumping back and forth when the problem was right there all along. ^^; Eheheh...

Awesome! Thanks~!
Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#8 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 16 December 2009 - 02:26 AM

Having problems again. For a good while, the AI was doing great. But now I seriously think it has something to do with that core file...
the line 1359 thingy.

I never meddled with it, but who knows, maybe all my changes within the races ai files has made it confused.

The troops work fine. Odd thing is, the AI seems to be able to get relics.. (the line 1359 has something to do with seeing if they have any relics)
It always says it has a hard time comparing the number with the string.
Maybe it gets confused once it runs out of relics to capture?

Any chance I can be guided to see if there's any problems with either the numbers or string? (not exactly sure what that means)



:( Any help would be wondrous.

Edited by SoshiK, 16 December 2009 - 02:27 AM.

Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#9 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 16 December 2009 - 03:11 AM

Well how can there be an issue with our 3.20 SS Adv. AI if you did not change any of the core AI files? I don't quite understand whats the problem?
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#10 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 16 December 2009 - 05:18 AM

That's the thing though: I have no idea what the problem is. :(

I'll have to relook through all the AI editing I've done... I was hoping to see if I could be guided to look anywhere specific.
But I suppose looking through all of my additions come first. Perhaps it's the specialized unit ai I added. Gwar...
Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#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 16 December 2009 - 05:24 AM

Yep -- if you didn't touch the core AI logic then its likely a unit you have that has a problem.
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 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 17 December 2009 - 11:38 AM

Just a quick question: Do you think having TOO MANY UNITS could be the culprit?
I've checked over all my work, and nothing seems to be the problem... the only culprits could be the fact that my chaos cultists reinforce up to 30 (with the AI being told to summon only 3 units), and up to 10 horror squads could be summoned without any squad caps being used.

..... I did a test on a different mod as an experiment... and it seemed that all the AI errors would be pointing to the iCount on the AI files...
And if I removed those iCount scripts, the AI would keep building beyond the number I restricted them to.
... but the AI error wouldn't occur if I removed the iCount, but it just wouldn't be able to help itself in building huge numbers of cultists... maybe it just hates the large amounts I put in.

Edited by SoshiK, 17 December 2009 - 11:39 AM.

Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#13 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 17 December 2009 - 03:09 PM

Where is the iCount issues occurring? In what script? Like I said: its about process of elimination -- remove units out of the equation from being built OR force-build then in the build order. Finding AI crashes or errors is all about troubleshooting such things.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#14 ArkhanTheBlack

ArkhanTheBlack

    title available

  • Members
  • 814 posts

Posted 18 December 2009 - 12:04 AM

The error message reports a comparison between a number and a string. There's only one coparison in the if clause and that's "iCurrentInstances < iCount". Therefore either iCurrentInstances or iCount is set as a string by mistake somewhere. If you check the code before this line you'll find the line

local iCurrentInstances = 0 (Line 1100 in my code)

Although it can be modified later, it's at least initialized correctly. However, iCount is initialized in the following line

local iCount = self.info.BuildPrograms[self.m_iCurrentBuildProgram][iLoop1][5] (Line 1077 in my code)

This is a direct reference to an entry of a build program of a race AI file. Therefore I'd guess that you've a corrupt build program in your race AI. One entry has a string although it should have a number instead.

Never forget, the core AI computes data from the race AI. Therefore if the core AI crashes, you've probably some buggy data in your race AI.

#15 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 19 December 2009 - 07:06 AM

Ahh~! That helps a lot! :huh: Thank you!

*continues to scrub through race files*
Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#16 SoshiK

SoshiK
  • Members
  • 9 posts

Posted 20 December 2009 - 08:31 AM

;) I found it! Thank you guys! I finally understand all this AI stuff a bit more!

.... evidently the culprit was within the strategyinfo.
In the build program, there was one item that was
{ 3, 200, 0, 1,	   "Unit",	"chaos_rubric_squad" },
instead of
{ 3, 200, 0, 0, 1,	   "Unit",	"chaos_rubric_squad" },

That was actually pretty hard to spot within the pile of all the other numbers.

I'm 100% sure that was the culprit after I played the game at least 12 more times to make sure. Works PERFECTLY. :D

*bows* Thank you very much again, AI masters! :p

Edited by SoshiK, 20 December 2009 - 08:32 AM.

Are your necron bodies floating around after they died? :D I've solved it! And there's no negative side-effects or removals! PM me!

#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 20 December 2009 - 02:07 PM

heheh.. typical syntax error. You got off easy. :p
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 Guest_GRINPoigma_*

Guest_GRINPoigma_*
  • Guests

Posted 22 December 2009 - 05:50 PM

I suggest you to visit a site, with an information large quantity on a theme interesting you.

#19 Guest_Nunu_*

Guest_Nunu_*
  • Guests

Posted 15 January 2011 - 11:40 AM

I had the same problem, if you are not using a Glide card those files aren´t used, but because they exist, the program want to use them but your card doesn´t support them, it´s weird but is that how it works

#20 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 15 January 2011 - 05:40 PM

Glide card? Good gawd man that brought back memories of.. the late 90s. :O
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