Jump to content


Photo

The follies of C&C3 XML AI coding - anal retentive!


  • Please log in to reply
32 replies to this topic

#1 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,166 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 28 November 2007 - 02:18 PM

Let me see outright that going from Dawn of War AI (pure LUA coding/programming) to C&C3 (pure XML scripting) has been a rough transition but it has absolutely NOTHING to do with understanding XML or the logic.

The problem is the utter frick'n stupidity and rigidness in the way the game's xml is locked down.

Case in point:

I have tried to relegate ONE buildorder for the Balanced (Optimal) Personality so I can successfully test a single sequence for the AI to follow. Normally I would simply tell the AI to use this one buildorder exclusively like this:

<OpeningMove Name="GDIStandard" Weight="100%" Difficulty="MEDIUM HARD"/>
I then "comment out" the other buildorders being called and that should do it. What does the f**king game do? It removes the BALANCED personality in the dropdown within the game menu. WTF!?!?!?!? What bloody logic is that?

I tried next to everything to get that to work wasting hours with different variations to figure out why the hell this code seems so gawd damn "locked down".

Also.. if I try to increase the # of infantry units to garrison a building to this:

<Heuristic>
	  <ConstantHeuristic Weight="1.0"/>
	</Heuristic>
	<TargetHeuristic TargetHeuristic="GarrisonHeuristic" TargetType="Garrison"/>
	<Tactic Tactic="GarrisonBuilding" TargetType="Garrison">
	  <TeamTemplate MinUnits="1" MaxUnits="3" IncludeKindOf="INFANTRY" ExcludeKindOf="SKIRMISH_AI_DONT_GARRISON" AlwaysRelease="false" AlwaysRecruit="false"/>
	</Tactic>
  </AIStrategicStateDefinition>
It crashes? WHAT THE HELL!??! Note I only changed MaxUnits to 3 where it was 2 before.

Further, if I simply try to increase the likelihood that larger base defenses are built in the later game to this:

<UnitModifierByName UnitName="GDITerraformingStation" UnitPreferenceOffensiveModifier="200%" UnitPreferenceDefensiveModifier="200%"/>
..the frack'n game crashes! Note the DefensiveModifier is now 200% instead of the original 100%. I've even tried 150% but no way...

Hell.. the way things are going.. I'll be lucky to script even the most basic tactics if I can't even do this simple sh*t.

GAWD!!!!!!!!!! Talk about damn anally-retentive.. and THANK GAWD I can reload the game from desktop-to-main menu in under 10sec (have a powerful comp) and thus turnaround times aren't so bad but imagine a coder who had a 2+ year old machine doing this kind of troubleshooting? Forget it.

Frustrated as sh*t.. thank gawd I have my Dawn of War LUA because C&C3 makes it look like childs-play vs this anal crap. <sigh x 50>

Someone needs to contact EA and drop kick em for this as LUA coding is sooo much more forgiving (at least the game gives you an error but doesn't CTD AND doesn't lock the script files when the game is running).

So dunno.. perhaps EA's XML AI people can enhance the AI further based on that list we have. I would hate to hell to script advanced tactics for the AI if I can't even isolate a simple buildorder. What does THAT tell you about the whole XML framework and its relationship to the game code? <essssssssssssh!> :mad2:
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#2 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 28 November 2007 - 02:37 PM

You know, you're starting to make me really interested in that stuff. Unfortunately I can't do anything modding-related until the 13th of december, but after that I might actually take a look at your unsolvable problems :mad2:

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#3 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,166 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 28 November 2007 - 02:47 PM

Thanks DLotS.. I'm trying to get Hogo up to speed as well.

Essentially I have completed the following:

o All AI building placements are set fine now (although AI tends to place tech buildings and superweapons around the HQ area sometimes bias towards the enemy but I fear this is hardcoded as I don't have access to change the placement code. I would prefer to have all tech and superweapon buildings bias away from enemy startpoints but without access to what "Homebase" or "Back" means I can do squat.

o Buildorders seem stable now - I can easily get the AI to tech to Superweapons and all other techbuildings more reliably while maintaining its offensive effectiveness. The key here was to have a good build order that makes sense. However, I cannot get the AI to put down base defenses very reliably as the stupid code crashes the game on utterly trite changes which is beyond the pale in terms of logic. I've never experienced such "rigidity" since Generals/Zero Hour (oh wait.. THAT WAS MADE BY THESE SAME PEOPLE!!! Oh wow.. imagine frick'n that!!?!?).

Thanks everyone... baby steps, people...
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#4 Hogo

Hogo

    Pro Mapper XD

  • C&C Guild Staff
  • 1,295 posts
  • Location:England
  • Projects:Enemy Enhanced, Mapping
  •  Friendly face
  • Division:C&C Guild
  • Job:Division Staff

Posted 28 November 2007 - 04:14 PM

I feel special :sad2: Im trying to get some coding done I managed to get the AI to use bikes vs eco but didnt work as planned. Firstly I know your trying hard Thudo and We can get through this. Second it takes me 30 Secs to load the game so not long but annoying to test.

I hope we can make some progress quickly I have many Idea's :mad2:

#5 Sûlherokhh

Sûlherokhh

    Sagacious Engineer

  • Project Team
  • 3,754 posts
  • Location:Central Germany
  • Projects:S.E.E., Sage A.I., Code Advisor
  •  'Axe'er of the Gordic Knot

Posted 29 November 2007 - 04:10 PM

...
I've never experienced such "rigidity" since Generals/Zero Hour (oh wait.. THAT WAS MADE BY THESE SAME PEOPLE!!! Oh wow.. imagine frick'n that!!?!?).
...

And now imagine that tactics and strategy are hardcoded. That's BfMe2, made by, oh no... THE SAME PEOPLE?


...
GAWD!!!!!!!!!! Talk about damn anally-retentive.. and THANK GAWD I can reload the game from desktop-to-main menu in under 10sec (have a powerful comp) and thus turnaround times aren't so bad but imagine a coder who had a 2+ year old machine doing this kind of troubleshooting? Forget it.
...


Aaargh! That's me!! ;)

I wish exchanging notes would help. Damn. Wrong game. *sigh*

bannerreal01mittelit3.jpg
Axed Head and A.I. Coder for S.E.E. and ... stuff

".. coding is basically boring. What's fun is finding out how things work, take them apart and then put them together in ways that were not intended nor even conceived."


#6 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,166 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 29 November 2007 - 04:19 PM

Now you know why I have been with the Dawn of War game for 3+ years and the 3d official expansion is coming? Scripting AI with LUA is sooooooooo vastly more flexible.

But yeaahh I had expectations well before C&C3 shipped that the coders/devs would have made this easier and flexible considering what their developer diaries were revealing about how and why they moved to XML.
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 Sûlherokhh

Sûlherokhh

    Sagacious Engineer

  • Project Team
  • 3,754 posts
  • Location:Central Germany
  • Projects:S.E.E., Sage A.I., Code Advisor
  •  'Axe'er of the Gordic Knot

Posted 29 November 2007 - 04:27 PM

Like you, i am not giving up, though. Seems the WB-scripts from BfMe1 are still working and there are actually lines in the BfMe2 code where you can disable the hardcoded skirmish AI. Will be quite a workload to design the AI almost from scratch, but at least it's possible. Have you considered using WB-scripts? I haven't tried it on CnC yet, but seeing that it is the same engine and probably almost the same WB, it could work...

bannerreal01mittelit3.jpg
Axed Head and A.I. Coder for S.E.E. and ... stuff

".. coding is basically boring. What's fun is finding out how things work, take them apart and then put them together in ways that were not intended nor even conceived."


#8 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,166 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 29 November 2007 - 04:31 PM

I haven't got my head around a total code re-write. That currently is a long distance objective.
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 Sûlherokhh

Sûlherokhh

    Sagacious Engineer

  • Project Team
  • 3,754 posts
  • Location:Central Germany
  • Projects:S.E.E., Sage A.I., Code Advisor
  •  'Axe'er of the Gordic Knot

Posted 29 November 2007 - 04:39 PM

Tell me about it. ;)
I won't be doing it either in the near future, but it seems to have a chance of working and provides a lot more control over production, tactics and general unit behavior. Anyway, i am happy for every small imrovement of the AI and will be secretely cheering you on for every small success (or stupid crash) that helps you farther on that road. Nothing as bad as a stupid AI. Even a badly balanced or crap looking game is pure brilliance if it has a good AI. You are making this game challenging for years to come. EA should send in all AI development notes to you. They are the only ones making a monetary profit from your progress. :p
Oh how i wish i could rewrite those shitty hardcoded AI routines (and some more), hehe. :mellow:

bannerreal01mittelit3.jpg
Axed Head and A.I. Coder for S.E.E. and ... stuff

".. coding is basically boring. What's fun is finding out how things work, take them apart and then put them together in ways that were not intended nor even conceived."


#10 Spikey00

Spikey00
  • Members
  • 153 posts

Posted 29 November 2007 - 11:58 PM

Sorry to hear about all these complications... Is there any way to request help from the actual AI programmers? I'm sure I'm missing something, as I'd know you would of done so before.


Besides that, could I have a play with what you already have? Any improvements to the game would be fine to me. Not too sure where to install it though, if you do post it up here. =X

I still wish you good luck on such brutality of scripting unseen by anyone.

#11 Sedistix

Sedistix
  • Members
  • 51 posts

Posted 12 February 2008 - 02:30 AM

I've ran into the same problems as all the ones mentioned above. No matter what I change, or how insignificant it is, it always ends in failure. I have however found some success when creating completely new AI sets off originals.

Rather then editing existing states, targeting, personalities, and openingmoves you should go about creating an entirely new type of ai along side the existing ones.

So in the drop down you will see (In no particular order)

Random
Balanced
Steamroller
Rusher
Turtle
Guerrilla
Experimental

Copying all of the files necessary for a new AI and then changing all the references in them, is a major pain, but it does show signs of potential.
In my opinion, the inability to modify the existing AI as yet, is not an accident. The complexity behind it feels deliberate. I can only speculate that the designers are cruelly encouraging modders to create addition content, as opposed to modifying their existing content- at least in regards to the AI.

As for editing the originals. If you or anyone else has any success with alterations to the stock AI's, please share the wealth of knowledge.

(EDIT)

During my early testing with the SDK, I gave several units on all sides extraordinary weapons just for some laughs, but in doing so. I noticed the AI seemed somewhat aware of the changes each unit had.

I upgraded the grenadiers with massive range and damage rates, and low and behold it's now the GDI's new favorite unit, consistently, map after map. Same went for the beam cannons when I toyed with them as well. I don't believe it was a coincidence either.

Edited by Sedistix, 12 February 2008 - 02:45 AM.


#12 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,166 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 12 February 2008 - 02:34 AM

I've ran into the same problems as all the ones mentioned above. No matter what I change, or how insignificant it is, it always ends in failure.

Thanks Sedistix -- wish I had any news because the amazing expansion is still inbound and no advanced AI thanks to the amazing inflexibility of the code.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#13 Sedistix

Sedistix
  • Members
  • 51 posts

Posted 12 February 2008 - 03:31 AM

I'm going to keep at it, and if and when I'm successful, I'll share the info.

#14 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,166 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 12 February 2008 - 04:19 AM

Fantastic, Sedistix! We're moving closer to the expansion and any forward motion towards superior C&C3 Ai would be a huge deal.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#15 Guest_Kromus_*

Guest_Kromus_*
  • Guests

Posted 21 February 2008 - 12:49 AM

Fantastic, Sedistix! We're moving closer to the expansion and any forward motion towards superior C&C3 Ai would be a huge deal.


I just wanted to encourage you on..... As a HUGE fan of your Skirmish Mod 2.7, Its very exciting to see you approach C&C 3... Best of Luck... and if you need testers for this C&C AI, just shout out....

I would recommend checking out the BFME2 code and ZH ... Mabey some of the Mods ( Revora is FULL of them ) who have published can point you in the right direction?... just an idea.

Thanks

#16 Spikey00

Spikey00
  • Members
  • 153 posts

Posted 08 March 2008 - 02:09 AM

Oh, that's a really interesting discovery, Sedistix.

All I can assume for that is perhaps the KDR/efficiency/etc. that makes it use it?

#17 Sedistix

Sedistix
  • Members
  • 51 posts

Posted 10 April 2008 - 10:10 PM

Well it's been a few months now. Still no success, and I've gone through as much trial and error as I can stand. I'm abandoning my attempt at modifying the AI in CNC3, and any expansion packs to follow, out of pure frustration. I've wasted countless hours on this project, and to no avail. (Hell of a way to spend my winter vacation too.) Yet I take from this experience, some satisfaction, from the fact that I tried. Can't ask for more than that.

I will continue modifying the game units, structures, and game play mechanics into the foreseeable, but as far as the AI goes. I'm at a loss, and will waste no more time on it.

To those of you here who are still attempting to modify the AI successfully, I wish you the best of luck. You have no easy task before you.

(If any assistance via modders, updated SDK, EA or whatever else ever comes I may return to this department but I won't be holding my breathe.)

-Sed

#18 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,166 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 12 April 2008 - 03:28 AM

Thanks Sedistix for the update! Yea pretty tragic how inflexible the C&C3 AI is.. now that KW's been out for 3+ weeks and no SDK or new AI files to play with I'm finding the whole C&C3 thing just a bummer. I cannot understand the problem with the XMLs because the code is easy to use but I change one gawd damn value on even a percentage and it crashes. F**K!!!

The logic in this code is simply crap!

I also super-hate having to compile the AI into a binary file for the game to read. REAL GHEY! Encrypting all that from the ground up was such a frick'n horrible design decision. In Dawn of War, if you extract the data from the main sga files (which are massive) and place them into a directory, they read those extracted files overtop the ones that came from the sga thus its super-easy to mod files because they read those instead of the ones in the sga which is bloody smart and fast. Not with EA.. bloody locked down architecture. Great way not to sell more copies by engaging people's imagination by extending the life of the product. How sad..
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 Sedistix

Sedistix
  • Members
  • 51 posts

Posted 12 April 2008 - 06:30 AM

I know of your work Thudo. I recently, and quite late I might add, purchased Dawn Of War, and I thoroughly enjoyed your works in it. Before that it was Generals (Not a fan of zero hour). Great stuff, and really helpful. I hope you continue with such projects in future games.

As for your sentiments on CNC3. I empathetically agree. It was a monumental mistake to utilize XML in the game structure like they did. Most new games are open ended to modders, and directly invite user modification. Many of them even do so without the inclusion of extra tools. Supreme commander for example. All you need to mod the hell out of that, is winrar and notepad. In fact a lot of games are now placing assets in compressed files as opposed to encrypted ones. Simply extract, modify and insert or place. With CNC3 though, it's a nightmare by comparison.

Great game, but extremely disappointing for modification value.

Hopefully someone along the way will find the key.

Edited by Sedistix, 12 April 2008 - 06:31 AM.


#20 Mastermind

Mastermind

    Server Technician

  • Undead
  • 7,014 posts
  • Location:Cambridge, MA
  • Projects:MasterNews 3
  •  The Man Behind the Curtain

Posted 12 April 2008 - 07:21 AM

I know of your work Thudo. I recently, and quite late I might add, purchased Dawn Of War, and I thoroughly enjoyed your works in it. Before that it was Generals (Not a fan of zero hour). Great stuff, and really helpful. I hope you continue with such projects in future games.

As for your sentiments on CNC3. I empathetically agree. It was a monumental mistake to utilize XML in the game structure like they did. Most new games are open ended to modders, and directly invite user modification. Many of them even do so without the inclusion of extra tools. Supreme commander for example. All you need to mod the hell out of that, is winrar and notepad. In fact a lot of games are now placing assets in compressed files as opposed to encrypted ones. Simply extract, modify and insert or place. With CNC3 though, it's a nightmare by comparison.

Great game, but extremely disappointing for modification value.

Hopefully someone along the way will find the key.

Compiled != Encrypted. The reductions in loading time from the way that things are done in C&C 3 is a huge bonus, and is the main reason for the way the engine works now.
Posted Image

Well, when it comes to writing an expository essay about counter-insurgent tactics, I'm of the old school. First you tell them how you're going to kill them. Then you kill them. Then you tell them how you just killed them.

Too cute! | Server Status: If you can read this, it's up |




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users