Thread Tools
Old April 8, 2003, 18:57   #1
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:21
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Recruiting to do the best AI combat slic handler ever!
Sunday i come up with an idea. I will do the best AI combat handler ever done for CTP2!

Ideas:

1) Find the best city to launch an attack ever evaluating the city by inumerous variables like owner diplomatic relation, location, defense, distance, etc... Once chosen all strategy will be done there!

2) Teach the AI to orgqanize Stacks. The idea is to make the AI check the city defense according to a threat level when building a unit. If the city has the defense according to this threat level already this units is sent to field! All field units will merge in a stack until a size 12 stack is built. If the building is complete it will make another stack!

3) A brach from number two but teach the AI how to construct stacks.

4) Check how many size 10-12 unit is need to conquer the best target which was already evaluated in the first topic. And send all needed units there. The AI will only attack once all the stacks sent to the location are only one tile away from the target!

5) Make a alghorith good enough to find out if a city is in another continent. And if it is teach the AI to make Cross Water Attacks. No ideas yet but still want to check Peter Triggs work in the other thread.

5) Teach the AI to make strategies for water battles. and water navies creation.

6) Teach the AI what to build according to the needs of the cities and not by dark/unknow priorits of strategis.txt!

So Far
With this intent i started coding without testing! Just plain coding. Achieving a really good code with 400 lines for topic 1, 2 and part of 4 in which i am really proud. But when looking the agenda kind of scared me because the to do list is still enormous and the bug-freeing work will be enourmous.

Recruiting:

So i decide to ask for help!
Specially coders for two task:
1) Actual coding! Peter Triggs, Locutus, Martin, Dale, MrBaggins, IW, mapfi, ahenobarb or any other avaible coder around here to recruit to make those topics come through and workable with the others parts of the slic!
2) Bug-freers! Anyone coder i mentioned before or any other to help me find the flaws of my code and help me with the testing of the existing code!

But not only coders but I am also open for suggestions if anyone has a better idea bout my ideas.

And Testers. Some guys to hep me test the in-game stuff of the code. What is working and what isnt!

This can be the chance to make the CTP2 AI the best possible using slic with the help of all community.
So, is anyone interested?

The unfinished code I have worked already will follow after i hear some comments!
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; April 8, 2003 at 22:01.
Pedrunn is offline  
Old April 8, 2003, 23:22   #2
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
Re: Recruiting to do the best AI combat slic handler ever!
Sounds very ambitious Pedrunn! It would be nice to improve the AI's tactical abilities. I would be interested in working on number 3, if possible.

Later, It would be nice if we could get the AI to choose the best cities to attack. Such as the nearest of the opponent's top cities (in terms of size and production), so it focuses on the closest strategic cities. Maybe some diplomatic evaluation then to determine if it is time to pursue peace or press on to the next city.

Further down the road, I would like to improve the way the stacks approach the cities they want to attack. This would be done by writing an algorithm to evaluate the defense bonus of the terrain around the cities and the number of spaces the stacks can move per turn to ensure the stacks are always on favorable terrain.

As soon as you're ready, please share your code.
ahenobarb is offline  
Old April 9, 2003, 04:13   #3
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
Sounds good.

What you may whish to look in one of the AI files I can't for the life of me remember which one but the other year when I was messing about in there I actually got the AI to build a plane.

Any code you want doing give us a bell if I haven’t got much work on I will give it a go.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old April 9, 2003, 04:54   #4
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:21
Local Date: November 2, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
heh. interesting...
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old April 9, 2003, 11:38   #5
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 01:21
Local Date: November 2, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Well, I've been working on revamping the AI as well, using a more generic pattern (a bit like ahenobarb is talking about, only worse ).

My idea is to completely rewrite the AI in SLIC. I've suggested this before and at the time it was more a dream than a real ambition, but I'm more serious now: I do think that if a couple of people put their heads together, it *can* be done. Such a design can easily be split in independent modules, so that each module works on its own. This way even if a complete model is never finished, a lot of useful and usable code is still produced.

I've attached a diagram of initial module design below. IMO the AI should approach the game the same way humans do: the eventual goal/desire for an AI is to win the game. Through what type of victory partially depends on circumstances and partially on personality. To accomplish this desire, a strategy (ranked list of overall goals) is created: destroy the Austrian civ, prevent war with the Germans, get an alliance with the Thai, rush to Monarchy, build up the economy, etc. To accomplish these goals, the various parts of the game (diplomacy, military, cities (including trade), infrastructure and science) need to be optimized for them. Seperate modules can be written to deal with each of these parts of the game (though eventually some communication between these modules may be needed). For each part of the game, the ideal situation that should be strifed for (= desire) is modeled and a new strategy to accomplish this is created by determining more (sub)goals (i.e. if a strategic goal is to destroy the Austrians, the military desire is to control or destroy all Austrian cities and the subgoals could for example be to conquer Graz, to get a peace treaty with the Germans, to research Catapults, etc). Finally, these goals need to be executed.

This system of modules is good because one can simply develop one set of modules while the AI still controls all the other: while developing military code, you don't have to worry about how the AI handles science or PW as the existing built-in AI already does that for you. Also, the top layers of this model can easily be kept empty or very simple as you're developing the bottom layer(s).

Basically the stuff Pedrunn is talking about in this thread (including Peter's naval invasion code) is part of the MilitaryStrategy and MilitaryRealization modules (which are by far the largest part of my diagram and will certainly need to be refined and split up in submodules). These can (and should) be written without having access to any other module in my diagram. But of course, in the end a kick-ass military AI will still loose the war if the economy is geared towards building Wonders and the diplomacy policy creates more enemies than allies...

Though I was still thinking things out, Pedrunn's recruiting pretty much coincides with what I wanted to do myself. The main difference is that I do want to work a little more systematically: blindly starting to write some random code without thinking things through or debugging anything is suicide and bound to fail miserably. It's this attitude that causes 90% of professionally developed software products to take 50% longer to develop than initially calculated, cost about 200% more and in the end still doesn't do what they're supposed to (I don't know the precise numbers, I pulled those out of my arse, but the general trend is real: getting these numbers down is the biggest challenge of professional IT development today). CtP2 itself is a fine example of this

As Pedrunn pointed out: the total amount of work that needs to be done is enormous and without any kind of structure anyone would loose sight of things in no-time. If you take some time in advance to make a design of your final product and properly split your design in modules which can be developed and tested independently, you avoid a lot of problems. The amount of work involved seems far less overwhelming, you have a far more manageable and controllable project, you can test modules seperately (Ever tried to debug 50,000+ lines of code which haven't been debugged before? You'll need at least 2 weeks to get the syntax errors out alone and you'll almost certainly never find all the bugs), you can far more easily work together in a group (without people producing double or incompatible code), etc, etc. The advantages are numerous.

In my opinion the best thing to do right now is to make an inventory of all code that already exists (debugged or not). Since this is probably (almost) all military AI code, the next step could be to discuss what the military AI should look like. If my design of desires/strategy modules is deemed a workable model, we'd need to flesh out the design of the military branch (splitting it up in lots smaller, independent submodules) and continue to develop that. By the time that's done it's probably 2006, so if anyone is still here by then we can see how to continue after that
Attached Thumbnails:
Click image for larger version

Name:	ctp2ai.png
Views:	193
Size:	14.0 KB
ID:	42052  
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old April 9, 2003, 13:39   #6
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:21
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
ahenobarb, I would love to know about your ideas for the part of the code you want to do.

Locutus, your ideas pretty much coincide with mine. With the DG going on we are playing how the human strategy is build up. You divided the AI in the branchs: Diplomacy, Military, Domestic Affairs, Infrastructure and Science (from left to right). Which coincides immensily with the governments positios of the DG. And that is exacly what I have in mind!!!
My project is looking for the Military and Domestic Affairs of the AI. But first a work focused in the Military. Still i planned to extend it to these other areas specially diplomacy.

The way the AI handles diplomacy, which is as important as miltary since it is terrible broken in the game (more then military). So indeed thats something to work on!
But i rather work not doing like Peter Triggs did in the Diplomod2 and not like Richard Meyers. Doing a proposal type checking to accept according to this typ but i would like to work in the value of the proposal arguments using functions like GetLastNewProposalArg(sender, receiver,int,param/int), GetLastNewProposalArg(sender, receiver,0,tmpCity) and GetNewProposalResult(sender,receiver,player,type).
The last one was tested by me and serves the best for my wishs.

Arccording to the alues of the proposals arguments the AI willl Accept or decline. So count me in to make the diplomatic advisor code.

As for the Infrastrucure branch, indeed we need to make some work on this! The way CTP2 handles is terrble since we have no control and commerce is not included!

The Science branch would be nice to work too but not really that needed.

Waiting feedback from the people willing to help me about my ideas, Locutus ideas discussion and my code

About that I count Locutus, ahenobarb and me for this project. Anyone else?

Still what i've done in the Military Advisor code is here.
Note: I only did the stack arragement code, the find best target algorythm (both in the BeginTurn handler) and the check where to send built unit handler(if city is too well protected send unit outside the city is in the CreateUnit handler)
Attached Files:
File Type: slc pai.slc (11.9 KB, 13 views)
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; April 9, 2003 at 13:50.
Pedrunn is offline  
Old April 9, 2003, 17:42   #7
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
I reviewed the part of the code dealing with creating the stacks (MoveUnitsOutsideCities). I have some ideas on how to further elaborate and implement this portion of the code. The idea works like this:

Code:
1)	Establish rally points outside the city, i.e. build forts.
	Store the location of these forts in an array.
2)	When a city builds a unit in excess of what it currently 
	needs for city defense (determined by the Defense 
	Strategies in the “strategies.txt” file), look at array for 
	available rally points, then move excess units to the 
	rally points –build stacks.
3)	When building stacks, create different types of stacks 
	depending on the “Conquest” flag Aggressive/neutral/passive) 
	in the “personalities.txt” file.  There will be three types 
	of stacks:
	          a.	Traditional stacks: 4 attack/4 ranged/
			4 flankers
	          b.	Stalwart stacks: 3 defensive/ 3 attack/ 
			4 ranged/ 2 flankers
	          c.	Hordes: 12 flankers (used to move quickly to 
			danger/undefended zones)

Passive personalities will build: 40% type a, 50% type b, and 10% c.
Neutral personalities will build: 50% type a, 30% b, and 20% c.
Aggressive personalities build: 60% type a, 10% b, and 30% type c.
Once that code is done, we can focus on improving the code to select the “best” rally points or forts locations (near capital & principal cities, near borders with opponent civs).

Last edited by ahenobarb; April 9, 2003 at 17:47.
ahenobarb is offline  
Old April 9, 2003, 18:13   #8
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 01:21
Local Date: November 2, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
I myself would like to focus on giving AIs 'situational awareness', i.e. making them aware of the shape and terrain of the map, the proximity of neighbours (and the threat they pose), location of important cities/tiles, etc. I think Peter and maybe others have been working on this already as well, so hopefully we can put our heads together on this.
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old April 9, 2003, 18:35   #9
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:21
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
ahenobarb , looks better than i ever imagined to see implemented. The pesonalities is something good to talk about!
Quote:
I myself would like to focus on giving AIs 'situational awareness', i.e. making them aware of the shape and terrain of the map, the proximity of neighbours (and the threat they pose), location of important cities/tiles, etc. I think Peter and maybe others have been working on this already as well, so hopefully we can put our heads together on this.
Yep! But although the advantages of this are enourmous, the implementation will be very very hard. I am not saying we should do in other way, this trully is the best way. I am just scared
But you are aware that the only thing we may gain from this is a MoveOrder like that gives the best path for an target and sense attackk/defensive field forces positioning when they arent attacking. What indeed is a great improvement. but do you have any idea on how to do this. Since thousands of ideas are passing in my head but any good one.
Have you seen my GetContinentSize function. I like it as a raw perception of the continent very useful in case of cross water movement.


Need to go we talk later
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old April 9, 2003, 18:50   #10
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
I too want to give the AI a better way of seeing the map -- situational awareness. The first obstacle is that there is only one way to get the AI to look at the map tiles, the GetNeighbor function. This function is a little too limited. I have some better ideas for similar but more powerful functions.

I gotta run too, but keep the ideas coming.
ahenobarb is offline  
Old April 9, 2003, 19:23   #11
Tamerlin
Call to Power II Democracy GameCTP2 Source Code Project
King
 
Tamerlin's Avatar
 
Local Time: 01:21
Local Date: November 2, 2010
Join Date: Apr 2002
Location: Toulouse (South-western France)
Posts: 2,051
This project is one of the best news I have heard of since the Updater2. As far as the coding process is concerned I can't help you, I can only encourage you all.

I will gladly test the new AI as soon as a Beta is available.

Thanks to all the modders involved.

Note: please don't copy the cheatings of Civ3, I am not interested at all in an AI that is attacking one of my cities because it knows it is the only one that is not well defended although it should not have this information (unless it has used a spy to investigate the defence of the said city)...
__________________
"Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill
Tamerlin is offline  
Old April 9, 2003, 19:40   #12
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
I'm available for debugging and general help, but actually I'm still debugging the cross water invasion stuff I've been working on. This is taking up a lot of time.

Also, I've got some half developed stuff on AI air tactics that I'd really like to finish off. So, I'm afraid you can't count on me to write a lot of code.

But, as Locutus says, the design should take top priority. There's plenty to think about here: not only what we'd like to do but also how we can incorporate it into the game engine.
Peter Triggs is offline  
Old April 10, 2003, 07:03   #13
child of Thor
Call to Power II Democracy GameCTP2 Source Code Project
Emperor
 
child of Thor's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Jan 2002
Location: UK
Posts: 3,272
Guys

Tamerlin, i guess your fears could be addressed by making the AI 'cheats' dependant on the level you play at(a bit like now where the AI gets many more bonuses on the harder difficulty settings).
Still i feel the priority is to get a tough game out of the AI, if it has to cheat then atleast if it plays a better game it might not be a bad thing?
A human player will always have an advantage just because of being human!!
If it's done well then letting the AI 'know' your most productive city is lightly defended might not be all bad? As long as it can make a decent evaluation of it's actions to see that taking this city is only good if it knows it can support and hold it(it has ample production to produce troops and is close enough to deliver them?).
That kind of thing.
I don't mind an Ai cheating a bit IF it's fair, like in the example above, it's upto ME to decide if i want to risk leaving my most valuable city lightly defended, not a wise decision but i may have to, its a risk.
Still i'm sure this whole scenario will be discussed at length - Just how do you make the CTP2 AI competitive and able to give a balanced,hard game?
Good luck to the coders and of course i'll be happy to help in my non-codeing way
__________________
'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

Bush's Republican=Neo-con for all intent and purpose. be afraid.
child of Thor is offline  
Old April 10, 2003, 07:47   #14
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
I can see how something will be easy to get the ai to do

Like

If they are ecotpian send a eco-ranger to kill a heavily polluting city

And

Sending an unit to free slaves.

But there something we can’t do without the source code.

But lets raise the jolly roger I am in you need anything give me a bell.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old April 10, 2003, 11:20   #15
Gilgamensch
Call to Power II Democracy GameCall to Power II MultiplayerCTP2 Source Code Project
King
 
Local Time: 00:21
Local Date: November 2, 2010
Join Date: Jun 2002
Location: France
Posts: 1,986
Going back to Tamerlin:

that could be again an exploit by the human:

Make this city 'weak' put sufficiant troops around and you can slaughter him...........


For this somebody had a nice idea, I think it was MrBaggins. It would inlude some 'cheating' from the AI, but I don't know where he got with it..........It was that the AI calulated the thread in general and accordingly distibuted it's troops, the same it could do for attacking........

I'll try to find the threat again..........
Gilgamensch is offline  
Old April 10, 2003, 13:06   #16
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:21
Local Date: November 2, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
I'm willing to lend a set of fingers where necessary.

My concern is that we can construct models complex enough that they don't become too obvious for the human to see and outwit.

I was at one point meaning to focus the AI advance lists better. In fact, does that file actually work? Given that all the lists in the default files are the same, and other AI files do nothing, do we know if this one works properly? If not, it'll need its own workaround.

What precisely the "City" module contain? Placement, build queues and specialists?
This could require very close correlation with other modules. Should be good fun to code though
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old April 10, 2003, 13:47   #17
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
Yes I think a lot of us a willing to lend a claw but all we need is some one to give the nod to what we are to code.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old April 10, 2003, 14:30   #18
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
I plan to do some work on 3.1 this weekend.
ahenobarb is offline  
Old April 10, 2003, 15:23   #19
Turambar
Call to Power II Democracy GameCivilization II PBEMCall to Power Democracy GameCTP2 Source Code Project
Prince
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Apr 2002
Location: England
Posts: 310
Great ideas!! I really like Locutus idea of completely re writing the AI in SLIC. But as he said this would need a lot of planning before the coding started.

I'm willing to help with ideas and testing but my SLIC is very rusty and was never that good to begin with .
Turambar is offline  
Old April 10, 2003, 19:40   #20
Tamerlin
Call to Power II Democracy GameCTP2 Source Code Project
King
 
Tamerlin's Avatar
 
Local Time: 01:21
Local Date: November 2, 2010
Join Date: Apr 2002
Location: Toulouse (South-western France)
Posts: 2,051
Quote:
Originally posted by child of Thor
Tamerlin, i guess your fears could be addressed by making the AI 'cheats' dependant on the level you play at(a bit like now where the AI gets many more bonuses on the harder difficulty settings).
I am playing at Very Difficult and about to test Impossible after a few more games. I have no problems about the advantages given to the AI as it is implemented in CtP2. But there are a few cheats I would not like to see in a CtP2 game whatever the level because I don't find that a game is funny when an AI uses such crude cheats. I would prefer an AI that is planning its attacks with the right mix of Flanking/Front/Ranged units, that is using planes efficiently and is able to attack across an ocean...

I am not interested in an AI that is sending its settlers to a previously unexplored spot because a "cheat" is telling it there is a valuable resource here, I am not interested in an AI that knows exactly the number and quality of the defenders in my cities (unless it sends a spy)...

Though the game would be harder I would found it a lot less funny because I really hate this kind of cheats... I don't like to face an opponent that is basing its strategies on informations it should not have.

This is of course my two €-cents opinion on the kind of games I like and I know it is very hard to develop an AI that is not using such cheats...
__________________
"Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill
Tamerlin is offline  
Old April 10, 2003, 23:25   #21
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:21
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by Turambar
Great ideas!! I really like Locutus idea of completely re writing the AI in SLIC. But as he said this would need a lot of planning before the coding started.
So lets do it. Indeed Locutus ideas were the best. Very much like what i had in mind. So i say lets do it.

Quote:
Originally posted by ahenobarb
I plan to do some work on 3.1 this weekend.
Good. Your ideas are terrific. So i hope to see the AI building good stacks too. But remember to make the things easily editable. The things that may chnge from mod to mod.

"Passive personalities will build: 40% type a, 50% type b, and 10% c.
Neutral personalities will build: 50% type a, 30% b, and 20% c.
Aggressive personalities build: 60% type a, 10% b, and 30% type c."
This is the main thing to discuss in your ideas. So remember to make it very much changeble.
The rest of you ideas are already too good. Though they are too complex, specially the building of the 3 different types of stacks (probably making open the addition of other types would be great too. And a possible change in personality which i would like to implemeted. Remember to save the armies in arrays with all the data about it: Owner, type, etc... Keep always uploading it what you have. I want to check its evolvement very closely.

Quote:
Originally posted by Immortal Wombat

My concern is that we can construct models complex enough that they don't become too obvious for the human to see and outwit.
Actually formulas like the CheckCityValue as you can find in my slic for example uses variables that our impossible to be known by the human and the complexity of the formula cant be predicited. So i do believe that it will be very difficulty predicted unless if very time consuming.

Quote:
Originally posted by Immortal Wombat
I was at one point meaning to focus the AI advance lists better. In fact, does that file actually work? Given that all the lists in the default files are the same, and other AI files do nothing, do we know if this one works properly? If not, it'll need its own workaround.
I guess our knowlegde of working files isnt bigger than yours. The best would be to jus work with slic since we have plenty of controll over it. But i guess we dont have as many function for researching than other areas. But locutus diagram has a whole module for science in which we dont have much people working on it. Would you want to grab this module? If yes, gives us your ideas

Quote:
Originally posted by Immortal Wombat
What precisely the "City" module contain? Placement, build queues and specialists?
Placemement would be something good to work with it but i guess the use of the flag 'Score' in the terrain.txt if well adjusted may give some good placements. Indeed something good to work on if by slic or text.
The build queue should be one of our main focus together with military and diplomacy of this project.
We can mod the specialist distribution as you may know

Quote:
Originally posted by Immortal Wombat
This could require very close correlation with other modules. Should be good fun to code though
Actually the idea is to make the modules first and the correlation later. This will work well enough in this first stage. Since so far we have only few fronts: ahenobarb, with stack creation, and me, with moving units and map awareness work. So thats whay some more feedback from you guys that want to join us is important.

Quote:
Originally posted by Big Mc
Yes I think a lot of us a willing to lend a claw but all we need is some one to give the nod to what we are to code.
Good. Any interest in one of the Locutus module?

Turambar, the lesser the cheats the better. But some our impossible. And some cheats will show up for sure. But as the project evolves they will be removed.

And unfortunetly i bring the first best news When testing the GetContinentSize function of my slic i found out that the function
Code:
INT IsContinentBiggerThan(location,  size)
indeed is broken as reported before. It always return true. So as my first work since the beginning of this project is to create a function to replace it. Probably also making the AI making some map awareness. By drawing in arrays the map. How? By traking the beaches and trenchs of the map.
Whish me lucky and await some more info and feedback on this tomorrow. Since today I have got to sleep. But i wish to have something concrete this weekend
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; April 11, 2003 at 05:55.
Pedrunn is offline  
Old April 11, 2003, 00:07   #22
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
Quote:
Originally posted by Pedrunn

Good. Your ideas are terrific. So i hope to see the AI building good stacks too. But remember to make the things easily editable. The things that may chnge from mod to mod.

"Passive personalities will build: 40% type a, 50% type b, and 10% c.
Neutral personalities will build: 50% type a, 30% b, and 20% c.
Aggressive personalities build: 60% type a, 10% b, and 30% type c."
This is the main thing to discuss in your ideas. So remember to make it very much changeble.

The rest of you ideas are already too good. Though they are too complex, specially the building of the 3 different types of stacks (probably making open the addition of other types would be great too. And a possible change in personality which i would like to implemeted. Remember to save the armies in arrays with all the data about it: Owner, type, etc... Keep always uploading it what you have. I want to check its evolvement very closely.
The percentage variables will be desinged so that they can be changed and eventually they will be better if the percentages are based on different strategic states being adopted by the AI. So if it is on the attack or is surrounded by a powerful neighbor (high FEAR_MILITARY_RANK & FEAR_INVASION) the defensive stacks will increase while the AI prioritizes science in order to get some better equipment.

Stack types will be changeable too, or more likely you'll be able to add different type stacks to the code. Each type will have a numeric flag (1,2,3). If you want a different type of stack use a flag 4 and define the new type of stack you want.

Structuring the array properly is the key to getting this to work, so it will take some time to design.

Quote:
Originally posted by Pedrunn
And unfortunetly i bring the first best news When testing the GetContinentSize function of my slic i found out that the function
Code:
INT IsContinentBiggerThan(location,  size)
indeed is broken as reported before. It always return true. So as my first work since the beginning of this project is to create a function to replace it. Probably also making the AI making some map awareness. By drawing in arrays the map. How? By traking the beaches and trenchs of the map.
Whish me lucky and await some more info and feedback on this tomorrow. Since today I have got to sleep. But i wish to have something concrete this weekend
This gets back to the need to write better functions for looking at the map squares. GetNeighbor isn't capable enough. GetNeighbor of course is good for looking in the immediate circle around a location, but it would be good if there were a function that searched all the tiles in the production zone of a size 2 city, and then one for a size 3, size 4, and so on. These of course could be used to map terrain.

A second feature I want to add to these functions is the ability to control the direction of the searches: top to bottom, bottom to top, left to right, right to left, spiral clockwise, spiral counter-clock wise. Sounds complicated, but its just mathematics and the results would be worth it.
ahenobarb is offline  
Old April 11, 2003, 11:07   #23
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:21
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Percentvariables will be desinged so that they can be changed and eventually they will be better if the percentages are based on different strategic states being adopted by the AI. So if it is on the attack or is surrounded by a powerful neighbor (high FEAR_MILITARY_RANK & FEAR_INVASION) the defensive stacks will increase while the AI prioritizes science in order to get some better equipment.
My willing is to do a GetThreatLevel(location_t ) right after the the continent mapping one.

Quote:
Stack types will be changeable too, or more likely you'll be able to add different type stacks to the code. Each type will have a numeric flag (1,2,3).
Exacly what i had in mind

Quote:
but it would be good if there were a function that searched all the tiles in the production zone of a size 2 city, and then one for a size 3, size 4, and so on. These of course could be used to map terrain.
I already have worked with such a function in the CityExpasion code. But the function is BlueO works.

Quote:
A second feature I want to add to these functions is the ability to control the direction of the searches: top to bottom, bottom to top, left to right, right to left, spiral clockwise, spiral counter-clock wise. Sounds complicated, but its just mathematics and the results would be worth it.
But never worked with something like this Still using BlueO logics it can even be even a simpler function than blueO's ones that searchs all directions

The Continent mapping algoriyh i plan to use has the following algorith:

1) Scroll over all map searching a beach. Once done stop.
2) From this beach using GetNeighbor function map all beachs in one neighbor to another neighbor until finding and saving the arrays all beachs of the contitnent. (Note: Be careful to continents only one tile away from the other and continent aside map borders). Saving the location, the x-value and the y-value of these beachs. And the continent they belong (numeric flags)
4) After that do all again makin sure the beach that will be used for the mapping doesnt belong to a continent. This way all continent will be mapped.
5) It will be needed a simular function to that to map Oceans. But thats a bit harder for sure since many oces can be interconected.
6) GetContinentID(location_t) function. If there are in the contitnent array two beachs with the same X-value of the location and other two beachs with the same Y-value for the location. You've got a winner. So just get this contitnet ID.
7) IsSameContinent(location_t, location_t) fuction a simple GetContinentID(location_t) == GetContinentID(location_t).
8) GetContitnentSize(location_t) function. Very easily done after all that. Just search beachs in the same continent with same x-values. find the distance of those two. And um with the value of other x-values of the same continent.

Any other important function idea? Or critics for my algorithm (how do i spell this anyway)?
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; April 11, 2003 at 11:22.
Pedrunn is offline  
Old April 11, 2003, 11:22   #24
Gilgamensch
Call to Power II Democracy GameCall to Power II MultiplayerCTP2 Source Code Project
King
 
Local Time: 00:21
Local Date: November 2, 2010
Join Date: Jun 2002
Location: France
Posts: 1,986
Some idea, which Tamerlin and me discussed and we want to present it to you (also, to check, if it is possible):

Instead of having the AI cheating (like for the stack-count in cities):

Why not changing the vision-range to see the # of units in a city but not their composition? That would give the AI a possibility to calculate the 'strength' without cheating, the same function could be enabled for the human, though. And again, just the # of units, but not which units. If the AI could also take into account the science-level of a human, like for 5 rounds hoplite discovered so, max of 10% defenders = hoplite. That I think could increase the AI behaviour as well..................

Just some thoughts..........
Gilgamensch is offline  
Old April 11, 2003, 16:57   #25
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 01:21
Local Date: November 2, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Don't have much time right now, but I'll give you a very simple equation:

MakeLocation() + location[0].x + location[0].y + basic calculus = all the map manipulations you can dream of
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old April 11, 2003, 18:01   #26
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:21
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
I've made a first version of the code i explained above. Indeed during coding i noticed that location[0].x and location[0].y will replace two of the arrays i was imagining. And MakeLocation, what slicer havent ever seen the combo:
Code:
	for(x = 0; x < GetMapwidth(); x = x + 1) {
		for(y = 0; y < GetMapheight(); y = y + 1) {
			MakeLocation(tmpLoc, x, y);
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old April 12, 2003, 15:54   #27
Martin Gühmann
staff
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Super Moderator
 
Martin Gühmann's Avatar
 
Local Time: 01:21
Local Date: November 2, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
Originally posted by Pedrunn
I've made a first version of the code i explained above. Indeed during coding i noticed that location[0].x and location[0].y will replace two of the arrays i was imagining. And MakeLocation, what slicer havent ever seen the combo:
Code:
	for(x = 0; x < GetMapwidth(); x = x + 1) {
		for(y = 0; y < GetMapheight(); y = y + 1) {
			MakeLocation(tmpLoc, x, y);
You mean the code example? Well in that case I not only saw it but I also did it.

Code:
HandleEvent(BeginTurnImprovements)'MG_ReplaceGoodImprovement'post{
int_t i;
int_t j;
int_t k;
int_t MGMapWidth;
int_t MGMapHeight;
location_t MGGoodLoc;
location_t MGUnitLoc;
	if (GetCurrentRound () <= 1) {
		MGMapWidth = GetMapWidth();
		MGMapHeight = GetMapHeight();
		for (i=0; i<=MGMapWidth-1 ; i=i+1) {
			for (j=0; j<=MGMapHeight-1 ; j=j+1) {
				MakeLocation(MGGoodLoc, i, j);
				if(HasGood(MGGoodLoc)>-1){
					for (k=0; k<=7 ; k=k+1) { //directions
						GetNeighbor(MGGoodLoc, k, MGUnitLoc);//look around
						FinishImprovements(MGUnitLoc);
					}
					MG_CreateGoodImprovement(0, MGGoodLoc);
				}
			}
		}
		DisableTrigger('MG_ReplaceGoodImprovement');
	}
}
And if you need another city radius checker code then check the Commerce Improvements for AIs code.

For the arrays you shouldn'T forget what happens if I do a /reloadslic the information in the arrays must be recreated. This could be achived easily if you put that code into a function that is called in a BeginTurn event handler and optional in a ClickedUnit event handler. Actual the ClickedUnit event handler is only needed if the code is also needed during the human turn.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old April 13, 2003, 02:29   #28
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
Search Me...
Here are two of the new search functions I was discussing. There are several others that need to be done, but I wanted to share what I have so far.

The first one is:

Code:
      GetTile([loc], [tilenumber], [direction]);
                          ^
                      Your For loop
                    counter number
When used in a for loop, it searches the immediate 8 tiles surrounding a location, much like GetNeighbor. However, you can choose the direction of the search. The available directions are in the read me. There are 11 different ones.

There was a problem getting SLIC functions to return a location, so I had to store the location in a global variable. When the function has been called, just make your Loc variable equal to GT0_RetLoc, like so:

Code:
           tmpLoc = GT0_RetLoc;
The second function is GetTile1, it searches all the tiles available for a city to use after it has expanded one time. The sytax is:

Code:
                       GetTile1 ([loc], [tilenumber], [direction]);
                                           ^
                                     Your For loop
                                     counter number
Again there are 11 search directions available. When you have used the function, set the value of your Loc variable equal to GT1_RetLoc, like so:

Code:
           tmpLoc = GT1_RetLoc;
See the readme.txt for more details.

Check the image below for a visual explanation of the search directions for the second function.
Attached Files:
File Type: zip search.zip (122.4 KB, 7 views)

Last edited by ahenobarb; April 13, 2003 at 02:46.
ahenobarb is offline  
Old April 13, 2003, 02:33   #29
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
dp

Last edited by ahenobarb; April 13, 2003 at 02:38.
ahenobarb is offline  
Old April 13, 2003, 02:40   #30
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 23:21
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
Here is the image:
Attached Thumbnails:
Click image for larger version

Name:	gettile1 search2.jpg
Views:	132
Size:	90.5 KB
ID:	42365  
ahenobarb is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 19:21.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team