I am writing the diplomatic part of UG right now, which is a nice change from the last week spent pinpointing the crash on more or less random machines. So, instead of talking about bugs, let’s talk about diplomacy in games and more particularly in Unending Galaxy.
As with all design documents I post, not everything I am writing about here is finalized. Some of it may be changed, improved or even scrapped altogether.
Diplomacy in Games
It’s not exactly a secret that strategy and 4X game AI are extremely bad at diplomacy compared to your average human. And experts at games like Civilization will simply make the AI do what they wish. That’s not, usually, bad or lazy programming. Diplomacy systems are by definition complex and mostly game dependent. But they also rely at least partially on guesswork, expectations, deception, and projection into the future. Things computers are much worst at than us. Of course, there’s people more intelligent than me who came up with algorithms that are adequate at this task. Such kind of code, while widely used, is processor intensive and bothersome to implement properly. More importantly it doesn’t fix a fundamental flaw that has more to do with perception of good AI than actual effectiveness:
Galactic Civilization 2 is considered by many to have a great AI that “doesn’t cheat” (we’ll come back to that part later on), while it’s true it’s not bad by any means, it is not especially better than its counterparts either. This screenshot sums up why pretty nicely:
What’s Galactic Civilization is good at is not much diplomacy or strategy in itself but in communicating to the player its intentions and what it has detected. Why it’s not more often used in strategy game more often is probably because what can make perfect sense for an AI doesn’t necessarily for a human. Another good, slightly unrelated feature of GalCiv is the surrendering of beaten AI (some rallying behind there friends, others to whoever beat them). It speeds up the end game, which is often a repetitive and boring process in 4X games, and can lead to interesting reversals of fortune.
There’s also the problem of expectations. People don’t want “cheating” AI, but what actually is cheating varies wildly from one person to another. An AI spawning troops is obviously cheating. But what about one who knows everything about your army ? Yes ? Well if it does still know everything but only use general estimates ? If you still say yes there, then you have unrealistic expectations. As an human you do the same constantly, without noticing it because it’s intuitive. You see part of its army, a few systems and you roughly estimate it’s strength, tech, position and it’s enough for you. AI crush numbers instead. They can’t estimate your forces if they don’t see it. Well, to be honest they can, but it’s way more complicated and processor intensive than simply accessing the lists for no practical benefits.
What is important is not the amount of data the AI opponent can access directly and you can’t, but how it is used.
It’s already basically impossible to predict accurately what a human really want in the long run when he signs up a defensive pact. Does he want to provoke a defensive war to weaken 2 factions at the same time ? Is he sincere ? No accurate way to tell. Is it really needed to make things even more complicated for it by making all the relevant information harder to reach ?
But that’s enough of these random ramblings about AI in games. If you want to dig further into the subject, here’s a few interesting links
- AI architecture in games
- Game Design Roundtable Podcast #66 : Diplomacy in At The Gates
- AI Sandbox : Conference on the MCTS algorithm used in many strategy games
Let’s get back to our game.
Unending Galaxy : Diplomatic System
After this long talk, you’d expect something great here. Sorry to disappoint, but diplomacy in UG will be fairly straightforward. There’s quite a constraint, the game is in real time. Having 3 or 4 diplomacy popups every few turns in Civ4 is okay, but having the same while you’re in the middle of a dogfight, not so much. Of course it can be alleviated to some extend with a good user interface that can wait for you to be available to give an answer, but it still can’t be as intensive message wise.
Anyway, factions evaluate how much they like each other via a set of parameters. Right now, around 20 of them like:
- For how long they have been at peace
- If they share similar laws
- If one is at war with the enemy/friend of another
- If one has sent/request a tribute to/from another
- If one desire a sector from another
- How many ship from one has been destroyed by the other
- How stronger/bigger is one to another
Basically if you’ve played Civilization, it’s the bunch of green + and red – deciding how friendly is a faction with another one. In addition to these variables, each faction has a set of traits (aggressiveness, xenophobia, trader, diplomat, stubbornness,…) that has an effect on their behaviors, for instance the isolationist draths are harder to befriend than the humans.
The diplomacy screen itself is fairly usual:
There’s the usual suspects (war / peace / alliance / trade agreement / gift money), the ability to ask a faction to make peace or declare war against a third party, and to request a tribute. The praise and insult buttons are an idea for Civ5 but I am not sure if it will be implemented as is / at all.
The main particularity of my diplomatic system, and I know it can be controversial, is that the player won’t have the ability to set his demands. For instance, If you request an enemy you’ve beaten to make peace, it will offer what it considers to be fair (can be credits or a system so far). You’re free to discard his offer, and it will probably improve as you are razing more of his territory, but you can’t set your price. Same goes if you request a tribute, ask him to join in a war, and so on.
Honestly it makes not much of a difference with usual trading table you’d find in other games. Usually the AI won’t go over a given threshold when dealing with you, and you will not stop tweaking the trade agreement until you reach it. I just cut the negotiation part, especially as UG doesn’t have techs to trade. Money and sectors are the relevant resources here. More importantly, it makes exploiting the diplomacy much more difficult.
Declaration of War and Peace Treaties
As you may already know I am using Civilization’s war weariness (WW) concept to limit how long wars can go for. As a quick summary: When two factions are at war WW increases for both, loosing ships or sectors increases it even more. When WW goes above a given threshold that varies from a faction to another it will sue for peace. And of course it slowly decreases when at peace. Right now WW in itself has no effect, but it’s planned to have an influence on ship production and the economy.
To prevent the spamming of declarations of war and peace in order to manipulate relations without consequences (and to prevent the AI from doing the same by accident), wars have a minimum length. It’s around 15 minutes right now, but it will be tweaked to be longer, most likely to depend on the size of the galaxy.
After a war there’s a cease fire agreement. The two factions won’t be able to declare war to each other for some time (here again, duration not set in stones).
It is now possible to ally another faction. The requirements are usually to have good relations, be at peace with them for a while, not being at war with their friends. The usual. Specifics and exact modifiers varies from a faction to another. Same as peace and war, the treaty has to run for a while before any party is allowed to break it.
When allied with a faction, it will join you in a war if you are attacked by a third party. It also makes other factions less likely to attack either of you as they’ll take both of you in their calculations. Police and military ships of your ally may also help you to some extend. Once fog of war is implemented, you’ll also get full view of their territory.
Free Trade Agreement
This agreement, that can be canceled at any moment, alleviate some of the negative diplomatic modifiers for having neighboring borders with another faction. More importantly, trade deals made by a faction in the territory of another are (slightly) taxed. This treaty removes the tax for both participants.
Other Possible Agreements
Other agreements are being considered. Right now military and trading ships can cross borders with impunity. I am not sure this is a behavior I want to keep. An option to set an embargo against a particular target could be added, forbidding all trade between the two. Relatively easy to add, or handle from an AI point of view. Another option is to have something between the neutral and alliance status. Granted I add large diplomatic penalties for fleets moving into neutral territory, a military passage agreement could be added to balance that out.
Factions play to win, not as a whole (AI vs human), but individually (faction vs faction). However, they will have optional and soft constraints to keep the universe interesting.
The diplomacy in UG will be straightforward and don’t need to be tweaked by the player constantly while still being able to influence the game in a major way. I will be your main method of survival when you start your own empire, which will be much smaller than the other ones.
It has been made difficult for the player to find exploits in the system by the removal of trading tables, and by the fact that the AI will choose the compensation it wants for your demands.
That’s all for now, I am not good with conclusions anyway. Most of what I just explained has been implemented this week, amongst other improvement on the “war” part of things. There’s still tons of tweaks to be added / made, but all in all it’s working fairly well. It makes the “young commercial empire” game start quite hard, I had to micromanage attack and defense fleets to barely survive against a joint human and sirak assault yesterday while testing alliances mechanisms.