Tinkering with the AI

a place to discuss it

Moderators: Deathifier, Sukayo

SmellyTerror
Infantery
Posts: 2
Joined: Mon Jul 11, 2005 1:01 am
Location: Canberra

Tinkering with the AI

Postby SmellyTerror » Mon Jul 11, 2005 8:07 am

Hi - I'm new here, but an old fan of EFS. Glad to discover mods and things around.

I've had a long-time interest in game AI, and I was wondering if the modding tools make it possible for us to tinker with the AI routines? If not, can anyone suggest how, or if, it could be possible?

User avatar
cy387_lk
Vau Ambassador
Posts: 236
Joined: Mon Jan 21, 2002 2:01 am
Location: Mexico City, Land of Drunk Mariachis
Contact:

Re: Tinkering with the AI

Postby cy387_lk » Mon Jul 11, 2005 7:49 pm

Playing with DAT files, especially UNIT.DAT, can do miracles. Customized Galaxies also affect game balance seriously. To adjust AI directly the game sourse code would be needed, so no big option here.
Do I like science fiction? Sure! But only a bad one!...
("Tales of Pirx The Pilot" after Stanislaw Lem)

SmellyTerror
Infantery
Posts: 2
Joined: Mon Jul 11, 2005 1:01 am
Location: Canberra

Re: Tinkering with the AI

Postby SmellyTerror » Wed Jul 20, 2005 11:19 am

Thanks!

Grimly
Assasin
Posts: 158
Joined: Mon May 17, 2004 1:01 am
Location: Philadelphia, PA

Re: Tinkering with the AI

Postby Grimly » Fri Aug 05, 2005 5:17 am

Just spreading the word: A free reverse engineering compiler (decompiler) was just released August 1. It seems not to be able to handle EFS.exe in XP, but works in 98.

IT'S FREE

Go to www.backerstreet.com to download it.

I have had no concrete success with it yet, myself. But then, I don't know what I'm doing!

Also check out the free Olly debugger. It may be that these are the tools we have been waiting for.

:)
Grimly

User avatar
cy387_lk
Vau Ambassador
Posts: 236
Joined: Mon Jan 21, 2002 2:01 am
Location: Mexico City, Land of Drunk Mariachis
Contact:

Re: Tinkering with the AI

Postby cy387_lk » Mon Aug 08, 2005 6:36 pm

Hmm... Looks pretty interesting...
Do I like science fiction? Sure! But only a bad one!...

("Tales of Pirx The Pilot" after Stanislaw Lem)

Grimly Fiendish 2
Assault Legionnaire
Posts: 89
Joined: Wed Jun 15, 2005 1:01 am

Re: Tinkering with the AI

Postby Grimly Fiendish 2 » Mon Aug 08, 2005 9:54 pm

Sure is! As I posted on another thread, the current REC Studio doesn't work on Watcom C++ exe files like EFS. However, I had a brief discussion with the maker---who must be brilliant guy to be writing advanced, easy-to-use, portable decompilers on his free time—and he says you can look for a new version in a matter of days. Here's my question and his response:

Quoted: "It turns out the file was compiled in Watcom C++, a legacy compiler. My question is then rephrased as, Can your REC handle Watcom C++, or can this be added as a feature in the future?"

Answer: That explains why it did not find the procedures.
Watcom uses a different naming scheme for the sections.
I've changed REC and I'm testing it with a Watcom binary. Now it finds the procedures.
I should be able to post an updated version of REC by the end of the week.

-- CG

Using REC Studio is really easy---you just dclick on a procedure and it displays "source" code. It doesn't mean there won't still be work to do, because variable names and comments are stripped from the source code by compilers. So the result will be just standard variables like eax or whatever when what the variable controls is something like "space unit attack strength." But hey, I can deal with that, and some of you out there (Matt?) are quite capable of working this stuff out.

There's a company that charges $800 to work out 1000 lines of code with a tool called ReLogix. Maybe we'll find out how many lines of code there are, but until HDI releases the source code, this REC Studio looks like the closest we are going to get to the real thing.

Deathifier
Noble
Posts: 344
Joined: Thu May 24, 2001 1:01 am
Location: Sydney, NSW, Australia
Contact:

Re: Tinkering with the AI

Postby Deathifier » Tue Aug 16, 2005 4:29 pm

There's many decompilers out there, and efforts to decompile right back to source (which can then be recompiled back to a working EXE) usually stumble a fair bit.

Going from machine code -> assembly isn't too hard (though figuring out what the assembly does is).

Going from assembly -> C/C++ source is downright nasty, since release builds tend to strip as much useful info (for debugging, not for execution) as possible from the EXE (reduces file size, overhead, makes reverse engineering harder) and usually optimises everything to the max.

Sure you can get back source, but you're not going to get much of execptional use, esp. for C++ (recovering objects is particularly nasty I believe, given what they go through during compilation).

If you get it working with the EFS exe then I might have a look at it, see what can be done however I would guess that the time required to figure it out would be equal to or greater then writing a clone from scratch...

- Deathifier

Grimly Fiendish 2
Assault Legionnaire
Posts: 89
Joined: Wed Jun 15, 2005 1:01 am

Re: Tinkering with the AI

Postby Grimly Fiendish 2 » Tue Aug 16, 2005 10:14 pm

A new version of the REC decompiler that should be able to handle EFS.exe is available at www.backerstreet.com. I'll be checking it out when I get home!

15 Aug. 2005 
Version 2.0b: Maintenance release. Support for Watcom-compiled binaries and wide strings

1 Aug. 2005 
Version 2.0a: Maintenance release. Fixed crashes, improved quality with Windows executables

Certainly this is no way to convert an exe file to source code—unless you have a LOT of time on your hands—but I hope we might be able to gain some insights:

Where is the unit list limited to 90x5 units? What are the factors in the build table? Where is the AI limited to 70 buildable ground units at once? What functions call those unexplained datafields under Unit Iterator? Where are unit classes hooked up to special behaviors? Where can we plug in new code or new data to make something work the way it should, like Patriarchal elections? What does the AI know when it makes a decision, like when to declare for the crown? Can the 4 game resolution movies be made to actually run?

Of course what I expect to find is that HDI couldn't fix some things either, but then we know they ran out of time. For example, the reason for the Garrison unit list is probably that they realized they had forced those units off the table, as Matt explains, so they had to jury-rig it to work. Still, I'd like to know . . . even at risk to my sanity!

;)

Grimly Fiendish 2
Assault Legionnaire
Posts: 89
Joined: Wed Jun 15, 2005 1:01 am

Re: Tinkering with the AI

Postby Grimly Fiendish 2 » Fri Dec 30, 2005 7:04 pm

Just want to post about a minor success I've had in getting the AI to operate more competently.

I've been watching the AI research and build thrugh a lot of games. Always, the AI factions march in lockstep along the tech pathways, sharing techs and building the same units on BS (each has a fortress and an arsenal), unless they run afoul of the Church.

I revamped my tech values according to the following approach, after creating a tech tree diagram in Visio:

I counted the required inputs to each tech. I used "5" for root techs because I want each stream to be hard to break into, i.e., keep the value of a Documentarium high.

I counted the number of techs that use each tech as an input (i.e., its outputs).

I added up inputs and outputs for each tech and multiplied by 100 to get research point values.

The result is that AI Houses now build very different units on BS. Hazat builds Pitbulls and medium tanks (Lightning War); other houses build crude tanks (Basic Industry) and bombers (Industry/Administration, perhaps better called Logistics); Hawkwood builds Cybercorps. The cool thing is that they are not all building the same units, and also that I didn't give any of these techs to them.

It is still possible that they all share the same techs but are limited by different resources, but my unit tables have stayed the same for a while now and this is a recent development. So I think the AI, being brainless, is simply better able to match research investment to useful unit building, however it makes those investment decisions, when research cost and tech usefulness are directly linked.

This may seem obvious, but for a long time I have had to guess that the AI was getting snagged somewhere but didn't know what formula to apply to stop it. I didn't think it mattered how the tree was structured, but I think I've got it now. The AI now offers appropriate amounts of firebirds for techs, and doesn't beg for techs that aren't that useful. It's also gratifying to see the Houses kinda move along unique pathways I imagined for them: Hazat is warlike and aggressive and builds heavy tanks, al-Malik researches the fourth Industry branch, Decados goes for biotech stuff, etc.

Sukayo
Noble
Posts: 351
Joined: Thu Oct 12, 2000 1:01 am
Location: Brno, Czech Republic
Contact:

Re: Tinkering with the AI

Postby Sukayo » Mon Jan 02, 2006 9:22 pm

great!

what happens if the higher techs (better units) are getting a better weight - easier to get?

Grimly Fiendish 2
Assault Legionnaire
Posts: 89
Joined: Wed Jun 15, 2005 1:01 am

Re: Tinkering with the AI

Postby Grimly Fiendish 2 » Tue Jan 03, 2006 9:23 pm

In this scheme, higher techs are no more likely to be expensive than lower ones. That is, Mastiff Heavy Tank, for an example, has no outputs but probably has a few inputs (Armored Golems, Heavy Tank Gun? I'm at work so I can't check). So it's probably worth 200 or 300. Which is close to the original weight, and it's easier for the AI.

But Armored Golems itself is worth 900, because it leads to all the heavy tanks. So if you get that tech for free or buy it you are way ahead. I think it's my most expensive tech.

So yes, there are some important milestone techs, but something like Cadiz Heavy Cruiser/Dreadnaught is pretty easy to pick up once you have researched all the expensive jump drive/monopol/meson blaster techs. It all depends on the tech tree.

Note, using 100 as a multiplier is good for humans but may be tough for AI players. The multiplier could be 50 or 80 or whatever. Certainly the AI starts building Labs immediately, which is a sign that it estimates the research cost to build the most advanced units to be high, but which is not really wise and may slow down its development. A House should first develop metal and food and should attack rebel/other mines/farms, not immediately engage in research.

lordmoore
Space Legionnaire
Posts: 137
Joined: Tue Apr 11, 2000 1:01 am
Location: USA

Re: Tinkering with the AI

Postby lordmoore » Fri Jan 06, 2006 10:35 pm

Wwow, thats really interesting. I'd be interested in seeing how this works for the later stages of the game?
Enemies strengthen you.
Allies weaken.
I tell you this in the hope that it will help you understand why I act as I do in full knowledge that great forces accumulate in my Empire but with one wish--the wish to destroy me.


Return to “Fixing it ourself”

Who is online

Users browsing this forum: No registered users and 15 guests