[MOD] Military Bases

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Military Bases Mod
By: TheLopez

Last updated 11/08/06

Version: v0.3w
Patch Compatibility: Warlords v2.0.8.0
MP Compatible: ?
Download Mod v0.3w

Version: v0.2.1+SDK
Patch Compatibility: v1.61
MP Compatible: ?
Download Mod v0.2.1+SDK

Version: v0.2.1
Patch Compatibility: v1.61
MP Compatible: ?
Download Mod v0.2.1


Description:
The Military Bases Mod contains three new buildings allowing for the training
of land, sea and air units. Besides the three new buildings there is one mean
new unit the drill sergeant that depending on the configuration of the mod will
either be required to train units or will provide a bonus when training units.


Installation Instructions:

1) Unzip this into the "civ4_install_folder\Mods\" folder.
2) Open the CivilizationIV.ini configuration file
3) Change the Mod line to read: Mod = Mods\Military Bases
4) Load the game.
5) Then play as normal.

-----Game Play-----
Spoiler :

- Over 10 configurable options ranging from what militarys are available in the
mod to how experience is handed out to units.

- By default the amount of training is capped for units so they can only be
trained up to level 5. The training cap is configurable through the INI file.

- When units can be promoted they cannot be trained and if they were being
trained they will stop being trained. Traininig has to be resumed manually
once they are promoted.


-----Units-----
Spoiler :

- Drill Sergeant:
[TAB]- Requires the Military Tradition and Rifling Technologies
[TAB]- Cost: 180 hammers
[TAB]- Combat: 5
[TAB]- Movement: 2
[TAB]- Can only defend
[TAB]- Can withdraw from combat (20% Chance)
[TAB]- Can join city as Drill Sergeant
[TAB]- Allows units to be trained at military bases


-----Buildings/Improvements-----
Spoiler :

- Army Base:
[TAB]Description: In general, military bases provide accommodations for
[TAB]units, but they may also be used as a command center, a training
[TAB]ground, or a test ground. In particular army bases focus their
[TAB]training on land based units only. Military bases are often important
[TAB]to the local economy, providing jobs and inflows of cash.

[TAB]Cost: 180 hammers
[TAB]Requires: 4 barracks per Army Base, barracks in the city
[TAB]Pros: +15% commerce, +heals units extra 10% damage/turn, gives land
[TAB][TAB]based units fortified in city experience.
[TAB]Cons: -1 city health, + 15% maintenance

- Navy Base:
[TAB]Description: In general, military bases provide accommodations for
[TAB]units, but they may also be used as a command center, a training
[TAB]ground, or a test ground. In particular navy bases focus their
[TAB]training on sea based units only. Military bases are often important
[TAB]to the local economy, providing jobs and inflows of cash.

[TAB]Cost: 240 hammers
[TAB]Requires: Compass, 4 harbors per Navy Base, harbor and barracks in
[TAB][TAB]the city
[TAB]Pros: +15% commerce, +heals units extra 10% damage/turn, gives sea
[TAB][TAB]based units fortified in city experience.
[TAB]Cons: -1 city health, + 20% maintenance

- Airforce Base:
[TAB]Description: In general, military bases provide accommodations for
[TAB]units, but they may also be used as a command center, a training
[TAB]ground, or a test ground. In particular airforce bases focus their
[TAB]training on air based units only. Military bases are often important
[TAB]to the local economy, providing jobs and inflows of cash.

[TAB]Cost: 750 hammers
[TAB]Requires: Flight, 4 airports per Airforce Base, airport and barracks
[TAB][TAB]in the city
[TAB]Pros: +15% commerce, +heals units extra 10% damage/turn, gives air
[TAB][TAB]based units fortified in city experience.
[TAB]Cons: -2 city health, + 15% maintenance


-----Notes to Modmakers-----

If you want to use the Military Bases Mod in your mod I have tried to make
things as easy as possible for you. In the XML directories I have included
stripped down copies of the regular XML files, I have changed the CIV4 prefix
with MB to make those files easily identifiable. In the Python files I have
added #< Military Bases Start > and #< Military Bases End > in all of the
places that I have made changes to the original files.

All I ask is that you give me credit.


-----Version Information-----

-----v0.2.x------

- Finished documenting the code.

- Updated readme to remove references to using fortify as the way units get
experience.

- Integrated Talchas action button 2.0 code

- Removed commerce bonus from base since it confuses the AI. Reported by
Lanthanide

Spoiler :

-----v0.1------

- Initial re-creation of the Military Bases Mod infrastructure

- Added the drill sergeant unit to the mod.

- Added the configurable option allowing players to specify if drill sergeants
are required for training units.

- Added the configurable option allowing players to specify how many units can
be trained by a drill sergeant.

- Added the configurable option allowing players to specify if units should
gain experience randomly or not.

- Added the configurable options allowing players to specify if the amount of
experience should be capped and at what level it should be capped.

- Added the configurable options allowing players to specify which military
bases should be enabled in the mod.

- Added the configurable option allowing players to specify how much bonus
experience points drill sergeants provide when they are not required but are
used to train units.

- Added the configurable option allowing players to specify the base amount
units gain when their training is successful.

- Re-integrated the different military bases: army base, navy base and airforce
base

- Added the train unit action button

- Added the code to train units and hooked up the train unit action button.


-----To Do-----

- Extend the specialist, building and unit schemas to allow adding 0 or more
special text. This way we can indicate that a specialist, building, or unit
has special functionality built in that is provided through python and not
just XML.

-----===Credits & Thanks===-----

-Exavier
[TAB]Composite Mod - readme.txt format

-Stone-D
[TAB]SD Toolkit

- White Rabbit
[TAB]For the excellent drill sergeant model
 
Is there any limit to the xp gain?

There should only be one unit, the weekest unit in the city that gains the xp, and have some max, like 15 xp.

Even this makes it much, maybe only +1 xp every 3rd turn, or that the fortified units been diged in for 5 turns.
 
wolfie said:
1 xp each turn is probaly to much
but i like the idea

Zuul said:
Is there any limit to the xp gain?

Not yet, but I am looking for ideas for limiting Xp gain. Also remember that units must be fortified to get the xp gain. I am hoping that in a future release I can make an train action that would be used instead of fortify.

Also remember that for units to gain xp they have to be fortified meaning that they are essentially out of play unless the city is attacked or the player wakes the unit.

The other reason why is want to create the "Train" action is because so if a city is attacked the training unit won't be able to respond to the attack, but they will be automatically woken up the next turn if the city wasn't taken over. This basically amounts to the unit not being ready for combat since they could be in a classroom training, doing maneuvers, etc.

Zuul said:
There should only be one unit, the weekest unit in the city that gains the xp, and have some max, like 15 xp.

Even this makes it much, maybe only +1 xp every 3rd turn, or that the fortified units been diged in for 5 turns.

Again, these are good ideas to limit the xp gain. I am looking into how I can implement this in a per unit basis. In my original design I wanted to actually give each unit a decaying xp amount depending on their level:

Level 1 gets 1xp/turn
Level 2 gets (1xp * 0.9)/turn
Level 3 gets ((1xp * 0.9) * 0.9)/turn

Unfortunately this isn't possible since experience is stored as an int value so decimal values are not possible.

What could work is the unit would only gain Xp every (UnitLevel * constant):
So lets say the constant is 3 as you suggested.
Level 1 unit would gain an Xp every 3 turns.
Level 2 unit woulg gain an Xp every 6 turns.
Level 3 unit would gain an Xp every 9 turns.
...

I will see if I can make the constant configurable through the mod .ini file otherwise it will need to be hard coded in the python code.

In addition they when they reach their max Xp for their current level they will not gain any more Xp until the player chooses a new promotion for the unit. Currently there is a check to allow the unit to continue gaining Xp even if it is above their level max allowing users to save their unit promotions until they want to spend them.

Anyways, thanks for your ideas Zuul. I think I will start to tinker with them and see what I can come up with.
 
This idea is similar to my "Training Barracks Mod" (see signature below).

I got around the problem of exp being stored as an int by giving the unit a small percent chance each turn of getting 1 exp which, over time, comes out to the same thing as giving a fraction of an exp each turn.

You don't want to give the exp every 3rd turn because once the player figures out which turns are the exp turns he can be sure to move his units back in the city on those turns.

Feel free to look at my code and borrow anything that may help... just give credit as always.

Roger Bacon
 
RogerBacon said:
You don't want to give the exp every 3rd turn because once the player figures out which turns are the exp turns he can be sure to move his units back in the city on those turns.

Roger,

Actually handing out the Xp wouldn't be based on the game turn itself, instead it would be based on how many turns the unit has been fortified in the city: (current unit level) * (constant)

If the constant is 3 then:
Level 1 unit would gain an Xp every 3 turns.
Level 2 unit woulg gain an Xp every 6 turns.
Level 3 unit would gain an Xp every 9 turns.

So lets say the game turn is 100, and a level 1 warrior (xp 0/2) is fortified in a city with an army base that turn. The level 1 warrior would not get an Xp until turn 103 (if the player leaves the level 1 warrior fortified in the city until game turn 103). To make it clearer lets say at turn 101 a level 2 archer (xp 2/7) is fortified in the same city. The level 2 archer would not get an Xp until turn 106 (if the player leaves the level 2 archer fortified in the city until game turn 106).

Game turn 100: level 1 warrior (xp 0/2) - fortified
Game turn 101: level 1 warrior (xp 0/2), level 2 archer (xp 2/7) - fortified
Game turn 102: level 1 warrior (xp 0/2), level 2 archer (xp 2/7)
Game turn 103: level 1 warrior (xp 1/2), level 2 archer (xp 2/7)
Game turn 104: level 1 warrior (xp 1/2), level 2 archer (xp 2/7)
Game turn 105: level 1 warrior (xp 1/2), level 2 archer (xp 2/7)
Game turn 106: level 1 warrior (xp 2/2), level 2 archer (xp 3/7)

At this point if the player does not choose a promotion for the level 1 warrior the warrior will not gain more Xp (in v0.4 this is not the case, the level 1 warrior will continue to gain Xp, I plan to change this in v0.5, but lets assume that we are using the algorithm in v0.5) For game turn 106 the warrior does not get his earned promotion for whatever reason. The level 2 archer gets his Xp, the next Xp the level 2 archer will get will be in game turn 112.

Game turn 107: level 1 warrior (xp 2/2) - promotion pending, level 2 archer (xp 3/7)

The level 1 warrior gets his promotion, is now a level 2 warrior and is refortified in the city. Using the new formula the next turn that the warrior will get a promotion will be in game turn 113.

Game turn 108: level 2 warrior (xp 2/7), level 2 archer (xp 3/7)
Game turn 109: level 2 warrior (xp 2/7), level 2 archer (xp 4/7)
Game turn 110: level 2 warrior (xp 2/7), level 2 archer (xp 4/7)
Game turn 111: level 2 warrior (xp 2/7), level 2 archer (xp 4/7)
Game turn 112: level 2 warrior (xp 2/7), level 2 archer (xp 5/7)
Game turn 113: level 2 warrior (xp 3/7), level 2 archer (xp 5/7)
...

Theoretically this should work, but I will have to wait until I can get home to implement and test it. One modification to the formula that I am considering is:
((current unit level) * (constant)) + floor((# of turns fortified * rand()))

If the constant is 3, the unit fortified is a level 2 archer (xp 2/7) and it has been fortified for:
1 turn, it could take anywhere from 6 to 7 turns to get its next Xp
2 turns, it could take anywhere from 6 to 8 turns to get its next Xp.

The result of either of these two formulas would have to be set when the unit is fortified or woken up. This way we can prevent the issue you highlighted:
RogerBacon said:
... once the player figures out which turns are the exp turns he can be sure to move his units back in the city on those turns.
 
wolfie said:
1 xp each turn is probaly to much
but i like the idea

Zuul said:
Is there any limit to the xp gain?

The other limitation is that you need to meet the building requirements to build any of the bases. That means to build the navy base you need to have barracks and harbor in the target city and 4 free harbors (similar to building the cathedrals, etc.)
 
This is a pretty cool concept overall--I like the limitation of bases by needing a number of barracks, etc. to build them.

I agree with others, 1 xp/turn is too much. I think your scaled experience gain would probably work, but I'd do it based on current experience and not current level, with a x2 modifier. The reason is that level only goes up when a promotion is USED, so you could leave your level 1 warrior sitting there for 30 turns before you use the promos and he'll gain at base the whole time.

(Current unit experience) * (2) --> +1 xp.

This would be:

1 turns to 1 xp
2 turns to 2 xp (3 total)
4 turns to 3 xp (7 total)
6 turns to 4 xp (13 total)
8 turns to 5 xp (21 total)

That seems pretty reasonable...maybe even a bit harsh. It definitely wouldn't unbalance gameplay much. You'd probably want to base it on game speed, too (i.e., quick should be different than marathon!).

Anyway, this is really a great idea and I'll look forward to what you do with it!
 
Sevo said:
This is a pretty cool concept overall--I like the limitation of bases by needing a number of barracks, etc. to build them.

I agree with others, 1 xp/turn is too much. I think your scaled experience gain would probably work, but I'd do it based on current experience and not current level, with a x2 modifier. The reason is that level only goes up when a promotion is USED, so you could leave your level 1 warrior sitting there for 30 turns before you use the promos and he'll gain at base the whole time.

(Current unit experience) * (2) --> +1 xp.

This would be:

1 turns to 1 xp
2 turns to 2 xp (3 total)
4 turns to 3 xp (7 total)
6 turns to 4 xp (13 total)
8 turns to 5 xp (21 total)

That seems pretty reasonable...maybe even a bit harsh. It definitely wouldn't unbalance gameplay much. You'd probably want to base it on game speed, too (i.e., quick should be different than marathon!).

Anyway, this is really a great idea and I'll look forward to what you do with it!


Sevo,

Actually, for the next version of the mod, once a unit reaches its Xp max for the level it will not gain any more Xp until the unit is promoted. This way you won't be able to just sit a level 1 warrior in an army base and have him gain uber Xp. I did leave the code in to allow units to stack Xp up, its just commented out.

I was hoping to figure out how to use the .ini file so I can make it configurable through there. Something like "XpStacking = 1" would allow Xp to grow past its max like in the v0.4 of the Mod.
 
Good ideas. But you should max be able to do traning on 1-3 units at the same time. Else you could have 10-20 in there all gaining xp.
Units that has less that that city's start xp should much faster gain xp.
 
Zuul said:
Good ideas. But you should max be able to do traning on 1-3 units at the same time. Else you could have 10-20 in there all gaining xp.
Units that has less that that city's start xp should much faster gain xp.

Zuul, that's a good idea, I will try to fit it into my v0.6 release. I have implemented the Xp limiting features in the mod and are currently testing and fine tuning the new features. Right now I have set the constant in the formula: ((current unit level) * (constant)) to 3 and have found that it is a bit harsh for the higher level units. For a level 4 unit it will take 12 turns to gain 1 Xp. I might modify the formula to be less harsh randomly using the following formula: ((current unit level) * (constant)) - floor((# of turns fortified * rand())).
 
Alright guys, I have released version v0.5 with the Xp limiting features requested.
 
If you manage to create the "train" action for the units, I'd like to see a cap for how many units you could simultaneously train at one base. 1-3 might be a good limit. This so that you can't just go and pump up your entire army to max levels.
 
Exel said:
If you manage to create the "train" action for the units, I'd like to see a cap for how many units you could simultaneously train at one base. 1-3 might be a good limit. This so that you can't just go and pump up your entire army to max levels.

Exel,

Zuul has already proposed this idea. I was thinking about it and I think I will do it but with a twist.
1. I will probably require a military base upgrade for each troop you want to train with each military base upgrade costing more.
2. Each unit training in a military base will cost the city resources maybe some health, food, etc.
 
Hi TheLopez,

I tested your Mod, but for some reason the units in the City with the Military base aren't being 'trained'. The mod seems to load in Civ4 because at some point you get message 'Mod Military Base True'. Am I doing some wrong or missing some files.

Thanks for your help
 
Springsteen84 said:
Hi TheLopez,

I tested your Mod, but for some reason the units in the City with the Military base aren't being 'trained'. The mod seems to load in Civ4 because at some point you get message 'Mod Military Base True'. Am I doing some wrong or missing some files.

Thanks for your help

Are the units you are trying to train fortified or set as sentries?

I ask this because they need to be fortified. This will change when I introduce the new train action for units.

Also training will take a long time. Look at my response to Roger on Jan 17th for an explaination.
 
Hi,

they are all fortified. I think I did a test game for something like 30 turns and none of the units (a varity of units with no Xp and 4 Xp) gained extra XP points.
 
Ok, I'll look into it. Thanks for letting me know.
 
Top Bottom