Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Alternative Civs > Clash of Civilizations > Coding the Diplomacy Model
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
04.Sep: `FC` 2.0.5 COMPLETED AND RELEASED
27.Jul: `FC` 2.0.4 COMPLETED AND RELEASED
16.Jul: `FC` 2.0.3 COMPLETED AND RELEASED

bottom of page
  
Author
Thread   
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
Post  Old Post 31-08-2001 03:20
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Coding the Diplomacy Model Enter the AD-FREE zone

Just a quick question: Does the Civilization name (civ_name) uniquely identify a civilization? Or can more than one civilization have the same name?

If every civilization is identify by a name (String), I suggest we change this and create an ID that is unique to every civilization. We should also create a Civilization (or any other class that requires unique IDs) Factory pattern to create unique IDs. I hope I gave the right pattern name

Stay tuned for more questions

Jose

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:15
  Old Post 31-08-2001 03:59 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Hi Jose:

AFAIK its done by string now, and it should certainly be true that no two civs can share a name. I don't know if the code is there to prevent a name collision. OTOH I don't really care much either way, so lets see what the other coders have to say about your proposal.

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:15
  Old Post 31-08-2001 08:36
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy Civilization 2

quote:
If every civilization is identify by a name (String), I suggest we change this and create an ID that is unique to every civilization.


Why?

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 31-08-2001 10:13
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Civilization 2

Aren't string comparison expensive operations?

It doesn't really matter. If it works, it is all good with me.

But shouldn't unique name still be enforced? The computer player shouldn't have a problem if two civilization have the same name but this is not the same for the human players.

Jose

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:15
  Old Post 31-08-2001 12:19
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Inflate your Upload Space

I'm strongly for names against IDs.
It is quite easy to ensure 2 civs don't have the same name.
As for string comparison, it may be slower than int comparison but I doubt comparing two civs by their name will occur very often.
In the military code, I test equality of civilization objects quite (too) often, never strings.

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 31-08-2001 20:29
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

quote:
Originally posted by LDiCesare
In the military code, I test equality of civilization objects quite (too) often, never strings.


This is a good Idea.

Jose

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:15
  Old Post 01-09-2001 01:39
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Remove this text

The system makes extensive use of static instances. The creation of a civilization is a rare event or an initialization event. Once created, the single instance of each civilization is identified by a reference to that instance. As Laurent said, the military model works that way. I can assure you that the rest of the system also works that way. Although each civilization has a name, it is only used for output to the user, at present. Ultimately it will be used for saving and loading games.

The use of instance references goes far beyond civilizations - it covers all units, map squares, all the visible windows, images, terrain types, unit types, ethnic groups, religions, technologies and so forth. Where specific identification is required, unique names are used, since it is intended that eventually all data be saved in XML format.

Since, once loaded, there is very little searching for objects, the efficiency or otherwise of string comparisons doesn't matter. I believe the only time it happens is when a new unit is created, when the archetype is identified by name, and this does not happen sufficiently often for efficiency to be an issue. In a whole game it might cost as much a 1 second.

Because of the use of fixed objects, comparison is normally by means of ==, rather than equals(), so, in effect the memory address of the object is its identifier within the program.

Cheers

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 01-09-2001 04:20
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Call to Power 2

How are we keeping track of time or turns? Have to keep track of when something happened or should happen.

I noticed that we are using the GregorianCalendar class but my question is how are we using it to keep track of time or turns?

Jose

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:15
  Old Post 01-09-2001 05:09 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Browse Apolyton AD-FREE

IMO turns are the fundamental game element for keep track of time. So all orders etc. should be indexed by turn number. Any mention of a date/time should be obtainable as a function of turn number. But its not clear we even want to tell players 'real world' dates because the military timescale in the game can be different from the other time scales represented within a single turn. We've just discussed some of this recently in the Military units movement thread.

GregorianCalendar was just something thrown in by F_Smith and I'm not sure its usable since IIRC there is a date sometime in the first few millenia BC where GregorianCalendar no longer works.

Just to keep the discussions orderly I'm going to suggest that we start a "general questions about coding thread". That's where much of the topics covered here belongs. (I'm not sure one already exists, or I'd point to it.) My concern is that someone will look at this thread for information about diplomacy coding, and find nothing directly related to diplomacy here . Or have to wade through a page of general stuff before ever getting to the diplo stuff. Sorry to be bouncing the discussion around, but its very difficult to maintain long-term usefulness of the forum if the discussion doesn't match the thread title.

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 01-09-2001 06:50
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Get a bigger avatar today!

Ok. Lets forget about the above and start discussing the diplomacy model .

I am going to start posting the classes one class at a time. Lets start from the top, the Diplomacy class. This class doesn't do much work. It just encapsulates two more classes (Ministry of Exterior and Ministry of Interior).

-------------------------------------
package game.model.diplo;

import game.model.diplo.ExteriorMinistry;
import game.model.diplo.InteriorMinistry;
import game.model.Civilization;

/**
* The Diplomacy class represents the diplomacy model for
* Clash of Civilization. The diplomacy model is divided into two sections
* (ministries): Ministry of Exterior and Ministry of Interior. The Ministry
* of Exterior is responsible for handling events dealing with foreign
* affairs. The Ministry of Interior deals with matters internal to the
* civilization.
*
* @author Jose A. Garcia-Sancio
* @version 0.0.1
*/
public class Diplomacy {
/**
* Object for modeling the Ministry of Exterior.
*/
private ExteriorMinistry exteriorMinistry;

/**
* Object for modeling the Ministry of Interior.
*/
private InteriorMinistry interiorMinistry;

/**
* Parent civilization for this object.
*/
private Civilization parentCivilization;

/**
* Creates an instance of the Diplomacy class.
* @param ownerCiv - the civilization that owns this diplomacy
*/
public Diplomacy(Civilization ownerCiv) {}

/**
* Returns the exteriorMinistry object for this class.
*/
public ExteriorMinistry getExteriorMinistry() {}

/**
* Returns the interiorMinistry object for this class.
*/
public InteriorMinistry getInteriorMinistry() {}

/**
* Returns the parentCiv object for this class.
*/
public Civilization getParentCivilization() {}
}
-------------------------------------

I made 'game.model.diplo' the diplomacy package. Is this ok?

Jose

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:15
  Old Post 01-09-2001 07:04 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Lose 30 kilos (of popups)

Looks like a reasonable start to me, with one possible exception...

We already have a detailed government model spec that's partly coded. My guess as to what you are calling interior ministry functions are already handled there. Please check out the govt model, and see if this is the case, and we can discuss it further.

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 01-09-2001 08:09
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Avatar Enlargement: We've got the solution

I'll look at the code tomorrow. Any class I should be looking for?

Anyway the Ministry of Interior is responsible for dealing with the following: Counterintelligence, Internal Operations, Create Civilization. Look at the Diplomacy Model v1.1 for a description.

I have not design the InteriorMinistry class yet and might not make it into Demo5 (This depends on the deadline).

Now here is the ExteriorMinistry class. Every ExteriorMinistry class has a corresponding 'advisor' (or Minister of Exterior). The ExteriorMinistry (the actual office) basically stores information about the contacted states. The Minister of Exterior (AI advisor for human player or computer) takes actions base on this information. This will allow the cool feature of hiring an advisor at a price. The player will be able to hire diff advisor depending on their policy (for example a war oriented advisor, a peaceful advisor, or a trade oriented advisor).

--------------------------------------
package game.model.diplo;

import game.model.diplo.CivContact;
import game.model.diplo.Treaty;
import game.model.diplo.Diplomacy;

import java.util.Vector;

/**
* The ExteriorMinistry class represents the Ministry of
* Exterior. This class is used for communicating with other Civilizations
* and storing general diplomatic information known about these civilizations.
* This class handles other non-civilization specific features like treaties.
*
* Note: Other non-civilization specific feature will be implemented later.
*
* @author Jose A. Garcia-Sancio
* @version 0.0.1
*/
public class ExteriorMinistry {
/**
* The list of civilizations that this civilization has foreign
* relationships with.
*/
private Vector contactedCivilizations;

/**
* The list of treaties that this civilization is involved with.
*/
private Vector activeTreaties;

/**
* Parent Diplomacy class.
*/
private Diplomacy parentDiplomacy;

/**
* Creates an instance of the ExteriorMinistry class.
* @param ownerDiplomacy - the diplomacy that owns this class
*/
public ExteriorMinistry(Diplomacy ownerDiplomacy) {}

/**
* Adds a civilization contact to the contacted civilization list.
* @param contact - contact to add to the contacted civ list
* @return true if the nation was added successfully;
* false otherwise.
*/
public boolean addContact(CivContact contact) {}

/**
* Removes a civilization contact from the contacted civilization list.
* @param contact - contact to remove from the contacted civ list
* @return true if the nation was removed successfully;
* false otherwise.
*/
public boolean removeContact(CivContact contact) {}

/**
* Returns an iterator over the nations contacted by the civilization.
*/
public Iterator getAllContacts() {}

/**
* Returns the number of contacted nations by the civilization.
*/
public int numberOfContacts() {}

/**
* Adds a treaty to the active treaty list.
* @param treaty - treaty to add to the active treaty list
* @return true if the treaty was added successfully;
* false otherwise
*/
public boolean addActiveTreaty(Treaty treaty) {}

/**
* Removes a treaty from the active treaty list.
* @param treaty - treaty to remove from the active treaty list
* @return true if the treaty was removed successfully;
* false otherwise
*/
public boolean removeActiveTreaty(Treaty treaty) {}

/**
* Returns an iterator over the active treaties for the civilization.
*/
public Iterator getAllActiveTreaty() {}

/**
* Returns the number of active treaties by the civilization.
*/
public int numberOfActiveTreaty() {}
}
---------------------------------

Jose

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:15
  Old Post 01-09-2001 19:30 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Got spare money?

Counterintelligence probably does belong in the diplomacy model. As for Internal Operations and Create Civ, I'd say lets see where we think they fit more naturally as both the diplomacy and govt models progress in coding. But my inclination right now is that they should go in the govt model.

On hiring advisors... That seems needlessly complicated to me. The way I envision it is that you have a diplomatic advisor, and can give it (him/her) particular orders (maintain peace within x cost per turn, or prepare for me to attack the Bozos). Now, that's not to say that characters that are advisors can't have advantages in certain areas like maintaining peace or preparing for war. But I think that's a further refinement after the basic system gets going.

As a general note, I'm hoping that D5 can go out in a few weeks (I haven't heard from Gary on his expected timetable so I'm not sure). And since much of the support stuff for diplomacy, like civs having military AI isn't implemented yet, I doubt even the external diplomacy stuff will be in D5. But as soon as we have enough to make it interesting, we'll certainly put it in.

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:15
  Old Post 03-09-2001 04:03
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Suffering from ads?

quote:
/**
* The list of civilizations that this civilization has foreign
* relationships with.
*/
private Vector contactedCivilizations;

Modern Java usage prefers using the java.util.List interface or the Collection interface (depending on whether the information is ordered) rather than a specific implementation such as Vector. This allows the code to be independent of the specific list implementtationn

In addition, Vector is synchronized by default, ArrayList is the current preferred option.

Is there some specific advantage in dividing the ministries into interior and exterior?

If the concept of a treaty is extended somewhat, the contacts and treaties could be objects implementing the same interface, and hence only one map (by civilization) is required to record these matters. There seems little advantage to having two lists to, in effect, cover the same set of actions. Incidently, the map should be declared as Map, but implemented as HashMap (not Hashtable, which is also synchronized unnecessarily).

quote:
As a general note, I'm hoping that D5 can go out in a few weeks (I haven't heard from Gary on his expected timetable so I'm not sure). And since much of the support stuff for diplomacy, like civs having military AI isn't implemented yet, I doubt even the external diplomacy stuff will be in D5. But as soon as we have enough to make it interesting, we'll certainly put it in.


As I said in my private email, a couple of weeks isn't too far off the mark, provided the AI is truly embryonic.

I guess most people in the forum are aware of my hatred of putting in code that isn't functional. Unless it does something useful, leave it out. NEVER put in code because it might be useful later. In this context, there is already a class called Attitude, which, currently, has three static instances of subclasses called ALLIED, NEUTRAL and ENEMY, to determine how encountering armies act. For D5, every other civilization is an enemy, but that is a scenario option, if it were otherwisem the system would still work. It seems to me that this structure could be extended to a DiplomaticStatus class with more options in it, by D5. If more things are introduced, it is unlikely that they will have a direct impact on D5 and hence should be postponed to D6, when their implications can be worked out.

By the way Sancio, I am really glad to see someone working through what are, in effect, interfaces. Have a look at the technology thread where I published the whole technology interface. This works, but is not included in D5 becouse none of the code to use it has been written.

As to hiring advisors, I like the idea, though I would put it in terms of sacking (beheading?) ministers and appointing other ones, a la Queen Elizabeth I. But not for D5.

Cheers

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 03-09-2001 07:50
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Support Apolyton

quote:
Originally posted by Gary Thomas
Modern Java usage prefers using the java.util.List interface or the
In addition, Vector is synchronized by default, ArrayList is the current preferred option.


That's true. I already made changes to use java.util.List. Thinking of using LinkedList since I don't have a need for quick random access.

quote:
Originally posted by Gary Thomas
Is there some specific advantage in dividing the ministries into interior and exterior?


I don't like this part of the code either. I wont be implementing the InteriorMinistry any time soon so I just going to take it out of the class.

quote:
Originally posted by Gary Thomas
If the concept of a treaty is extended somewhat, the contacts and treaties could be objects implementing the same interface, and hence only one map (by civilization) is required to record these matters. There seems little advantage to having two lists to, in effect, cover the same set of actions. Incidently, the map should be declared as Map, but implemented as HashMap (not Hashtable, which is also synchronized unnecessarily).


I'll find a way to extend Treaty and CivContact to share the same interface. Are you suggesting to use Map? I am a little lost with the last sentence.

quote:
Originally posted by Gary Thomas
In this context, there is already a class called Attitude, which, currently, has three static instances of subclasses called ALLIED, NEUTRAL and ENEMY, to determine how encountering armies act. For D5, every other civilization is an enemy, but that is a scenario option, if it were otherwisem the system would still work. It seems to me that this structure could be extended to a DiplomaticStatus class with more options in it, by D5.


I have an enumeration class which I am going to rename to DiplomaticStatus that should take care of this. I can post it if needed.

quote:
Originally posted by Gary Thomas
By the way Sancio, I am really glad to see someone working through what are, in effect, interfaces. Have a look at the technology thread where I published the whole technology interface. This works, but is not included in D5 becouse none of the code to use it has been written.


Will do!

Thanks for all your comments. They were very helpful. Keep them coming.

Jose

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:15
  Old Post 04-09-2001 04:22
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Avatar Enlargement: We've got the solution

quote:
I'll find a way to extend Treaty and CivContact to share the same interface. Are you suggesting to use Map? I am a little lost with the last sentence.

Sorry, I was thinking a bit ahead to the actual use of the information. An obvious use is, when units of two civilizations meet, "what are are our feelings about, and formal treaties with, this other civilization". This, in turn, implies a method for a civilization like:

public DiplomaticStatus getDiplomaticStatus(Civilization otherCiv)

To look this up, the list of diplomatic statuses will need to be in a hash map, hence my assumption of a Map interface.

Cheers

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 05-09-2001 01:55
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton buy from Amazon

Due to Gary's suggestion I have redesigned the ExteriorMinistry and created a new Interface Ministry.

code:
package game.model.diplo; /** * The Diplomat interface must be implemted by any class that wants to * keep a diplomatic relation with another civilization. * * Diplomat provides methods for storing diplomatic contracs * and keeping track of diplomatic relations with other civilizations. * * @see DiplomaticContract * @see DiplomaticStatus * * @author Jose A. Garcia-Sancio */ public interface Diplomat { /** * Adds a diplomatic contract. * @param contract contract to add to this ministry * @return true if the contract was added successfully; * false otherwise. */ public boolean addContract(DiplomaticContract contract); /** * Removes a diplomatic contract. * @param contract contract to remove from this ministry * @return true if the contract was removed successfully; * false otherwise. */ public boolean removeContract(DiplomaticContract contract); /** * Returns an iterator over all diplomatic contracts. */ public ListIterator getAllContracts(); /** * Returns the number of contracts. */ public int numberOfContracts(); /** * Returns current diplomatic relation with otherCiv. * @param otherCiv the civilization to get the diplomatic status */ public DiplomaticStatus getDiplomaticStatus(Civilization otherCiv); /** * Sets a new diplomatic status for a given civization. Adds a * new diplomatic status if one doesn't already exist. * @param otherCiv the civilization to change diplomatic status * @param status new diplomatic status for otherCiv */ public void setDiplomaticStatus(Civilization otherCiv, DiplomaticStatus status); }


Sorry for the slow progress but I am still trying to figure out all the detail of the current clash implementation.

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:15
  Old Post 05-09-2001 06:45 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

I think I'd call it Diplomacy rather than Diplomat...

I also get the feeling that there should be more to the interface, like whether certain types of actions are permitted to military units on another civ's terrain, but I'm sure that will become apparent as coding goes forward.

Then again, I haven't even Done the interface for Econ yet, so don't feel bad

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 05-09-2001 07:55
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Mark_Everson
I think I'd call it Diplomacy rather than Diplomat...


Agree. Already made changes.

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:15
  Old Post 05-09-2001 16:58
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Full PM-box? Change here!

A few questions from a military standpoint:
The military AI will have to know whether it can attack armies and which.
A description of which actions are allowed according to a treaty could be a good thing?
I see the following:
(Supposing a unit has received an order to do something - I decide whether or not that violates a treaty-):

* Entering a square of civ X.
* Claiming a square from civ X (if unauthorized, I just cross the civ territory, if authorize, I take control of the square).
* Building things in a square from X (is it allowed to build a road through an ally's territory?????)(this one has links with infrastructure I am not sure of).
* Attacking armies from X in a square they control.
* Attacking armies from X in a square neither of us controls.
* Attacking improvements from X (pillaging...).

Some are altogether war acts, but depending on treaties some may not be (e.g. "we don't fight on our soil, but unexplored land is another thing").
I should be able from a civ to retrievve allowed moves, like:
IsAuthorised(targetSquare,archetype,order);
The square knows which civ it belongs to, the archetype is the type of unit (e.g. diplomat / settler / chariot), and an order can be sentry, attack, fortify, scout or whatever.
The reason I put the square not the civ is you might allow to cross border squares but not inner squares. The question is how do you define which square is a core square, which one is a border? (regions?)
The current list of orders is limited, maybe the orders can be checked as being part of a category (war, truce, peace) to make things simpler, or we identify them by name and allow each order based on each kind of treaty.
What do you think?
I can put up whatever is needed from the militray standpoint.

Last edited by LDiCesare on 05-09-2001 at 17:04

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 08-09-2001 00:53
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Support Apolyton buy from Amazon

I am now starting to designing the DiplomaticConract interface. I was wondering if contract had to be enforced (performed) every turn. Or is it up to the player to perform the actions required by the diplomatic contract?

I have more question but I'll post them when I get an answer to this one.

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 08-09-2001 01:04
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Support Apolyton

quote:
Originally posted by LDiCesare
* Entering a square of civ X.
* Claiming a square from civ X (if unauthorized, I just cross the civ territory, if authorize, I take control of the square).
* Building things in a square from X (is it allowed to build a road through an ally's territory?????)(this one has links with infrastructure I am not sure of).
* Attacking armies from X in a square they control.
* Attacking armies from X in a square neither of us controls.
* Attacking improvements from X (pillaging...).


A better question is who should make the decision of attacking or controlling a square. I think that this should be let up to the Military model or Military AI/Advisor. The Diplomacy model can provide you with the information needed to make the decision but it should be up to the military model to make the decision.

Does this sound reasonable? Yes? No?

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:15
  Old Post 08-09-2001 04:30 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Inflate your Upload Space

I think diplo contract actions should happen automatically. Otherwise the player will be forced to undertake a mind-numbing amount of actions every turn. However, the player can revoke a contract if they choose.

IMO that can also be a model for the 'can attack' issues. I think the players' units should always obey deals the player has made, but if the player (or AI) chooses to shaft someone it should override the contract (Diplomacy model should handle it), allowing the attack or other action to be upheld by the unit. At least that seems the most straightforward way to handle it to me .

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 08-09-2001 05:42
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

quote:
Originally posted by Mark_Everson
I think diplo contract actions should happen automatically. Otherwise the player will be forced to undertake a mind-numbing amount of actions every turn. However, the player can revoke a contract if they choose.

IMO that can also be a model for the 'can attack' issues. I think the players' units should always obey deals the player has made, but if the player (or AI) chooses to shaft someone it should override the contract (Diplomacy model should handle it), allowing the attack or other action to be upheld by the unit. At least that seems the most straightforward way to handle it to me .


That sounds reasonable to me. The next issue will be what contract should be canceled and how they should be canceled.

If civ Y has a couple of contracts (treaties) with civ X (for example one contract set their diplomatic status to cooperation and requires civ Y to give 1000C to civ X every turn, and the other contract just makes civ X give civ Y 500C) and civ Y decides to attack civ X, then the first contract will be cancel because it violates the first clause. On the other hand the second contract will still stand because none of the clauses have been violated.

Of course it is very likely that civ X will cancel the second contract on the next turn.

All I have to do now is figure out how to do this. hehe

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:15
  Old Post 08-09-2001 17:14
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Help yourself to an AD-FREE life

I agree that the miltary AI or player controls the moves, but I was listing the list of information that I deem necessary in order to take a decision about an action.
In particular, crossing territory may be forbidden by treaty, but that can have impact on pathfinding, so it may be necessary to have a list of uncrossable squares. The list was a list of information needed by the AI (high tactical level) so they know what they can and cannot do.

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 08-09-2001 18:05
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

Sorry for miss reading your post. I added a new method to the Diplomacy interface:

code:
/** * Returns current diplomatic relation with given MapSquare. * @param mapSquare Map square to check for diplomatic status *@return DiplomaticStatus if the civilization that owns this * map square has been contacted; null otherwise */ public DiplomaticStatus getDiplomaticStatus(MapSquare mapSquare);


Let me know if extra functionality is need.

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 19-09-2001 02:24
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Lose 30 kilos (of popups)

Hello,

I am currently having some design issues. I am trying to keep the design simple so that it is easy to code and understand but I am having some problem achieving this. This is mainly concerning how diplomatic status are updated. For example when one civilization attack another there are a couple of things that have to be taken care. One of them is the diplomatic status between the two civilization (but there are many others). The attacking civilization could be responsible of changing the diplomatic status for both civilization or an attack event could be fired and any listening object can catch this event performed any needed actions.

I don't see such event/listener system been used in the current code but it will be very useful for the diplomatic model since it depends on so many different models.

This will also abstract many responsibilities from the other models like the military model. And act as a message passing between civilization...

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:15
  Old Post 19-09-2001 23:16
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Support Apolyton or Terrorists Win

The military model uses the Observer/Observable system to some extent.

Personally I am against that approach. It has been pretty much deprecated since Java 1.1, and replaced by the action listener system, a much better approach.

The problem with the Observer system is that it is a shotgun approach, broadcasting to the world, in effect it is a copy of the Windows messaging system.

Action listeners, on the other hand, are directed, and can be tailored to the situation. It is also possible to make sure that someone is listening.

Cheers

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:15
  Old Post 18-10-2001 04:55 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

Sancio:

Are you still working on this, or have you become one of our disappearing team members?

-Mark

Sancio is offline Sancio
Settler

Aug 2001
time: 00:15
  Old Post 18-10-2001 20:33
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Support Apolyton buy from Amazon

Hey Mark,

I am still here but I put coding in the back ground. I read the message board everyday to keep up with the current status of clash of civilization.

I have not done much to the model lately but I will work on it in the future. I just don't know where to go next. Once the code for D5 is released, I'll again start working on the diplomacy model.

Been looking at other civ games to get some idea (inspiration ) on how to handle user input.

Sancio

 
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:15.
Apolyton Time is 00:15.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0732 seconds (92.62% PHP - 7.38% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net