Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Diplomacy
Home

[Freeciv-Dev] Diplomacy

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Diplomacy
From: Per Inge Mathisen <per@xxxxxxxxxxx>
Date: Fri, 21 May 2004 13:22:58 +0000 (GMT)

The freeciv diplomacy model is an unreliable hack.

Problem #1: The diplomacy dialog is a pop-up. This is bad in itself, as
pop-ups hide the information beneath and steal attention. In Freeciv
multiplayer, anything that covers the mapview means lower reaction-time
when the enemy is attacking. The enemy can use this, opening a diplomacy
popup on the enemy when he is attacking, to gain an upper hand. The reason
this is not a big problem today is that the popup itself is very small can
easily be moved aside and dealt with when appropriate. Remove the
assumption that the diplomacy dialog is a small, moveable window, and this
becomes a huge problem. Say we, like, IIRC, all the other civ-games, want
to have a fullscreen diplomacy screen in gui-fs...

Problem #2: We cannot assume that the player who receives a request over
the diplomacy dialog has time to answer in the same turn. Timeout could
kick in or the player has already pressed 'turn end' and is just waiting
for other players to do the same. This means the opposite end can execute
two full turns before we get a reply.

Example: If the AI wants to object to a player moving his forces into the
AI's borders, it can only declare war in the third turn - which probably
renders the idea of objecting in the first place pretty moot. If it was a
sneak attack, the other player got two full turns to move his forces into
position.

Problem #3: Any diplomatic offer and acceptance has to take into account
that the player can change things after we have made the offer or our
acceptance (in the same turn or later turns).

Diplomatic 'effects' may become an open channel for abuse. Writing code to
prevent this may be hideous complicated and makes writing some new
diplomatic options just plain ugly.

Example: We already have 'give away a city' diplomatic option which I and
original author both have written some spaghetti code to attempt to
prevent it from being abused too much. However, when you have an open
offer like that, there is only so much we can do to prevent cheating. As
of now, you can offer up a city for exchange, the AI says ok to the
exchange, then you go into the city and sell the most expensive building
and disband all the troops. (And no, a simple comparison before and after
will not do.) There may be barbarians or other enemies near the now
defenceless city, or you might retake it yourself.

Note that in this example we do not even need to consider the possiblity
of the offer staying up for several turns, since, IIRC, we close the offer
on turn end. But if we offer up an ultimatum, like "get off my borders now
or else..." we can't just ignore the possibility of an accidential turn
end (timeout or other players). It is certainly possible to write more
spaghetti code to cover all the possibilities, but my point is just that
the model sucks since it forces us to do that.

And it is not just players taking advantage of these defects that is a
worry. This system is also a breeding ground for bugs. Check out the
complexity of server/diplhand.c for an idea of how bad this is. I've fixed
lots of bugs in there already for the existing code.

Problem #4: We have take into account that our AI messages (those *King
Knut(AI)* Blah blah blah), are simply not read because they are drowned in
server spam. So we have to repeat them a few times before we can take
action. This is annoying to the player if he did read it, annoying if he
never does, and a fine opportunity to play the AI for a fool since it has
to wait so long. Not to mention that it is a pain to write the ugly AI
code to do it.

So what to do... One option is certainly to say that we don't need more
diplomacy options and diplomacy works good enough, so why bother.

  - Per



[Prev in Thread] Current Thread [Next in Thread]