Jump to content

Mission AI Research


mvi
 Share

Recommended Posts

In an effort to explore the remaining unknown section of mission files - the ai - I have created this topic.

Unfortunately, due to very limited spare time, I don't have a great deal of time to play test Dune 2000 to see how changes affect behaviour.

Can anyone confirm that AI copying does work and give any good examples?

Link to comment
Share on other sites

I've just tried replacing the AI from A9V1 side 1(Hark) and overwriting the existing AI in A2V1 side 1 (Hark).

I also upped the tech levels and money for the side to facilitate it doing more advanced actions.

The AI appears to behave exactly the same, which is rather interesting.

It also doesn't appear to expand its base. It's been some time since I've played single player, I know in practice multiplayer mode the AI will strongly expand its base, in single player does this behaviour still occur? Will an AI side in single player never ever build a building?

Link to comment
Share on other sites

Since I recently exported all the vanilla (default) mission ai segments, I had the idea that generating the CRC hashes would show us the duplicates.

I've uploaded the hashes in a text file if anyone is interested (and understands what I'm on about). Identical hashes mean that the AI data is exactly the same.

Of the 360 AI segments that come with the game, there are 109 unique segments. Most of the duplicates appear to be empty sides, so it certainly implies that some level specific behaviour is going on.

output.txt

Link to comment
Share on other sites

Will an AI side in single player never ever build a building?

Do you mean a scenario in which an AI with maximum tech level and, say, 20 000 solaris of spice, has, say, a Construction Yard, 2 Wind Traps & Refinery in the beginning? If that’s the case, then I guess it won’t build any new buildings, unless you add some via the klofkac’s editor, of course. As far as I know, the only case when an AI builds a building (in single player, that is) is when you destroy one of its existing buildings. In other words, the enemy AI in single player won’t build any new buildings (even if it has the means to do so), it will only rebuild the ones which were destroyed.

Speaking of weird enemy behavior, if you try to edit some of the earlier levels (say, A1V1) and add a Starport to the enemy, it won’t order any units per it, even if you overwrite it’s AI with an enemy AI from some of the later levels. The only way to make the enemy use the Starport in these earlier levels is to make a Starport delivery event via your mission editor (with a corresponding Building exists = Harkonnen / Atreides / Ordos / Smuggler Starport Condition, of course). I guess it's that "Building exists" condition which makes the AI to somehow "recognize" it has a Starport to use...

Also, in the levels where the enemy receives an automatic Starport delivery (as far as I know, it’s only the Emperor whom the authors of this game granted this “privilege”), this particular enemy won’t order any new units per the “usual” way (i.e. by buying it), just like a “regular” enemy owning a Starport would do. However, if you rewrite its AI with some other AI from these later levels, it will receive these automatic deliveries & order new units as well (which can be pretty brutal). For example, in the O8V1 level, I added Smugglers & Fremen as my enemies & gave them both a Starport & a nice 200 000 chunk of spice (so that they can spend that spice a bit, LOL). Also rewrote the Emperor AI, so that they could receive the deliveries & order new units as well, and well, what followed was one helluva mayhem!

Link to comment
Share on other sites

  • 1 month later...

I would also love to be a part of this research MVI, I have created 3 different campaigns for the each of the houses, in which each house you play, you have an ally base that I customly created. What I have come to notice is that all AI players that were not coded specifically for each map, have sort of a default campaign AI, which is pretty much build units, attack and defend, while rebuilding destroyed buildings.

How ever sometimes the AI can be erratic and not limited to what they build if using a default code. What they will do is randomly create units such as MCV's, Engineers, and make a mass supply of harvesters without a limit. Ive also noticed that sometimes the AI will Turtle, which means that they will build mass amounts of units and defend the base, while attacking very slowly, its quite interesting. Westwood coded each campaign ai specifically for each map. For example, you would notice that some missions, the coded AI have specific buildings to utilize. Take A4V1, where you must protect the fremen. The Harkonnen will mass build infantry to counter attack the fremen.

If we were able to decode the .mis file for each house, we could do amazing things for each of the AI players.

Link to comment
Share on other sites

That's interesting Sandworm, we should make a test map, then copy in AI from different missions and see what changes. If we wrote down a list of what happens when we try different mission's AI on the same house on the same map it would be extremely helpful in the process of reverse engineering the AI.

On a related note, I've also got a theory regarding special values in map files. I've yet to test this, but when I was making Mulciber valley I noted that rather than attack me, the Harkonnen units trended to a certain point. Now, I seem to recall when I was working on map special values that there were a bunch of tiles with special values outside of the list Daxx and I put together

EDIT: Ok, took a look at the Mulciber mission and it doesn't look like this particular map file has any of those special indices, I think perhaps the Atr mission where you have to capture the starport (A5V1?) does have some of those special indices though, but if they're not in every mission they may not necessarily be used.

Link to comment
Share on other sites

Progress made: I've been talking to CCHyper a bit and I've managed to isolate a lot of data types in the segments. I have no idea what they do, but it means we now can divide the segments up and work out which each bit does. But this is a long way away from being useful.

Link to comment
Share on other sites

Ok, some preliminary findings. I haven't tested this yet, but this looks very likely

4 - Buy_Units From_Startport

5 - Upgrade Buildings

7444 - Can Repair Units

3926 - Do Attack Approachers

7493 - Rebuild Buildings

Note: If you hex edit .misai files you will need to deduct 1 from the index listed because .misai files trim the first byte from a segment.

  • Upvote 1
Link to comment
Share on other sites

Outstanding findings MVI. This data is pretty much the last piece of the puzzle. We will be able to completely customize our AI in campaign games.

Please keep us updated as I will do the same, Ive found some small findings such as skirmish style AI coding but thats really all.

Link to comment
Share on other sites

Skirmish AI is easier to decode since all AI use the same code for a practice match. However I was able to switch just one value in a Campaign mission that caused the AI to behave like they would in Skirmish. It happened awhile ago so I will need to find it again.

Link to comment
Share on other sites

Nice, I suggest to search for it cuz skirmish AI in campaign will improve the AI.. campaign AI sucks in my opinion. I'm not sure if on different difficulty levels the AI is the same.. I have a feeling that is not! I will look for this

Link to comment
Share on other sites

The difficulty levels I think only changes the cost of structures and I think increases the speed of which the AI is able to produce units thats all. However I think Campaign AI can be greatly improved if we were able to decode it.

For example:

Increasing their attack power (More units)

Increasing their defense power.

Rate at which they rebuild lost structures

ETC.....

Hopefully we can figure out what the values do, so far MVI and others have made great improvement, and hasnt let us down yet!

EDIT: Oh, I also wanted to know if anyone knew how to disable the starport limits in the mis files? Or is that something that can not be done?

Link to comment
Share on other sites

If you download TSearch, you can view the AI segments in memory by going to memory address hex: 4F4118 (for index 0) add dec: 7608 for each subsequent segment. Note .misai files trim off the first (side) byte and are therefore 7607 bytes.

Link to comment
Share on other sites

  • 2 weeks later...

20120205182756796.png

Screenshot from the forthcoming 0.4 release.

I've tested the rebuild buildings option and can confirm this works. I have no reason to think that the others listed won't work too.

There are a lot more variables in the AI than the 5 listed here, but this is the start.

The AI specification e.g. "Rebuild Buildings" is read from a text file I've included, so if I include any unknown entries then if you figure it out you'll be able to actually change that name yourself.

Edit: Can confirm "Can Repair Units" works too

Edited by mvi
Link to comment
Share on other sites

MISSION EDITOR 0.4 PREVIEW RELEASE

20120205192356110.png

Includes early support for editing a number of AI elements. Only 5 of which are known.

I need your help working out what the unknown ones do.

We know for example if we take the AI from an AI side and apply it to the player's side that automatically buildings are repaired, units are assigned groups and moved about, infantry is built etc.. We need to work out which entry does each of these things. The simple way to start is to record the values before and after, then go through the list on the original file adding values from the AI and working out what happens.

Download

  • Upvote 1
Link to comment
Share on other sites

Wow, this looks like another stellar work from mvi! Would be fascinating, for example, to find out, how exactly the enemy AI works when attacking you. I mean, in some levels (I'd say in vast majority of them), the enemy will just build its usual share of units & then attack you without causing too much trouble. But when you look at, say, the H9v1 level (which is my all-time favourite, mainly because it's the most difficult one from all the levels in the original Dune 2000 campaign), the enemy, particularly from the main Atreides & Emperor base, will often make a MASSIVE & COORDINATED ATTACK, which, unless you don't have a sufficient defense, will almost invariably smash you to pieces. What I like on it is the fact that it is massive & coordinated as well, i.e. both Atreides & Emperor build & train & order a lot of units of all kinds (i.e. combat tanks, missile tanks, quads, sonic tanks, Sardaukars, etc.) and attack you simultaneously, as if they somehow "knew" that doing the attack together will defeat you. Don't know if it happens purely by an "accident" or whether the enemy AI is indeed programmed to do it that way, but what I do know is that it doesn't happen all the time when you play this level :(, but when it does, it's one helluva experience! 8) Would be fantastic if you could somehow apply such AI to the enemy...

Btw, a quite opposite enemy behavior you can come upon is, for example, in the O9v2 level. In the Harkonnen base, there's a small "sub-base" of Emperor, containing some turrets, the palace, wind traps and barracks (of course, this base works independently from the main Emperor base, as it originally "belongs" to Fremen but shares the same index allocation number with Emperor). Since it has also a refinery with 2 harvesters & a carryal, it has more than enough money to train vast armies of light infantry, sardaukars or troopers (which would certainly make your life harder!), but what's strange is that this base won't train any new units, unless you come too close to it. That means: no attack on your base at all...

Link to comment
Share on other sites

Heres the take on the AI, as for what you said Hawker your pretty close. I need to do more research but this is what I get out of it. Each AI in every level is programmed specifically, in which im pretty sure you guys knew.

The AI is coded to be pretty much told what to build/train/construct etc. For example the AI you mentioned for the emperor in 09v2 trains its infantry at a fast rate, as well as receive its units via starport. However it does not utilize the heavy factory as much as the other houses you would say because im pretty sure westwood did not want to overpower the player with 2 sets of harkonnen tanks :-p. After a certain time, or when it has the amount of units its coded to create, it attacks. As it attacks it also leaves a certain number of units to defend. AI without coding, if you have ever tried it, build randomly. And when I say random, I mean RANDOM, they will create engineers and roam them around aimlessly while sometimes taking over a building, they will build a bunch of MCV's! And wont use them. They will even sometimes build 20 harvesters! So pretty much, AI that has specific coding is told what it can build and what it dosent. Another weird thing is the AI without coding will attack walls while ignoring some buildings, so again, they are coded to attack just buildings and units most likely.

Another example would be the 2 sub-bases of the atreides in 05v1. Theses bases train mass amounts of infantry, which is obvious since they only have a barracks, how ever, When I gave a default AI just a barracks it does not build an army of infantry, since AI without coding pretty much builds a variety of units, it does not have a limit.

As for the simultaneous attack in 09v2 I do not think that is whats happening, it is coincidental, because they receive these forces at the same time. The AI attack either by having the right amount of units to attack with, or certain time limit but I doubt there is a time limit because the AI wont attack with just a few infantry :) .

Im going to use MVI's program when I get home from work tonight, ill have alot more time and I cant wait till we crack the AI code :laugh:

Link to comment
Share on other sites

Nice job mvi, but what about skirmish/LAN? I am very curious in what file can we find practice/LAN AI.. Because the current AI sucks and puts no challenge for the human (the only challenging match, when it comes to LAN, is human vs 4 allied AI, otherwise it's just too easy). I know that skirmish AI is different than campaign, but after you research campaign one you should try to look for practice/LAN also, ofc if u have time. Basically when it comes to LAN AI there is something that would be needed, and that is allowing the AI to build 3 heavy factory, 3 light and 3 barracks. And also, to force them to build more refs and harveys in order to have a stable economy, and them make the AI to build FASTER the units from the factory. If you take a look at LAN AIs or practice, they build a tank, then wait some secs and build a light vehicle, and etc. so they delay ... These things will make the AI more interesting. And btw, I think that practice AI is not 100% the same with LAN AI. I noted that skirmish AI builds slower, he stops after he has something like 2 refs, 1 barr, 1 heavy and 1 gun turret and just after some time they start to build again. This doesnt apply to the first two AI in the game, they are building like in LAN I think. The difference between practice and LAN is that LAN AI doesnt stop building and builds faster, as u must have noticed if u ever played LAN. Sandwork said that he found skirmish AI and enabled it in campaign.. That would be an interesting thing, you should search for it again :) (not 100% sure about the informations regarded to practice vs LAN AI, but there is surely something different between them).

Link to comment
Share on other sites

Ok, after giving it a go I did a little testing on the AI. I used O9V2.mis file for the testing. What I was aiming to do was set the ordos (player) to AI, and I started copying the Harkonnen AI file, bit by bit. I placed the Harkonnen base next to mine and made them my ally to see what my AI was doing similarly to the Harkonnen AI.

It was kind of hard to find out what did what, but Im posting my findings in the txt file attached.

I still could not get the AI to STOP building MCV's and training engineers. How ever I found some other interesting things about a few byte sections.

I could be wrong on some of these findings, so if any one wants to continue from there, i encourage you too. Ill try and do some more.

Check out the txt file for more.

AI research.txt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...