Thread Tools
Old September 25, 2001, 11:04   #1
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: 15:47
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Commerce Improvements for AIs
Here a sollution for the problem that the AI never builds commerce improvements like ports, drilling platforms, trading posts, outlet mall, and nature preserves. This code construct such tile improvements automaticly as soon as the AI has enough PW to build them in the city square.

To install this slic file just unzip the content of this *.zip file into your \ctp2_data\default\gamedata\ directory. And open the the scrip.slc file (of course MM2_scrip.slc for MedPack2 or APOL_script.slc for ApolytonPack, unfortunatly this file is not Cradle comapartible) and add at the end of that file the line:

#include "MG_ComImpsForAIs.slc"

All what you have to do after installation of this file: Open the the chat window in the game by typing (') of coarse without the brackets and type /reloadslic.

-Martin
Attached Files:
File Type: zip mg_comimpsforais.zip (1.8 KB, 30 views)
__________________
Civ2 military advisor: "No complaints, Sir!"

Last edited by Martin Gühmann; October 8, 2001 at 12:19.
Martin Gühmann is offline  
Old September 25, 2001, 14:35   #2
Cube
Warlord
 
Cube's Avatar
 
Local Time: 06:47
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
cool,

I just started a new game in MM2 it's in 2500 BC so starting a new one shouldn't hurt. From what you said this sound pretty random, is there a way to check a cities science rate with slic. how about you explain this, will it stop at a certain time, because if it just builds commerce improvements everywhere that's bad, but I'm sure you though about that right?

Edit: Just opened the file and read the intro, medmod 2 doesn't allow commerce improvements on hills, but that can be changed. The mm2 advances that allow mall and nature preserve are plastics and ecotopia, and radii change at 9, 36, 44, and 56. I got another problem I have a tree cutting slic that Peter made and Ben edited, and it converts forest and jungles into grassland for the first raduis then terraforms any forest or jungles for the second raduis, so this might not work for me how about making it build on swamps and tundra. they already build there, but not enough.

I'snt there a way to set priorities through slic for what gets built first?

Last edited by Cube; September 25, 2001 at 14:56.
Cube is offline  
Old September 26, 2001, 10:00   #3
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 14:47
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
You can only set order to a very limited extent...
Each handler can fire 'pre' (before) or 'post' (after). The Commerce one above fires 'post'. Check if the treecutters handler has the 'pre' bit or 'post' bit, and get them in the right order.
__________________
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 September 26, 2001, 15:31   #4
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: 15:47
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
So far as I know the the treecutter fires when a city grows. I guess I don't have the latest version or your version of the treecutter, therefore I'd like to see it if you would attach your treecutter file here. Of course there are a lot of events that can be used to trigger such actions.

Here is the list of Events from the slic documentation that occurs every turn once:

BeginTurn
WormholeTurn
PlayerPatience
PeaceMovement
PollutionTurn
BeginTurnAllCities
BeginTurnProduction
BeginTurnSupport
BeginTurnImprovements
BeginTurnAgreements
ResetAllMovement
AttemptRevolt
BeginTurnEndGame
BeginTurnGovernment
FinishBeginTurn
FinishBuildPhase
StartMovePhase
ProcessUnitOrders
AIFinishBeginTurn
UnitBeginTurnVision
BeginTurnUnit
CityTurnPreProduction
CityBeginTurn
CityBeginTurnVision
BeginTurnArmy
BeginTurnExecute
EndTurn

Maybe not every events of these can be used. And maybe other events works only for the AI. For GoodMod I used this event list to select the events and make shure that the slic code works in the correct order. Of course if you have a code triggered by the BeginTurn event it will be executed first if you have a code that is triggered by the EndTurn event. Than this code is triggered at least.

Quote:
Originally posted by Cube
I just started a new game in MM2 it's in 2500 BC so starting a new one shouldn't hurt.
It would hurt just to reload slic.

Quote:
Originally posted by Cube
From what you said this sound pretty random, is there a way to check a cities science rate with slic. how about you explain this, will it stop at a certain time, because if it just builds commerce improvements everywhere that's bad, but I'm sure you though about that right?
Actual it is very stupid. It builds everywere commerce improvements were it is possible and the AI didn't build any other improvements. So if you start a new game AI builds at first some food and production improvements until the necessary advances are discovered. Than the space is filled commerce improvements. Maybe a PW cheat for the AI would help. But I would make it more effective as the one that player 1 offered in the forum maybe by removing the /10. And the handler should fire between the BeginTurn and BeginTurnImprovements Event. So that the PW gained by the PW cheat could be used for other tileimprovements.

From my last MedPack 2 game (it is a little bit older) I had well developed AI a mass of tile improvements. So it doesn't hurt the AI so much. The bigger problem in MedPack is the happiness problem for AI. Also with maxing out the sliders concerning happiness the AI doesn't build enough happiness buildings to prevent revolutions.

Quote:
Originally posted by Cube
Edit: Just opened the file and read the intro, medmod 2 doesn't allow commerce improvements on hills, but that can be changed. The mm2 advances that allow mall and nature preserve are plastics and ecotopia, and radii change at 9, 36, 44, and 56.
You are right it is not fully compartible with MedPack 2. The code builds such improvements in MedPack but not very effectively. To custumize that code just use your suggestions concerning citysize and terrains.

Today I made a more effective version with a longer code maybe it would be better if I use fuctions for it but now it is typed, therefore here is the second version of that code. The advances is that at first only the inner rings of all cities are searched for the propper terrain. After the first round the second cycle is checked and so on. And this time only the terrain tiles that are part of the city radius are used for such tileimprovements.

-Martin
Attached Files:
File Type: zip mg_comimpsforais2.zip (2.4 KB, 43 views)
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old September 26, 2001, 17:02   #5
Cube
Warlord
 
Cube's Avatar
 
Local Time: 06:47
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
I put in mm2_scenario.slc, so i'm just going to post that. I changed the handler that terraforms the second radius from post to pre, but I don't know what it does.
Attached Files:
File Type: slc mm2_scenario.slc (12.6 KB, 12 views)
Cube is offline  
Old September 27, 2001, 01:44   #6
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
Quote:
Originally posted by Martin Gühmann
Actual it is very stupid. It builds everywere commerce improvements were it is possible and the AI didn't build any other improvements. So if you start a new game AI builds at first some food and production improvements until the necessary advances are discovered. Than the space is filled commerce improvements. Maybe a PW cheat for the AI would help. But I would make it more effective as the one that player 1 offered in the forum maybe by removing the /10. And the handler should fire between the BeginTurn and BeginTurnImprovements Event. So that the PW gained by the PW cheat could be used for other tileimprovements.
When AI uses 20% PW tax
Pw-cheat code adds 2*(total AI pop) PW
Your version would give 20*(total AI pop) PW
Is'nt that too much.
For exampe AI has 8 cites size 8, PW tax 20%
Your version would give 20*64=1280 PW evry turn!
My setting approximately doubles AI's PW income.
Your's will make it 11x bigger.
player1 is offline  
Old September 27, 2001, 11:03   #7
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: 15:47
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Here are the some numbers of my latest game year 1945:

Player 1

5351 14 hours#
4506 12 hours
3648 10 hours
2800 8 hours
1938 6 hours

Population 1209 55 Cities PW tax 30%


Player 2

111 14 hours
93 12 hours
76 10 hours#
56 8 hours
39 6 hours

Population 83 3 Cities PW tax 20%


Player 3

2022 14 hours
1708 12 hours
1385 10 hours#
1070 8 hours
704 6 hours

Population 135 13 Cities PW tax 20%


Player 4

307 14 hours 356 at 30% PWtax settings
259 12 hours
209 10 hours
161 8 hours
107 6 hours#

Population 118 5 Cities PW tax 25%

I am exploiting the population as much as possible. The AI doesn't do this. I cure unhappiness with entertainers the AI uses the global sliders. The PW income depends also on the lenght of the workday. The above numbers shows how big the income would be if the players uses different workday settings the setting marked with # are the settings that are used by the players.

For example player 4 looses more than two thirds of the possible PW income, because of inpropper settings player 3 the civ behind me looses I guesss with the a PW tax of 30% half its possible PW income, because of inpropper settings to cure pollution and unhappiness. And I guess player 3 will reduce its settings in the turns, because of unhappiness. Your PW mod will give player 3 only 2*135PW = 270PW. That is to less in comparision to the loss of more than 1000 PW.

Better is the calculation for the other AI players in PW gain, but in comparision to the human player it is to less. Of course my empire is much bigger, but that means there is no change for these AIs to be competive in any way. Only player 3 might have a change but my invation army could wipe player 3 out in a certain time. And note an advaced farm cost 500 PW and a trading post 250PW that means that player 2 will never build anything else before I will send some fusion tanks over the little channel.

So I thing the PW mod must be more effective for such small AIs maybe not ten times bigger but maybe five times.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old September 27, 2001, 12:40   #8
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
For happines improvments try this:
In startregies.txt in all discovery
strategies in BUILD_LIST_SEQUENCE_HAPPINESS
put:

BuildListSequenceElement {
Priority 11500 //higher then defense seq. in war
BuildListSequence BUILD_LIST_SEQUENCE_HAPPINESS
Bottom 0.1 //just most unhappy cities
HappyCities
Advice BUILD_HAPPINESS_ADVICE
}

in start strategies put:

BuildListSequenceElement {
Priority 1000 //don't build at start
BuildListSequence BUILD_LIST_SEQUENCE_HAPPINESS
Bottom 0.1
HappyCities
Advice BUILD_HAPPINESS_ADVICE
}

so they won't build shrines instead of settlers.


And in BuildListSequences.txt in
BUILD_LIST_SEQUENCE_HAPPINESS put:

BuildListElement { GarrisonUnitBuildList }

at front, so cities won't be undefended,
and to make martial law.

I tried this in my Mod, and AI cities
have 80+ happines (sometimes).
player1 is offline  
Old September 27, 2001, 12:53   #9
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
If human is AI player he would get extra 3627 PW.
It's almost the same as human 10hrs PW income.

player 2: extra 166 PW, original 76, 14hrs: 111PW
player 3: extra 270 PW, original 1385, 14hrs: 2022 PW
player 4: extra 195 PW, original 107, 14 hrs: 307 PW

All AI benefited in more than 2x bigger PW income,

exept player 3.
He has 2.5x lower production (original PW)
than player 1, but has almost 10x lower
population too.
How is that possibile?????????

There is a question: Is 2x increase enough?
At start of the game they pretty quickly build
almost all possibile improvments (quicker than
human and also before AGR. REV.)

Maybe latter in the game, when human player outnambers
AI in pop, should be some extra bonus.
Maybe after some turn, perheps?

Maybe in your new game with this slic, there would
not be such huge gap in human vs AIs pop.

Maybe it would be a little strage to have small civ
with all newest tile improvments built, and yours with
maybe 30% of newest improvments.
(it's a too obvius CHEAT)

P.S: For preveting humans to maximize sliders,
chage goverments in govern.txt like this:

RationsExpectation XX //depending od gov.
PositiveRationsCoef 2
NegativeRationsCoef 6
WorkdayExpectation XX
PositiveWorkdayCoef 2
NegativeWorkdayCoef 6
WagesExpectation XX
PositiveWagesCoef 2
NegativeWagesCoef 6

It's +2 for lowering sliders & -6 for raising
sliders.
player1 is offline  
Old September 27, 2001, 14:45   #10
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
After considerations, and testing with a new game,
I doubled PW bonus (/5).
Here it is v1.01
Attached Files:
File Type: slc pw_cheat.slc (731 Bytes, 12 views)
player1 is offline  
Old September 28, 2001, 07:57   #11
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: 15:47
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
Originally posted by player1
exept player 3.
He has 2.5x lower production (original PW)
than player 1, but has almost 10x lower
population too.
How is that possibile?????????
Player 3 built a lot more of production improvements than I do.

Quote:
Originally posted by player1
P.S: For preveting humans to maximize sliders,
chage goverments in govern.txt like this:
And how you prevent the AI from maxing out the sliders concerning happiness?


-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old September 28, 2001, 11:36   #12
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
Just make AI to build more happines improvments,
like I did (see my earlier post about happines).
After that it is even possibile that they max sliders (a little chance).
player1 is offline  
Old September 28, 2001, 12:34   #13
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
If it's still a problem, lower effect of entertainers to +1 happ. (pop.txt)
and lower pollution unhappines by 50% (govern.txt)
That way human wouldn't exploit entertainers too much .
player1 is offline  
Old September 28, 2001, 12:40   #14
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
player1: Settler --> Chieftain
player1 is offline  
Old September 28, 2001, 20:18   #15
Cube
Warlord
 
Cube's Avatar
 
Local Time: 06:47
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
I'm going to try those settings, I already put them in, and I'll see if the AI actually builds more happiness buildings. Do I have to start a new game or will it take affect right away. I'm going to start one anyway. I never noticed, but in medmod that priority is used for the bottom 0.5 happy cites. The science priority settings are set for the top 0.8 commerce cities so I changed that to 0.4 commerce cities.
Cube is offline  
Old September 29, 2001, 02:59   #16
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
You should start a new game.
And happines priorities must be the HIGHEST.
In Medmod they are very low so they are almost newer used.
And don't forget in starting strategies to put happy seq. as very low pirority (you don't want AI build ramayana & shrines instead of settlers & Hoplites)
player1 is offline  
Old September 29, 2001, 03:02   #17
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
These ara a strategies I use im my own mod.
They will probaly not work on its own, but you can see happines seq.
priorities compared to others.
Attached Files:
File Type: txt strategies.txt (105.3 KB, 12 views)
player1 is offline  
Old September 29, 2001, 03:05   #18
player1
Emperor
 
player1's Avatar
 
Local Time: 15:47
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Belgrade, Serbia
Posts: 3,218
Here is also a BuildListSequences.txt:
Attached Files:
File Type: txt buildlistsequences.txt (14.5 KB, 9 views)
player1 is offline  
Old September 29, 2001, 13:49   #19
Cube
Warlord
 
Cube's Avatar
 
Local Time: 06:47
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
Player one I already did all that, I set the happiness priority to 11500 and bottom 0.1 happy cities.


In Medmod they are very low so they are almost newer used.

actually thats not true they are at 7000, the reason the AI becomes unhappy IMHO is that happiness buildings go obsolete, and they don't build replacements, they just mess with the silders. I have noticed in my games that the happiest civs are the ones that haven't discovered advances that obsolete happiness buildings. Hopefully though if they have 78 or so hapiness when buildings go obsolete they won't be affected as much.

Back on topic, Why not make the slic trigger every 3 or four turns, and build at most 4 or 5 commerce improvements.
Cube is offline  
Old August 26, 2002, 13:52   #20
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: 15:47
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Commerce Improvements for AIs Version 3.0
OK here is a new version of the Commerce Improvements for AIs. But it still needs some playtesting and therefore I need your feedback. Actual doesn't do anything different then in the previous version, but it should do it in less time.

This file is full compartible with the default game, with ApolytonPack, CityMod2 and GoodMod for Apolyton Pack or CityMod2. It can be used with Cradle and MedPack2 too. But it isn't optimized for these mods. IIRC Cradle uses the same version as ApolytonPack but only used different build in DB indeces for the tile imps therefore, it won't give you an disadvantage if you use it for Cradle.

Installation is similar to the original file I posted:

To install this slic file just unzip the content of this *.zip file into your \ctp2_data\default\gamedata\ directory. And open the the scrip.slc file (of course CRA_scrip.slc for Craddle or APOL_script.slc for ApolytonPack) and add at the end of that file the line:

#include "MG_ComImpsForAIs.slc"

All what you have to do after installation of this file is: Open the the chat window once you are in the game by typing (') of course without the brackets and enter /reloadslic.

So test it and report.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old August 30, 2002, 18:19   #21
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: 15:47
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Obviously no one of you tested this file otherwise you would have notice two bugs.

First: The code was also active for the human player. Fixed.
Second: The code kept the AI from improveing existing non commerce improvements on beach, forest, hill... tiles. Problem fixed.

From this point of view the file seems to be stabil and much faster than the old one. Therefore I recomment the replacement of CRA_ComImpSForAIs2.slc, APOL_ComImpSForAIs2.slc and MG_ComImpSForAIs2.slc by this file: MG_ComImpsForAIs3.slc

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann 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 09:47.


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