• Civilization 7 has been announced. For more info please check the forum here .

The Civilization IV AI mod project

Some very good ideas presented here. I like a lot of the suggestions, but being a programmer, I'm always concerned with how to actually implement all these ideas.

@Theoden: Your suggestion of deducing what strategy the human player uses is a sound one, and for countering AI strategies it should be fairly straightforward, but for humans this is tricky. One way I can think of is by adding another step to the goal/strategy picking algorithm where the system analyzes the current position and attempts to find patterns that match known strategies. The strategy that fits in best would be elected as the opponent's suspected strategy. We could then assign a high score to goals/strategies that counter the opponent's suspected strategy. Also, we could add a larger random factor for human players, because humans can be considered much less predictable.

@Old Lion: Your ideas are good too and I agree that we have to consider all these things. But what I'm proposing is a generic system that can take any goal/strategy into account. Once we have this we can define exactly what kinds of goals exist, what kinds of strategies, what parameters these strategies have, what are the sub-goals, and so forth. In other words, I would like to make a system that can address all of the things that you said with an elegant model that has a minimal amount of messy details.

@SenJarJar: The AI mode that I suggested is not necessarily just one global mode such as "war mode". This is just an example. Remember that my algorithm works recursively. Every strategy can have sub-strategies, which in turn can have more sub-strategies. These strategies can have multiple steps. Every step of every strategy is one AI mode.

Another thing that has been mentioned in another thread is a way to address AI cheating. I think this shouldn't be too hard to do as long as the AI SDK allows us to limit the information available to the AI. We can construct a system made of several layers, as follows:

higest layer - AI
middle layer - analysis engine
lower layer - information gathering engine

The lowest layer only sees whatever information is available using the usual methods that human players have such as visible tiles, known civilizations, and known resources. Once we gather this information we pass it over to a higher layer that analyzes it and transforms it to something that the AI can use to make decisions.
 
@Brain: Oh, did I venture something unusable? Sorry. But I do get what you are trying to do. I just thought that the programming would be easier to design if the architecture of the machine driving the ai was built like twin columns joined at the base. But maybe I did not explain well how I was using the term Macro-mode. "Macro-mode" is merely my names for these two columns.

Basically what I mean is this: when the ai begins its turn, the first thing it would do is determine whether it was in a state of war or peace. After the ai makes this determination, it would then run the algorythm attached to that column. Of course, during any single turn, it could decide to crawl up the other column--in other words, it could decide to change its state of war or peace.

I don't doubt that I would lose any argument if I were to claim that this architecture is elegant. But I proposed it nonetheless because I thought it would benefit us by helping us divide one long machine into two shorter ones. That's all.:)
 
@Brain: Now that I've read your response again, I'm not sure I understood 100% what you were trying to criticize. If you were saying that I had proposed that there should be just a single global war mode, then it's all good because no one in this thread has made that proposal.:)
 
SenJarJar said:
@Brain: Now that I've read your response again, I'm not sure I understood 100% what you were trying to criticize. If you were saying that I had proposed that there should be just a single global war mode, then it's all good because no one in this thread has made that proposal.:)

What I think he's saying is that there are diffrant levels of war not just one big one. And even then each level of war can then be broken down into diffrant types of war.
 
I doubt I'll be able to pull the time away from work to be much help with this project. But if a miracle happens, I am a professional programmer and reasonable competent in C++ and interested. :D

I agree that the programming language(s) of choice should be whatever the SDK is in. Consistency with sample and future Firaxis updates to the SDK are not to be thrown away lightly. Plus, if modder AI code is easier to integrate into an expansion, it is far more likely to so be integrated.

It would be nice if strategic choices can be done in Python as much as possible. That opens up the number of people that can contribute. Presumably, the SDK has to make all the quick decisions. But strategic goals that get redone/tweaked only on the occasional turn aren't hurt by a little slowdown. What would be cool is if certain trade negotiations caused certain strategic code to execute. Then the leaderhead takes on a pensive expression and says, "I'm thinking, I'm thinking!" :D
 
Let's not forget...

We tend to speak as if we had to write everything from scratch.
The Firaxis AI will already have it's own sequencing,
and we can hope it won't be too bad.

We probably will mainly have to
1/ address its weakness if/when some appear
2/ add some "special strategies" or triggered events for mods
(exemple : join a crusade in a middle age scenario :
imagine you play the damas ruler when 2 thirds of europe decide they want to conquer Jerusalem....)

So it is likely we won't have to address the core sequencing often.

I think we should rather express what we want the AI to do (in plain english)
than how we want it to be done. We need to get the game, have a feeling of it and read through the available scripts before we can go to specifics.
 
Crazy Jerome said:
I agree that the programming language(s) of choice should be whatever the SDK is in. Consistency with sample and future Firaxis updates to the SDK are not to be thrown away lightly. Plus, if modder AI code is easier to integrate into an expansion, it is far more likely to so be integrated.

What I gathered from Soren's comments the SDK won't be in any specific language (besides possible examples). I think we are talking about a traditional API approach with an accessible non-language-dependant interface to the methods used by the application.
 
Well, the header files will likely be C++ header files.
 
Old_Lion said:
I think we should rather express what we want the AI to do (in plain english) than how we want it to be done. We need to get the game, have a feeling of it and read through the available scripts before we can go to specifics.
Yes, I agree with you. The design ideas I suggested were based on the assumption that the default AI will be poor at the strategic level and strong at the tactical level. Of course, we'll have to wait and see if that's true, and we certainly need to have more details before we can do anything.

So, let's hear the suggestions from everyone... What would you like the AI to do?
 
Old_Lion said:
so I think that when a player is approaching victory, the other ones should dogpile him, regardless of past likeness or unlikeness..
somethnig like : one player has >50% of all land ? has 80K out of 100K needed for culture victory ? => he is the ennemy, let's all come together.

I, for one, do not enjoy this idea. For starters, the system would be easily exploited. You simply keep your empire just below the "aggression threshold", quietly hoarding resources/units, and wait for an enemy/AI civ to trigger it. Once the dog-pile is in full effect, the player skates to victory.

This also has the potential of greatly increasing length of the game... by introducing perpetual world wars designed solely to bring down the leader (and replace it with a new one).
 
Quote:
Originally Posted by Old_Lion
so I think that when a player is approaching victory, the other ones should dogpile him, regardless of past likeness or unlikeness..
somethnig like : one player has >50% of all land ? has 80K out of 100K needed for culture victory ? => he is the ennemy, let's all come together.



I, for one, do not enjoy this idea. For starters, the system would be easily exploited. You simply keep your empire just below the "aggression threshold", quietly hoarding resources/units, and wait for an enemy/AI civ to trigger it. Once the dog-pile is in full effect, the player skates to victory.

This also has the potential of greatly increasing length of the game... by introducing perpetual world wars designed solely to bring down the leader (and replace it with a new one).

You have to choose...
Dou you want the AI to be realistic (historycally speaking ), or a strong opponent ?
In a multiplayergame, i'd expect players to to anything to prevent a victory.

A random factor could be added to prevent too clever calculations about threshold
+
if a new leader emerges, I expect him to be dogpiled himself, following the same algorythm...
 
Why not on lower dificulty levels make the AI act realistic and on higher levels make it a strong opponent?
 
Brain said:
Yes, I agree with you. The design ideas I suggested were based on the assumption that the default AI will be poor at the strategic level and strong at the tactical level. Of course, we'll have to wait and see if that's true, and we certainly need to have more details before we can do anything.

So, let's hear the suggestions from everyone... What would you like the AI to do?


@Brain: There is no reason why we shouldn't discuss both ways--planning an overhaul and planning specific improvements--of modifying ai behavior.:)

[EDIT] This is because although we can almost freely discuss designing a whole new ai behavior, we do not yet know what kinds of problems of behavior Civ4's ai will have such that we could even discuss ways of correcting them.
 
Old_Lion said:
You have to choose...
Dou you want the AI to be realistic (historycally speaking ), or a strong opponent ?

Just to play devil's advocate: why have an arbitrary aggression level, or late-game dogpile, when you could just make the AI relentlessly pursue the human player beginning at turn 1? If you want strong opposition, why give the human player time to build-up at all?
 
Volstag said:
Just to play devil's advocate: why have an arbitrary aggression level, or late-game dogpile, when you could just make the AI relentlessly pursue the human player beginning at turn 1? If you want strong opposition, why give the human player time to build-up at all?
Yeah, but one of the complaints we often hear about the Civ3 AI is that it dogpiles human players. Okay, it may be more challenging but it is kind of frustrating to always be the bad guy.
 
Hey like wat u said Brain but how about computer mimicing your sucsesses to a certain extent....kind of like following up on your trailblazing. (example: build Massive Artillery and kill off thousands of the enemy, computer might look at why it lost. which ever took off the most of the HP or units in C4 will be analysed. then they will follow suit and use the same tactic on you....)


Incredibly difficult concept to add like Brain said (programming wise) but hey....its worth considering...if somebody wants to tackle this
 
Volstag said:
Just to play devil's advocate: why have an arbitrary aggression level, or late-game dogpile, when you could just make the AI relentlessly pursue the human player beginning at turn 1? If you want strong opposition, why give the human player time to build-up at all?

When writing this, I did not think the stronger player has to be the human...
+
I am proposing this strategy to be triggered by the approach of victory,
not from the beginning of the game. That means that the attacked one should have the means to defens itself...

Don't you think that it's annoying that you know 120 turns beforehand that yo're going to win ? Reachingvictory turns into a kind of chore.
 
Brain said:
So, let's hear the suggestions from everyone... What would you like the AI to do?
I would definately like to see the AI act as much as another human player as possible. This means for example that by putting all your troops near an AI's border you could make it believe it was threatened and so it will use too mnay resources on rushing military, just like a human would do. However the AI should also be able to do this against the human to try to force the human to waste resources. That means that I want the AI to be able to be deceived as long it will only be tricked where a human would be in the same case. In this way the human would have to use real tactics and not Anti-AI-specific tactics.
Of course I don't expect the AI to think as a human but just in the direction of it.
 
I always hate dogpile the leader in strategy games. Yes, it is effective, but it feels so gamey (it ruins the immersion for me). I was glad they removed it from Civ3 and I hope it stays gone from Civ4.
 
@one_man_assault: What you're suggesting is really hard, even at the academics level. My original concept is about addressing this problem. If we make a database that contains player-invented strategies then we are using common experience and jugment to gradually correct and improve the AI behavior. Of course, it requires manual intervention, but making it a completely automated process is not really possible.

@Theoden: I too would very much like to see the AI exhibit this kind of behavior, but I fear that it would make it very vulnerable to exploits. What I hope is that we'll be able to mimic such behavior to a certain degree by making lots of small scripts adapted to specific game situations.

Here's an idea. I think I read somewhere that joint victories will be possible in Civ4. If that's true then I would like to see the AI form secret alliances in order to win the game jointly. It would also be really fun if there was some betrayal of allies. But not like in Civ3 where the alliances didn't mean anything. More like strong long-term aliances that could be broken by a strong player if victory is within grasp.

Another thing I'd like is to allow players to teak all these things and hand craft an AI of their own liking. It would give the game a lot of variety.
 
Top Bottom