Jump to content


Let's fix the AI ourselves


  • This topic is locked This topic is locked
30 replies to this topic

#1 Guest_Polaris_*

Guest_Polaris_*
  • Guests

Posted 16 June 2005 - 07:36 AM

I have been briefly discussing this topic with Thudmeizer. The idea is to locate the faulty parts in the AI code sections and then proceeding into fixing them.

A first attempt, mostly to check out if the whole idea is realistic, could be made on prereq:CannotFulfillPrereqs(), that Thudmeizer reported to be broken here.

In order to fix such function, the following steps must be performed:
* locate faulty code
* reverse engineer the faulty code
* correct the faulty code
* patch/implement the fixed code

Also, there is the need for a *experienced* modder to support me with informations about the whole modding system and the original AI implementation.

#2 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 16 June 2005 - 09:23 AM

Maybe it's possible to reverse engineer and fix.
I won't do this nor assist as I wasted too much time with this already.

Also I'm not sure wether I nailed the problem as the AI starts building vehicles in the end (though it takes years for chaos).

IMO it's Relic job to fix this.

Good luck if still want to try. Maybe you can get a job at Relics afterwards.

Larkin

#3 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 16 June 2005 - 10:55 AM

Maybe it's possible to reverse engineer and fix.


That's what we wanna investigate. In my opinion (and believe me, I am quite skilled in Reverse Engineering :p ) this can be done.

IMO it's Relic job to fix this.


Sure, but I really like this game, so, if they are not going fix things, I'll do that.

Good luck if still want to try. Maybe you can get a job at Relics afterwards.


:p LOL

#4 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 16 June 2005 - 12:18 PM

I like the game too. But not THAT much.

The question for me is just this : Can I do something better instead of trying to fix it ? Currently the answer is : Yes.

Modding should be fun, right ?

Larkin

#5 Guest_Polaris_*

Guest_Polaris_*
  • Guests

Posted 16 June 2005 - 01:12 PM

I like the game too. But not THAT much.

The question for me is just this : Can I do something better instead of trying to fix it ? Currently the answer is : Yes.

Modding should be fun, right ?

Larkin

<{POST_SNAPBACK}>


Well, I really can't blame you... But take this as a more difficult challenge :p

#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 16 June 2005 - 01:40 PM

Welcome aboard Polaris..

We chatted briefly about your coding skills.

You probably need all the AI scripts regarding preq. Thats easy to give you. You then take all the relevant AI code, find out how the logic works, then build your patch around it.

Larkin is right though: its Relic's job to do this and my concern is reverse-engineering an exe is probably not legal. I can certainly see a possible conflict with releasing it. I mean, we can attempt it then release it internally to us for future testing .

Heck, I'd sooner have you on our team as a regular member going through and enhancing what AI code we already have. Your skills would easily meld with the rest of the talent we have pooled here.

TuD.
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 Guest_Polaris_*

Guest_Polaris_*
  • Guests

Posted 16 June 2005 - 02:21 PM

Hi there Thudo!

The "legality" problem is a big issue: as soon as I am loading the program binaries inside my "tools-of-the-trade" I am infringing the game copyright agreement.

*But* - hey we have purchased the game, I really do not like playing skirmishes with crazy chaos raptors that wander without reason. Obiovously, we can end up in making this patch private, and in this way we can avoid any problem.

Now, I must understand a few things: I *suppose* that DOW mod development is like plugin coding: you insert in your code a set of primitives that Relic Mod Tools make available, am I right?

Maybe a small code example could clarify thingies. :)

#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 16 June 2005 - 02:52 PM

DoW mod development is different from our work. The DoW AI logic system makes direct calls to the mod's filenames to access their attrib data for such things as prequisties or weapon names for that item being called. AI logic also calls directly from SCAR, the master scripting language. My fellow code gurus could probably explain it better but essentially we operate outside the normal modders in our own realm BUT the AI has to be able to interface with the attributes of each modded or official DoW filename. We're basically creating real-time behaviour logic to those dumb .lua or .rdg (v1.30) files that don't know any better except waiting to be manipulated by either a human or AI player.

As for where examples are:

For the Demand system do a search for the word "demand" and here are the relevant .ai files:

cpu_manager.ai
buildbasestrategy.ai
strategy.ai

For the preq. system its:

buildunitplan.ai
strategy.ai

Larkin knows this area quite well though and could elaborate.
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 Flenser

Flenser

    title available

  • Members
  • 316 posts
  • Location:Glasgow, Scotland
  • Projects:Dawn of War AI Skirmish

Posted 16 June 2005 - 07:19 PM

Hi Polaris - sounds like you are attempting Mission Impossible, but since I would love you to succeed I am happy to help :)

If you want a very (very) rough briefing on the AI files and how they work, as well as some musings on the demand system take a look here.

Other than that I would be happy to help you out - PM me if you want to chat about the AI files and so on.

Flenser

#10 Polaris

Polaris
  • Members
  • 49 posts

Posted 17 June 2005 - 04:43 PM

Hi Polaris - sounds like you are attempting Mission Impossible, but since I would love you to succeed I am happy to help :ninja:


Hehhe... You should not be so pessimistic. The idea is to spot what they do and have a quick patch... Difficult but not impossible. :D

I have some question based on the code I have seen coming from your mod. For example function prereq:CannotFulfillPrereqs() was targeted as the first operation that needs patching. So, it is used in the following way (coming from the function CpuManager:PrintDemands()):

if prereq:CannotFulfillPrereqs() then
self:Print( xval, yval, "true" )
else
self:Print( xval, yval, "false" )
end

Now my question is: you actually wrote scripts that invoke functions (like CannotFulfillPrereqs()), but where this commands are stored? Also, where can I find documentation on that?

This information is required in order to locate the code (the actual command) that needs patching.

Awaiting feedback... ;)

Edited by Polaris, 17 June 2005 - 04:45 PM.


#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 17 June 2005 - 04:51 PM

Thats not our code - thats Relics. Commands I gather are stored either in SCAR or the LUA command base / game engine. How to get access to that? Good question.. Illusive - you bet! Likely stored in a .dll in the main Dawn of War dir.

Maybe perhaps I should get Corsix in on this convo too as he's been deep in the code before as well examining higher-level functions.
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 Polaris

Polaris
  • Members
  • 49 posts

Posted 17 June 2005 - 04:58 PM

I have briefly scanned the game DLLs for functions export, but I did not find the above CannotFulfillPrereqs... I have found some LUA commands in the LuaBind.dll, LuaConfig.dll and the SimEngine.dll. I'll give a try even to other DLLs... :ninja:

NOTE: Due to the _barely legal_ content of these posts, I suggest we find another way of continuing this "project".

#13 Flenser

Flenser

    title available

  • Members
  • 316 posts
  • Location:Glasgow, Scotland
  • Projects:Dawn of War AI Skirmish

Posted 17 June 2005 - 05:30 PM

function prereq:CannotFulfillPrereqs() was targeted as the first operation that needs patching


While it is correct that the prerequisite system is crippled in some way, we do not know exactly what has gone wrong or where to look. CannotFulfillPrereqs() is a good start, however, as is GetUnfulfilledPrerequisites() and PrerequisitesFulfilled().

Take a look at the AI wiki on the Relic Developers Network - zipped version attached, since registration is required at RDN.

This is the only documentation Relic have made available on the AI, and its sparse nature is one of the reasons this is all taking so long :ninja:

Thud - I am sure you can come up with another - less public - way for Polaris to contact us if he has any questions. I would prefer you not give him my work email however given the nature of my job.

Cheers,

Flenser

Attached Files



#14 Polaris

Polaris
  • Members
  • 49 posts

Posted 17 June 2005 - 05:33 PM

Thanks, I am having a look. BTW, attached you can find the list of the lua-related exports I have currently found.

If anybody spots something interesting, let me know (no CannotFulfillPrereq, sorry :ninja:)

HMMM: How to attach?

#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 17 June 2005 - 05:37 PM

Don't do a fast reply. Do a regular reply and you'll see the attachment option a the bottom.

I'll have to see if I can create a private forum here that requires username/password. That would work best.
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 Polaris

Polaris
  • Members
  • 49 posts

Posted 17 June 2005 - 05:50 PM

Ok, new infos: I have scanned *every* fuck**ng DLL in the GAME, but no information was found ----> Lua interpreter is hardwired inside W40K main executable.

Edited by Polaris, 17 June 2005 - 05:53 PM.


#17 Corsix

Corsix

    Code Monkey

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

Posted 17 June 2005 - 09:23 PM

Ok, new infos: I have scanned *every* fuck**ng DLL in the GAME, but no information was found ----> Lua interpreter is hardwired inside W40K main executable.

<{POST_SNAPBACK}>

That would make sense. I must say that I admire your idea; although pulling it off may well be hard. Time for the cdoe ninjas... :ninja: :D ;)
Posted Image

#18 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 June 2005 - 10:22 PM

Corsix can assist ya Polaris.. He's an apps coder so if anything yer in good company.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#19 Corsix

Corsix

    Code Monkey

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

Posted 17 June 2005 - 10:36 PM

I fear that reverse engineering is a twee bit over my head. The nearest I think I've been is DLL injection to hack Starcraft.
Posted Image

#20 Polaris

Polaris
  • Members
  • 49 posts

Posted 18 June 2005 - 10:43 AM

Small update: the LUA interpreteris NOT located into the main W40K executable *BUT* in the W40KMod.dll library: probably, at runtime the lua file are passed to the interpreter for execution.

Also, found something related to prerequisite in W40KMod.dll (sorry for the asm, but I really want to be sure I am going toward the right way ;) ):

.text:0F288C15 push dword ptr [ebp-24h] ; Prerequisite string
.text:0F288C18 mov eax, [eax+4]
.text:0F288C1B mov eax, [eax]
.text:0F288C1D push eax ; Building name
.text:0F288C1E push offset aPrereqsNotMetF ; "prereqs not met for building %s. Prere"...
.text:0F288C23 push 53434152h
.text:0F288C28 call ds:dbWarningfAux(ulong,char const *,...)

This basically means:

dbWarningfAux(0x53434152,"prereqs not met for building %s. Prereqs:(%S)", Bname, PrereqString);

So, if we land here, we have previously checked if the prereqs have been fulfilled, and the prereq are NOT right.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users