View Full Version : dom 3 wish: mod AI
October 19th, 2004, 10:35 AM
I've got it! Make battle troops scriptable in a nice simple standard free language like Python or Lua (don't invent your own mini-language), and have scripts loaded as mods.
This is a win-win:
1. Illwinter can spend less time on AI coding because the Dom enthusiasts will do it for you and they won't even charge you money.
2. AI gets better, which is widely wished for single-player games.
3. Your troops do stupid things less often in battles (or at least they do more different kinds of stupid things instead of the same stupid things all the time).
4. BUT, game balance is not as badly distorted because both sides use the same mods.
5. Likewise, Users don't try to write scripts in the "Battle Orders" interface in the game. If they are programmers, they can go write their own script mods. If they are just game-players, then they choose from a nice simple set of options which is at least as simple as the current Dom2 battle orders.
Question: should individual mods be selectable from the Battle Orders menu? Instead of instructing my Grand Inquisitors to Attack, Cast A Specific Spell, or Retreat, I could instruct them to follow "Zen's Battle Mage Mod 1.01".
P.S. Dear Illwinter hacker(s): don't tell me you don't know Python. Yes you do. Go spend 30 minutes reading the Python tutorial and you are fully capable of implementing battle mods as Python scripts.
October 19th, 2004, 12:25 PM
I do not even understand what you want the AI mod to do.
Is it supposed to give all commanders and squads in the game the same orders? With the help of Python?
October 19th, 2004, 12:53 PM
I'm confused too. If Zooko is saying, let modders add new battle orders programmed via python, I think that would be an awesome idea. It would also be nice to be able to use this same concept at the macro level with AI control of nations.
Kristoffer, clearly you guys are great programmers judging by the quality of Dom and CoE (and the clear improvement curve between them!). However, if you need some pointers regarding integrating a python engine, please ask. Myself, and I'm sure other folks on the board are software developers with a great deal experience at simlar tasks.
Part of my interest in seeing a better AI for Dom 3 is because of having written so many "AI" type systems. Unfortunately, none of them have been for gaming applications, they've all been for things like cancer detection and buisness sales analysis.
October 19th, 2004, 01:07 PM
I'm a lousy programmer. I could perhaps make a program that creates a text output (name, gender and race) based on your choices (name, m/f, hobbit/elf). I can read code and I can enter new stuff in a fasion similar to previous stuff (new monsters, spells etc), but I'm no great programmer. All programming (except stats for new monsters, spells, items and descriptions) is made by JK.
JK on the other hand is a remarkable programmer (at least by my standards), but I don't think he would mind asking if he needed some input. I'm sure several fans would answer if he asked. Thanks in advance! http://forum.shrapnelgames.com/images/smilies/happy.gif
Caner detection is a good thing. Probably more important than gaming http://forum.shrapnelgames.com/images/smilies/happy.gif
October 19th, 2004, 01:35 PM
One direction in scripted AI's is one I have experience in from my mud. There was a client program (tintin++) for connecting to the MUD game which allowed you to create trigger/response commands and store them to a file. Its simplest use was to automate some actions such as low hitpoints causing you to remove backback, take heal potion from backpack, quaff potion, wear backpack. The "programming" done by Users got so extensive that we started having problems with "bot" (robot) players which would spend hours gaining experience or practicing skills while the person was off at work or asleep.
Eventually we started programming our own Version which became very popular. It had conversations, told jokes, had help files for the game which people could ask about, it sold certain useful items and cast spells for money, it did emergency summoning when people shouted for him to, identified common items, etc etc. It got to the point that it had to run from another machine (remember it ran as a player connecting from outside to the game). It used as much CPU as the game itself did when it was running and handling 100 Users.
Anyway, IF a game is written to send and receive info in a way which can be used (such as a text mode), then a program can be written (even one by a third party) to allow scripting all actions. IF I do a certain thing and get a certain response back THEN do this other thing. You could put alot of time and effort into creating a bot which plays Pangaea as sneaky armies, and Ulm making more use of its heavy armor, and Arcospale more defensive while researching/using major spells. Or even 9 different peoples concept of how the AI should best play Ulm.
I dont think that would be easy to do for this game.
So, an alternative..........
Creating a new text file for AI controls, and a new directory for AI modules. Programming AI modules which can be listed in the text file for setting wide parameters for an AI. Such as, a build priority list. A combat spells priority list. A global spells priority list. Items, summons, research,A preference/avoid list for which nations should be actively sought out and attacked in what order.
These can either be done by the programmer in tight programmed modules so that you start out only getting to choose 1 out of 3 different build-queue preferences. Or open text files. There are pros and cons to both.
Just from me personally:
The thing I like most about Version 2 is that its more open to randomization http://forum.shrapnelgames.com/images/smilies/happy.gif
And for a scripting language Id think that Basic would make sense. thats kindof what its for.
October 19th, 2004, 02:22 PM
Sorry to be unclear. What I want the AI mods to do is just to control the behavior of units in battle. For example, if I've loaded Zen's Battle Mage AI Mod, then whenever my battle mages have no specific battle commands, they don't do the normal battle mage AI implemented by Illwinter, but instead execute the code from Zen's Battle Mage AI Mod to determine what they should do.
This would presumably make mages more powerful in battle as the modsters figured out better and better AI's.
Does this sound like a sensible notion?
The other thing that I mentioned is that the player might be able to select among mods on a per-unit basis. For example, as a "general action" instead of Cast Spells, Attack or Retreat, you might have "do as Such-And-Such Mod says to do" button.
October 19th, 2004, 02:59 PM
Zooko, your idea would have several problems:
* it would be very easy for the AI programs to "break" the game, unless some very strict control was exercised by the game engine interpreter. Bad programming on the player's part could result in the game hanging, or crashing, or whatever. MP would become a nightmare...
* even if done in a foolproof/attackproof way, it would turn the game into a programming contest. There are already "games" that are actually programming contests, but I don't want Dominions to turn into one of them.
October 19th, 2004, 05:07 PM
Those are good objections, PhilD, however there are good responses to each of them:
*) one could design the interface so that a buggy mod could (more or less) never break the game. Python starts by being memory-safe, so you're already safe from memory mismanagement. You can make the mod single-threaded, so you are safe from multithreading issues. You can offer only a limited ability to manipulate the game (basically just "this creature moves", "this creature casts this spell", etc.).
*) the game would be a programming contest only if you got to use your own mod and your opponent didn't get to use your mod. But that's not the idea. Rather, it would be just like the current modding system: the server would have one or more mods configured at the beginning of the game and all players would have access to the same mods.
In the simple case that AI mods are invisible to the player, this would just mean that the behavior of your battle mages would depend on what mods were configured for the game, rather than being the default battle mage AI.
In the more complex case that players get to choose specific mods for specific units, at least all players would have the same options.
October 19th, 2004, 06:21 PM
Well, just my 2 cents:
If the game is in really early developement, and you are considering rewriting the strategic map engine, please please consider doing it with open file formats.
That would mean that a .trn file has (encrypted by the turn password) all the data of the game situation that the player nation is capable of knowing in just (zipped) plain text. The format already exists as your modding commands, just reverse the # and no # to save some space.
<font class="small">Code:</font><hr /><pre>
province 112 (owned rich province)
site = "ten thousand things"
scales = 1, 1, -1, 3, 1, 1
province 113 (seen indie province with neg dom)
scales -1, 0, 0, 0 ,0, 1
unit 23 (pretender)
owner = 2
location = 112
type = 10
affliction = lost an eye
item 26, 37 (eye of aiming, robe of invulnerability)
Battleorders cast 13, cast 15, cast 15, flee
battlelocation -20, -20
unit 1001 (some standard HI with nothing special quarding commander)
location = 113
leader = 23
squad = 4
Battleorders = guard commander
battlelocation -20, -20
type = 50
In the same way, the .2h would have all the orders in encrypted zipped plain text.
<font class="small">Code:</font><hr /><pre>
battleorder cast 113, cast 114, cast.
battleorder attack closest
battlelocation 20, 0
When the host executes a command, it first uses it's own fthrland file, that has all the real info on the game, to check if the move is possible, then executes if it is or disregards until the next end if not.
This would make it impossible to cheat, other than trying to break the encryption on other player's turns, and nothing stops the game from saving different things in a turnfile all mixed up making it very hard to break the code.
This way, everyone who thinks they can do a better AI, can try... The big question there is, how much extra work would that be? I have absolutely no idea...
October 19th, 2004, 07:43 PM
Gandalf's and Tuna's ideas sound excellent for strategic-level AI -- recruitment, army moves, research, etc.
For battle-level AI, those techniques won't work.
I highly approve of either or both of these kinds of AI mods -- strategic AI mods and battle AI mods.
vBulletin® v3.7.0, Copyright ©2000-2013, Jelsoft Enterprises Ltd.