[MODCOM]Water Animals Mod

Hmmm... I believe you can control the amount of animals created through the GlobalDefines.XML file.
 
TheLopez said:
Hmmm... I believe you can control the amount of animals created through the GlobalDefines.XML file.
I think it would be needed to control this one specificly. The AI just spawns it like hell-I guess cause it's very strong and changing to a maxnumber in unitclasses won't work for the Barbarian I tested that.
I reduced str. to 8 but no effect and to make it lower than that I don't want- it should be dangerous to Frigates.
 
Ploeperpengel said:
I think it would be needed to control this one specificly. The AI just spawns it like hell-I guess cause it's very strong and changing to a maxnumber in unitclasses won't work for the Barbarian I tested that.
I reduced str. to 8 but no effect and to make it lower than that I don't want- it should be dangerous to Frigates.

Give me a day or so to take a look at the source code and see what I can do about it. What I'll probably do is have some new methods available through python to control the amount of sea animals that are spawned. I focus on sea animals because on the typical map there is more water plots than land plots.


Does that sound ok to you?
 
Sounds good. Maybe a configini also? You know I can't play much with python yet-but nevermind I can ask pythonwizards like you.:D Thx that's really needed currently it's impossible to keep any galley alive. Afterwards we must find a way to keep em spawning throughout the game but I guess Kael got a code for that.:)

Edit: And take your time I still have plenty of xml to do before the next testmod;)

Another Edit: that means the one I'll upload after the next one.
 
only just spotted this one :)

awesome !

Absolute MUST HAVE addition for the Privateers Mod

Now in v0.11 and functioning perfectly

Again. AWESOME :)


[edit: alas I spoke to soon :p took me a half hour play test before i saw krakens in every 10 squares!]
 
TheLopez said:
Give me a day or so to take a look at the source code and see what I can do about it. What I'll probably do is have some new methods available through python to control the amount of sea animals that are spawned. I focus on sea animals because on the typical map there is more water plots than land plots.


Does that sound ok to you?
How far is the progress of this very good idea?
 
Just buttoning up some last things, it should be released this week!!
 
Alright, v0.2 and v0.2w have been posted!!
 
how does this function?

it allows you to set the chance of animal water units being spawned, right ?

but can it allow a definable number of units to be spawned, or does it just have a % chance that a bunch of units appear on each turn (as before) ? if not is this possible ?
 
jenks said:
how does this function?

it allows you to set the chance of animal water units being spawned, right ?

but can it allow a definable number of units to be spawned, or does it just have a % chance that a bunch of units appear on each turn (as before) ? if not is this possible ?

It allows you to set the chance that water animals will be spawned.
 
TheLopez said:
It allows you to set the chance that water animals will be spawned.

So then there won't be more than one spawning, right? I mean, is it the chance of one spawning? If yes, then even a 100% will only produce one. I'm probably missing something in the math here.
 
Here's part of the changed code:
Code:
	for(pLoopArea = GC.getMapINLINE().firstArea(&iLoop); pLoopArea != NULL; pLoopArea = GC.getMapINLINE().nextArea(&iLoop))
	{
		// < Water Animals Start >
		//if (!(pLoopArea->isWater()))
		//{
		if( pLoopArea->isWater() )
		{
			iValue = (1 + getSorenRandNum(100, "Water Animal Spawn Check"));
			if(iValue > getWaterAnimalSpawnChance())
			{
				continue;
			}
		}

		iNeededAnimals = ((pLoopArea->getNumUnownedTiles() / GC.getHandicapInfo(getHandicapType()).getUnownedTilesPerGameAnimal()) - pLoopArea->getUnitsPerPlayer(BARBARIAN_PLAYER));

		if (iNeededAnimals > 0)
		{

So as you can see you are changing the chance that a water animal will be created in a water plot. Before the chance was always 100%. So as long as an animal was needed in a water plot a Kraken would be generated.

The new configuration option lets you change the chance. The default value has been set to 25%.
 
Hi!

There is a little logical error in your concept of the animal spawn chance.
The loop you posted above will pass your if-clause in e.g. 25% of all cases.

But in these remaining 25% iNeededAnimals is calculated as before and the same number of animals are created.
This value is calculated by some others values, including getUnownedTilesPerGameAnimal(). This is a value from CIV4HandicapInfo.xml and is something between 20 and 100 depending on the handicap.
Since a water area is normally much bigger than a land area, the value for iNeededAnimals gets very high and ~80 animals are created.

Fortunally, there is also a value called iUnownedWaterTilesPerBarbarianUnit in CIV4HandicapInfo.xml, which is used in CvGame::createBarbarianUnits() and has value between 1000 and 3000.
I borrowed some code from createBarbarianUnits() and modified createAnimals().

Here is my suggestion:
Code:
...
int iDivisor;
...
// < Water Animals Start >
if (pLoopArea->isWater())
{
	iDivisor = GC.getHandicapInfo(getHandicapType()).getUnownedWaterTilesPerBarbarianUnit();
}
else
{
	iDivisor = GC.getHandicapInfo(getHandicapType()).getUnownedTilesPerGameAnimal();
}

if (iDivisor > 0)
{
	iNeededAnimals = ((pLoopArea->getNumUnownedTiles() / iDivisor) - pLoopArea->getUnitsPerPlayer(BARBARIAN_PLAYER));
//if (!(pLoopArea->isWater()))
//{
//	iNeededAnimals = ((pLoopArea->getNumUnownedTiles() / GC.getHandicapInfo(getHandicapType()).getUnownedTilesPerGameAnimal()) - pLoopArea->getUnitsPerPlayer(BARBARIAN_PLAYER));
// < Water Animals End >
			
	if (iNeededAnimals > 0)
	{
		iNeededAnimals = ((iNeededAnimals / 5) + 1);

		for (iI = 0; iI < iNeededAnimals; iI++)
		{
			pPlot = GC.getMapINLINE().syncRandPlot((RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_PASSIBLE), pLoopArea->getID(), GC.getDefineINT("MIN_ANIMAL_STARTING_DISTANCE"));

If you want you can also modify the last line to:
Code:
pPlot = GC.getMapINLINE().syncRandPlot((RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_ADJACENT_LAND | RANDPLOT_PASSIBLE), pLoopArea->getID(), GC.getDefineINT("MIN_ANIMAL_STARTING_DISTANCE"));

Then, water animals will only spawn on coastal tiles.

This way, you don't need a value for the spawn chance and the number of water animals is also depending on the handicap.

Matze
 
MatzeHH said:
Hi!

There is a little logical error in your concept of the animal spawn chance.
The loop you posted above will pass your if-clause in e.g. 25% of all cases.
I disagree, but I am getting ahead of myself.

MatzeHH said:
But in these remaining 25% iNeededAnimals is calculated as before and the same number of animals are created.
This value is calculated by some others values, including getUnownedTilesPerGameAnimal(). This is a value from CIV4HandicapInfo.xml and is something between 20 and 100 depending on the handicap.
Since a water area is normally much bigger than a land area, the value for iNeededAnimals gets very high and ~80 animals are created.
That number is correct, since there is more water than land then logically there should be more marine animals...

I understand that right now there is only the evil kraken to contend with but I am working with someone to create more water animals.

MatzeHH said:
If you want you can also modify the last line to:
Code:
pPlot = GC.getMapINLINE().syncRandPlot((RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_ADJACENT_LAND | RANDPLOT_PASSIBLE), pLoopArea->getID(), GC.getDefineINT("MIN_ANIMAL_STARTING_DISTANCE"));

Then, water animals will only spawn on coastal tiles.

This way, you don't need a value for the spawn chance and the number of water animals is also depending on the handicap.
But we want animals to spawn anywhere there is water, not just in coastal tiles...
 
TheLopez said:
I understand that right now there is only the evil kraken to contend with but I am working with someone to create more water animals.

Oooo, that sounds cool. Can't wait to see the results of that. :)
 
TheLopez said:
That number is correct, since there is more water than land then logically there should be more marine animals...

Well, in the german community some people said there are far to many animals in the ocean. Cutting down the spawn chance doesn't help since it doesn't influence the number of animals.
We also discovered that the game can get very slow with this huge amount of animals. For me that is the greatest problem.

I tried to shorten this number with my code above. This is perfect for me, but I won't be disappointed if you have a different view.

But we want animals to spawn anywhere there is water, not just in coastal tiles...

That's why I seperated this code from my first suggestion. I think this depends on personal needs.

Matze
 
Is it hard to give gold in return for beating the beasties (you have robbed their lair or used them as catfood or whatever)?

The main problem with new units is always the graphics, i don't know how people can create those things. D&D has some great sea beasties, like sahaugin, elementals, sirens, Giant Octopus and Turtles, Sea Dragons (and lake dragons for lovers of Monkey (his nature is irrepressible!)). Also the loch ness monster springs to mind. Of course, Sea Serpents have gotta be there!

What about the bermuda triangle ? Maybe everything that goes there gets *chomped*?
 
Updated Warlords version to be compatible with the v2.0.8.0 patch.
 
Top Bottom