View Full Version : Spawn system


AIAndy
Sep 19, 2011, 05:56 PM
I have started to extend the unit spawning system governed by CIV4SpawnInfos.xml.
It is now possible to specify terrains and features for units to spawn from in addition to the previous possibility to spawn them from resources.

Some further ideas are:

Change feature/terrain as result of the spawn rule
Add bonus as result
Spawn units with a special mission AI
Spawn units for a neutral player (that is only hostile with barbarians)
Spawn in and outside cultural borders
Restrictions by civic/game option/technology
Despawn
Spawn a whole group
Display a message to players on execution of the spawn rule


What do you think would be useful to add?

EldrinFal
Sep 19, 2011, 06:40 PM
I have started to extend the unit spawning system governed by CIV4SpawnInfos.xml.
It is now possible to specify terrains and features for units to spawn from in addition to the previous possibility to spawn them from resources.

Some further ideas are:

Change feature/terrain as result of the spawn rule
Add bonus as result
Spawn units with a special mission AI
Spawn units for a neutral player (that is only hostile with barbarians)
Spawn in and outside cultural borders
Restrictions by civic/game option/technology
Despawn
Spawn a whole group
Display a message to players on execution of the spawn rule


What do you think would be useful to add?

This is great news!

There was a discussion awhile back regarding Neanderthals spawning from Caves or some other kind of location (feature, tile improvement, etc.) which could be destroyed to stop the spawning. Same for animals coming from dens. Might be something to revisit.

DH also had an issue figuring out how to get rats to spawn within cultural borders for his disease mod. Looks like that path has opened up.

I had also suggested some kind of spawn based on the Crime stuff Hydro did: a criminal of some type spawning and running to a nearby city to loot, or pillage, etc.

Wow, lots of ideas kicked around in the past few months may resurface again! :cool:

Hydromancerx
Sep 19, 2011, 08:03 PM
@AIAndy

Can bonuses be removed as well? Such as loosing a mine or farm.

One cool idea would be animal migration via bonuses such as a bison resource disappearing in on tile but then appearing a few tiles away.

Dancing Hoskuld
Sep 19, 2011, 08:37 PM
I have started to extend the unit spawning system governed by CIV4SpawnInfos.xml.
It is now possible to specify terrains and features for units to spawn from in addition to the previous possibility to spawn them from resources.

Some further ideas are:

Change feature/terrain as result of the spawn rule
Add bonus as result
Spawn units with a special mission AI
Spawn units for a neutral player (that is only hostile with barbarians)
Spawn in and outside cultural borders
Restrictions by civic/game option/technology
Despawn
Spawn a whole group
Display a message to players on execution of the spawn rule


What do you think would be useful to add?

Is this change responsible for this (http://forums.civfanatics.com/showpost.php?p=10899877&postcount=290)?

DH also had an issue figuring out how to get rats to spawn within cultural borders for his disease mod. Looks like that path has opened up.

No, the problem is The Great Wall! If a barbarian rat plague, slave revolt or similar happens in the civ that has The Great Wall those units are expelled!

EldrinFal
Sep 19, 2011, 10:56 PM
@AIAndy

Can bonuses be removed as well? Such as loosing a mine or farm.

One cool idea would be animal migration via bonuses such as a bison resource disappearing in on tile but then appearing a few tiles away.

I like that idea. It would be cool to possibly consider animal migrations and give
them more life than simply wandering.

Is this change responsible for this (http://forums.civfanatics.com/showpost.php?p=10899877&postcount=290)?

No, the problem is The Great Wall! If a barbarian rat plague, slave revolt or similar happens in the civ that has The Great Wall those units are expelled!

Even Neutral units that are hostile to barbs only???

AIAndy
Sep 20, 2011, 12:41 AM
I like that idea. It would be cool to possibly consider animal migrations and give
them more life than simply wandering.



Even Neutral units that are hostile to barbs only???
I guess for the rats or slaves you would want them to spawn for a non barbarian but hostile to all player.

Is this change responsible for this?
Yes, but the question is why. That looks like it misses the bonustypes tag in the new example spawn rule but I made that optional in the new scheme.

Dancing Hoskuld
Sep 20, 2011, 02:24 AM
I guess for the rats or slaves you would want them to spawn for a non barbarian but hostile to all player.

You can only have civs and barbarians.

Yes, but the question is why. That looks like it misses the bonustypes tag in the new example spawn rule but I made that optional in the new scheme.

Probably because not every copy of the unit schema was updated everywhere and somewhere there is one called Afforess_... which is overriding the default one. We had a great push to have those outside the main files called something else to stop this sort of thing.

climat
Sep 20, 2011, 02:35 AM
Probably because not every copy of the unit schema was updated everywhere and somewhere there is one called Afforess_... which is overriding the default one. We had a great push to have those outside the main files called something else to stop this sort of thing.

Yes, that was the source of problem. My fault. :mischief:

AIAndy
Sep 20, 2011, 04:04 AM
You can only have civs and barbarians.
I think that is only a matter of changing the respective parts of the code (like checking all parts of the code that references the barbarian property and then splitting that up into separate properties).
Or is there any fundamental limit that prevents that?

ori
Sep 20, 2011, 04:13 AM
RiFe has three barb factions (demons, barbs, animals, i might miss one :mischief:) so I doubt its a fundamental limit...

Koshling
Sep 20, 2011, 06:13 AM
I think that is only a matter of changing the respective parts of the code (like checking all parts of the code that references the barbarian property and then splitting that up into separate properties).
Or is there any fundamental limit that prevents that?

Its doable. However, search for isBarbarian() in the source - theer are 258 occurances, so that's 258 places you need to chnage the code and consider what you are doing. Largely mechanical but a fair amount of destabilization risk.

Dancing Hoskuld
Sep 20, 2011, 07:24 AM
I think that is only a matter of changing the respective parts of the code (like checking all parts of the code that references the barbarian property and then splitting that up into separate properties).
Or is there any fundamental limit that prevents that?

It is possible, but it may just be simpler to re-write what the Great Wall does. My idea was to have it provide a string of forts along your borders taking into consideration terrain. Then placing a defensive unit in those forts to get ZoC.

This will only defend the area of your civ at the time it is built so extra wonders/buildings to extend it to your new borders in later eras could be made.

AIAndy
Sep 20, 2011, 07:43 AM
It is possible, but it may just be simpler to re-write what the Great Wall does. My idea was to have it provide a string of forts along your borders taking into consideration terrain. Then placing a defensive unit in those forts to get ZoC.

This will only defend the area of your civ at the time it is built so extra wonders/buildings to extend it to your new borders in later eras could be made.
That sounds like a very interesting effect.

I'll look at the players anyway because I'd like a neutral player as well that can be used for spawning automatic religion spreading units and the like that are still vulnerable to barbarians. And the isBarbarian is a good spot to look at to find out what a non standard player should be considering in the code.

Koshling
Sep 20, 2011, 08:54 AM
It is possible, but it may just be simpler to re-write what the Great Wall does. My idea was to have it provide a string of forts along your borders taking into consideration terrain. Then placing a defensive unit in those forts to get ZoC.

This will only defend the area of your civ at the time it is built so extra wonders/buildings to extend it to your new borders in later eras could be made.

IMO this would be MASSIVELY OP. Fort Zocs + defensive bonus make them HUGE HUGE advantages (which the AI doesn't use properly but that's not the point here). This is why forts are so expensive to build - having a wonmder give you a whole ring like this would pretty much make a human player impregnable - it's just too powerful.

EldrinFal
Sep 20, 2011, 09:17 AM
It is possible, but it may just be simpler to re-write what the Great Wall does. My idea was to have it provide a string of forts along your borders taking into consideration terrain. Then placing a defensive unit in those forts to get ZoC.

This will only defend the area of your civ at the time it is built so extra wonders/buildings to extend it to your new borders in later eras could be made.

What about a new boolean tag added to units that sets whether they are affected by the Great Wall (or some general concept) and then just have the Great Wall check for that and the barbarian tag to boot units out?


I guess for the rats or slaves you would want them to spawn for a non barbarian but hostile to all player.


I think HOSTILE to all. So potentially a disease-carrying rat could even infect a barbarian unit. There may also be, at some point, a need to create some other military unit, like a warlord or something, that spawns via event and goes after the nearest civ, killing everything in his way. Maybe that could be a means to a new Civ appearing in the game? Or slave revolts, prisoner escapes, criminals, zombie outbreaks and what have you. :mischief:

Nevets_
Sep 20, 2011, 11:20 AM
If you plan on splitting neanderthals / animals / rebels into different factions I have a couple suggestions:

Reduce Neanderthal spawn rates, but make them hostile to animals so they hunt them too. That way there is an incentive for players to hunt down and exterminate them, as they are competing for the same resources.

If neanderthals spawn from caves, and so do other animals (cave bear for example), killing all the neanderthals but not destroying the cave could let either a neanderthal or a bear spawn there, so there is a choice in whether you want to take that risk and possibly get a bear. I'm not sure but I would assume the spawning code doesn't let a spawn occur on top of a hostile unit so once an animal re-occupies the den a neanderthal won't spawn anymore.

If animals spawn on and guard 'dens' then if possible, make animal spawning inside cultural borders possible if on a den improvement. And if possible code the AI to not destroy den improvements if they are within 3 or 4 tiles of one of their cities. That way the AI can 'farm' the dens for animals too. Once a player has researched a certain tech (livestock domestication or agriculture or something) dens are auto destroyed inside his cultural borders.

Also, it may just be me, but I think neanderthals are too tough. I can't kill them until I get a master hunter & tracker with forestry 1 and tempt them into a attacking me on a forest/jungle square; and then only about 60% of the time).

I think neanderthal spawning should stop earlier, and maybe change them to 2:str: and give them Woodsman 3. That would make them just as tough attacking in the woods, but not invincible on the defense. Historically, neanderthals kept more to the wooded terrain, and humans kept more towards the open plains.

EldrinFal
Sep 20, 2011, 01:54 PM
If you plan on splitting neanderthals / animals / rebels into different factions I have a couple suggestions:

Reduce Neanderthal spawn rates, but make them hostile to animals so they hunt them too. That way there is an incentive for players to hunt down and exterminate them, as they are competing for the same resources.

If neanderthals spawn from caves, and so do other animals (cave bear for example), killing all the neanderthals but not destroying the cave could let either a neanderthal or a bear spawn there, so there is a choice in whether you want to take that risk and possibly get a bear. I'm not sure but I would assume the spawning code doesn't let a spawn occur on top of a hostile unit so once an animal re-occupies the den a neanderthal won't spawn anymore.

If animals spawn on and guard 'dens' then if possible, make animal spawning inside cultural borders possible if on a den improvement. And if possible code the AI to not destroy den improvements if they are within 3 or 4 tiles of one of their cities. That way the AI can 'farm' the dens for animals too. Once a player has researched a certain tech (livestock domestication or agriculture or something) dens are auto destroyed inside his cultural borders.

Also, it may just be me, but I think neanderthals are too tough. I can't kill them until I get a master hunter & tracker with forestry 1 and tempt them into a attacking me on a forest/jungle square; and then only about 60% of the time).

I think neanderthal spawning should stop earlier, and maybe change them to 2:str: and give them Woodsman 3. That would make them just as tough attacking in the woods, but not invincible on the defense. Historically, neanderthals kept more to the wooded terrain, and humans kept more towards the open plains.

I haven't played a ton of maps with the newest version yet, but the ones I have I didn't think the Neanderthal Spawn rate was too much. In fact, with the non-Raging Barb map, I thought it was a tad low. But I think people who don't use Raging, which is probably the majority, don't want to deal with them much, so it's probably a good setting.

Str 2 seems a little weak to me. With Woodsman, I believe just the Defense goes up in Forest/Jungle right? So with your +50% bonus to defense in Forest, your Slinger is now Str 3 vs the Neanderthal Str 2 and will win most of the time, which basically reverses things. I think in the early game Neanderthals are supposed to be frightening-- like Prehistoric roving brigands. I lowered their City Attack to help the AI out, but I don't want them to become a non-issue.

Nevets_
Sep 20, 2011, 02:05 PM
With Woodsman, I believe just the Defense goes up in Forest/Jungle right? So with your +50% bonus to defense in Forest, your Slinger is now Str 3 vs the Neanderthal Str 2 and will win most of the time, which basically reverses things.

Woodsman 3 is +50% forest/jungle attack. So Str 2 Neanderthal is effectively 3 Str defending in forest (from natural +50% tile defense) and Str 3 attacking in forests (from Woodsman 3 +50% attack). So slinger in the forest on defense would be 3 vs 3, and on offense would be 2 vs 3. Right now it's defense 3 vs 3, offense 2 vs 4.5. This means that Neanderthals on defensive terrain (and the AI loves to keep to the forests/hills) can't be attacked until you get tomahawk throwers or other Str 4 units, the only way to kill them is to lure them into attacking you. Plus if you are on open ground, there is no way you are going to survive.

EldrinFal
Sep 20, 2011, 02:16 PM
Woodsman 3 is +50% forest/jungle attack. So Str 2 Neanderthal is effectively 3 Str defending in forest (from natural +50% tile defense) and Str 3 attacking in forests (from Woodsman 3 +50% attack). So slinger in the forest on defense would be 3 vs 3, and on offense would be 2 vs 3. Right now it's defense 3 vs 3, offense 2 vs 4.5. This means that Neanderthals on defensive terrain (and the AI loves to keep to the forests/hills) can't be attacked until you get tomahawk throwers or other Str 4 units, the only way to kill them is to lure them into attacking you. Plus if you are on open ground, there is no way you are going to survive.

As you can see, I don't get Woodsman 3 often! :lol: Is that the only bonus it confers?

It might be worth testing. I always considered barbarians as auto-death for my early game units anyway-- across ALL civilization games-- so that was the standard I've been measuring them up against.

Nevets_
Sep 20, 2011, 02:32 PM
That's it. The speed bonus is Woodsman 2. I guess the other option is to make the not get any defensive bonuses, but they would still be deadly on open ground, and it wouldn't make any sense. I think Neandethals should be dangerous, but that you should be able to kill them with a one two punch by sacrificing a unit and finishing them off with another. Right now that's not workable until you get str 3 units (and even then it's hard).

Dancing Hoskuld
Sep 20, 2011, 02:35 PM
That's it. The speed bonus is Woodsman 2. I guess the other option is to make the not get any defensive bonuses, but they would still be deadly on open ground, and it wouldn't make any sense. I think Neandethals should be dangerous, but that you should be able to kill them with a one two punch by sacrificing a unit and finishing them off with another. Right now that's not workable until you get str 3 units (and even then it's hard).

Just added Sabretooth Tigers to make life even harder. If you activate them. :D

EldrinFal
Sep 20, 2011, 02:52 PM
Just added Sabretooth Tigers to make life even harder. If you activate them. :D

Are we going to see some Cat Riders soon, DH? :mischief:

Dancing Hoskuld
Sep 20, 2011, 03:05 PM
Are we going to see some Cat Riders soon, DH? :mischief:

I do have wolf riders and pig chariots! Had them for quite some time, but refrained. Pity dog carts were used, wonder if I can change the pig chariot into a wolf one.:mischief:

Dancing Hoskuld
Sep 20, 2011, 03:17 PM
IMO this would be MASSIVELY OP. Fort Zocs + defensive bonus make them HUGE HUGE advantages (which the AI doesn't use properly but that's not the point here). This is why forts are so expensive to build - having a wonmder give you a whole ring like this would pretty much make a human player impregnable - it's just too powerful.

Not really, since you expand beyond it very quickly and the forts then get in your way and need to be replaced by farms and mines. So it only protects the bit of land you controlled when you built it, not all your land for eternity.

bill2505
Sep 20, 2011, 03:20 PM
I do have wolf riders and pig chariots! Had them for quite some time, but refrained. Pity dog carts were used, wonder if I can change the pig chariot into a wolf one.:mischief:

pig chariots.:confused: common .you can create many wonderfull thing and you loose your time on things like this.ok i understand the alternative things but ok this is:blush: is there a way to turn this off

Dancing Hoskuld
Sep 20, 2011, 03:38 PM
pig chariots.:confused: common .you can create many wonderfull thing and you loose your time on things like this.ok i understand the alternative things but ok this is:blush: is there a way to turn this off

They are not in and they aren't mine. I just liberated them as I was pillaging other mods for useful stuff, I think they came with some of the resources we use.

bill2505
Sep 20, 2011, 04:07 PM
the same goes for deer cavalry(forget its name) .deers are afraid of their own shadow not using them as war animals

BlueGenie
Sep 20, 2011, 04:22 PM
the same goes for deer cavalry(forget its name) .deers are afraid of their own shadow not using them as war animals

So where horses once upon a time, before domestication and breeding for certain stats. So what's to say one can't do that with deer, or maybe elk would be more realistic? *grin*

EldrinFal
Sep 20, 2011, 04:34 PM
the same goes for deer cavalry(forget its name) .deers are afraid of their own shadow not using them as war animals

You need to go out and watch Mononoke Hime (Princess Mononoke) ;)

I do have wolf riders and pig chariots! Had them for quite some time, but refrained. Pity dog carts were used, wonder if I can change the pig chariot into a wolf one.:mischief:

:lol: Well boars can get quite large, so perhaps with breeding and domestication, there is a possibility for a Boar Rider in the Alternate Timeline. Wolves... realistic wolves... I'm not so sure. Dire Wolves, yeah. :mischief: Maybe a Wolf SLED?

Hydromancerx
Sep 20, 2011, 05:25 PM
the same goes for deer cavalry(forget its name) .deers are afraid of their own shadow not using them as war animals

Well it depends upon what kind of deer. We have today domesticated reindeer who can pull sleds just fine. It conceivable that one could also ride a reindeer. Our graphics are limited so the deer riders look like they are riding a mule deer or white tailed deer. But really it should probably look more like a reindeer.

RPG
Sep 20, 2011, 06:39 PM
You need to go out and watch Mononoke Hime (Princess Mononoke) ;)




It is a must see movie. :)

bill2505
Sep 20, 2011, 10:39 PM
Well it depends upon what kind of deer. We have today domesticated reindeer who can pull sleds just fine. It conceivable that one could also ride a reindeer. Our graphics are limited so the deer riders look like they are riding a mule deer or white tailed deer. But really it should probably look more like a reindeer.

yeah and the reindeer is going to have a big red nose

Rudolph come on sweetie attack the enemy pikemen :D
neverind. 1 question will someone be able to disable them

2 a question that you answer if you want how old are you guys from the team

Dancing Hoskuld
Sep 20, 2011, 10:48 PM
yeah and the reindeer is going to have a big red nose

Rudolph come on sweetie attack the enemy pikemen :D
neverind. 1 question will someone be able to disable them

2 a question that you answer if you want how old are you guys from the team

1. Anything in Alt-Timelines can be disabled. Read the opening post for that thread.

2. Ages range from "callow youth" to "venerable wrinkly".:mischief: I am in the latter category.

Hydromancerx
Sep 20, 2011, 11:19 PM
yeah and the reindeer is going to have a big red nose

Rudolph come on sweetie attack the enemy pikemen :D
neverind. 1 question will someone be able to disable them

2 a question that you answer if you want how old are you guys from the team

1. What DH said.

2. Late 20's for me. But civ is really a game for all ages. Which is one reason I love modding for it.

EldrinFal
Sep 20, 2011, 11:28 PM
I started a new game with Planet Generator using day old SVN and it seems my game is spawning almost exclusively Bears for the land animal units. In Worldbuilder I saw just 2-3 Jaguar/Cheetah units, a few Zebras, and the rest Bears all over. Lots of Neanderthals too. And Mermaids for water units-- didn't see crocs actually.

Max Comp save attached.

Edit: Looks like the Neanderthals spawned heavily on two continents and wiped out the AI there. Must be from the distribution of bonuses.

AIAndy
Sep 21, 2011, 12:31 AM
I started a new game with Planet Generator using day old SVN and it seems my game is spawning almost exclusively Bears for the land animal units. In Worldbuilder I saw just 2-3 Jaguar/Cheetah units, a few Zebras, and the rest Bears all over. Lots of Neanderthals too. And Mermaids for water units-- didn't see crocs actually.

Max Comp save attached.

Edit: Looks like the Neanderthals spawned heavily on two continents and wiped out the AI there. Must be from the distribution of bonuses.
Actually there was a problem in the new spawn code that could cause some weird effects so better change to the new version (and the bear problem is probably caused by the example spawn rule from forest which I have scaled way down now as it was meant to be an example but with a lot of forest it can probably be high spawning).

strategyonly
Sep 21, 2011, 02:55 AM
I haven't looked at all at the spawning techniques yet (am too busy with about 9 projects to be added) but anyways, i need these, are they all in there?

This would be under: CIV4SpawnCivInfos

<CivilizationInfo>
<Type>CIVILIZATION_TUPI</Type>
<Leader>LEADER_TUPI_TRIBE</Leader>
<SpawnTech>TECH_ARCHERY</SpawnTech>
<NumberOfSpawnTech>2</NumberOfSpawnTech>
<SpawnChance>60</SpawnChance>
<IsBarbarianCiv>True</IsBarbarianCiv>
<StartAtCoast>False</StartAtCoast>
<TotalGold>25</TotalGold>
<TechPercent>15</TechPercent>
<DefaultShips>NONE</DefaultShips>
<NumberShipsPerCity>0</NumberShipsPerCity>
<NumberOfCities>1</NumberOfCities>
<StartX>-1</StartX>
<StartY>-1</StartY>
<NumWorkerPerCity>0</NumWorkerPerCity>
<CapitalCityUnit>UNIT_CUNHAMBEBE</CapitalCityUnit>
<NumCapitalUnit>1</NumCapitalUnit>
<DefaultCityDefender>UNIT_JAVELINEER</DefaultCityDefender>
<NumberCityDefendersPerCity>1</NumberCityDefendersPerCity>
<DefaultSecondUnit>UNIT_WARRIOR<DefaultSecondUnit>
<NumberSecondUnit>1</NumberSecondUnit>
</CivilizationInfo>

EldrinFal
Sep 21, 2011, 08:57 AM
Actually there was a problem in the new spawn code that could cause some weird effects so better change to the new version (and the bear problem is probably caused by the example spawn rule from forest which I have scaled way down now as it was meant to be an example but with a lot of forest it can probably be high spawning).

Ok, will do. And maybe the animals will balance out once more of them spawn from common terrain. My map WAS high on forest as I tend to choose "Wet" maps.

AIAndy
Sep 21, 2011, 09:04 AM
I haven't looked at all at the spawning techniques yet (am too busy with about 9 projects to be added) but anyways, i need these, are they all in there?

This would be under: CIV4SpawnCivInfos

<CivilizationInfo>
<Type>CIVILIZATION_TUPI</Type>
<Leader>LEADER_TUPI_TRIBE</Leader>
<SpawnTech>TECH_ARCHERY</SpawnTech>
<NumberOfSpawnTech>2</NumberOfSpawnTech>
<SpawnChance>60</SpawnChance>
<IsBarbarianCiv>True</IsBarbarianCiv>
<StartAtCoast>False</StartAtCoast>
<TotalGold>25</TotalGold>
<TechPercent>15</TechPercent>
<DefaultShips>NONE</DefaultShips>
<NumberShipsPerCity>0</NumberShipsPerCity>
<NumberOfCities>1</NumberOfCities>
<StartX>-1</StartX>
<StartY>-1</StartY>
<NumWorkerPerCity>0</NumWorkerPerCity>
<CapitalCityUnit>UNIT_CUNHAMBEBE</CapitalCityUnit>
<NumCapitalUnit>1</NumCapitalUnit>
<DefaultCityDefender>UNIT_JAVELINEER</DefaultCityDefender>
<NumberCityDefendersPerCity>1</NumberCityDefendersPerCity>
<DefaultSecondUnit>UNIT_WARRIOR<DefaultSecondUnit>
<NumberSecondUnit>1</NumberSecondUnit>
</CivilizationInfo>
I am not entirely sure what you mean. This thread was mainly about the unit spawn system in CIV4SpawnInfos.xml in the XML/Units folder.


After thinking a bit about the current system I think it is too hard to control. The problem is that depending on the number of bonuses or terrain forms the number of units spawned can vary a lot.
A possibility would be to vary the spawn chance depending on the number of plots that are valid for a certain rule in proximity.
Setting the local density lower might help as well.

EldrinFal
Sep 21, 2011, 09:08 AM
I am not entirely sure what you mean. This thread was mainly about the unit spawn system in CIV4SpawnInfos.xml in the XML/Units folder.


After thinking a bit about the current system I think it is too hard to control. The problem is that depending on the number of bonuses or terrain forms the number of units spawned can vary a lot.
A possibility would be to vary the spawn chance depending on the number of plots that are valid for a certain rule in proximity.
Setting the local density lower might help as well.

Can the base chance of a spawn be lowered as more of them propagate the map? That way if there are 20 units on the map already, the chances of another of that type spawning is say 30% less? Also, which units get the first crack at spawning on a tile? If bears are at the top of the list for example, that would seem to give them the best chance of spawning. If that is the case, then either the first unit in the queue must be randomized, or the most rare spawn be at the top of the queue.

AIAndy
Sep 21, 2011, 09:34 AM
Can the base chance of a spawn be lowered as more of them propagate the map? That way if there are 20 units on the map already, the chances of another of that type spawning is say 30% less? Also, which units get the first crack at spawning on a tile? If bears are at the top of the list for example, that would seem to give them the best chance of spawning. If that is the case, then either the first unit in the queue must be randomized, or the most rare spawn be at the top of the queue.
Good idea. I could store the units spawned by a certain spawn rule and then reduce the spawn chance for each such unit still alive.
The list order should not have a big impact as every single spawn is done independently at the moment so you can even have more than one unit spawn on the same plot in the same turn.

EldrinFal
Sep 21, 2011, 09:48 AM
Good idea. I could store the units spawned by a certain spawn rule and then reduce the spawn chance for each such unit still alive.
The list order should not have a big impact as every single spawn is done independently at the moment so you can even have more than one unit spawn on the same plot in the same turn.

Ah yes, the new spawn system allows stack spawning. The previous method I believe would not spawn a unit if one existed there already.

The world totals will need to scale for map size, but I'm sure you know that already. ;)

The other issue may be that some of the animals start spawning earlier, turn-wise. So that gives them more time to reproduce before the other animals get their shot.

AIAndy
Sep 21, 2011, 10:07 AM
Ah yes, the new spawn system allows stack spawning. The previous method I believe would not spawn a unit if one existed there already.

The world totals will need to scale for map size, but I'm sure you know that already. ;)

The other issue may be that some of the animals start spawning earlier, turn-wise. So that gives them more time to reproduce before the other animals get their shot.
If I remember the code correctly, there is only the limit to local density, not any enforced limit that there is no other unit on the plot.

EldrinFal
Sep 21, 2011, 10:28 AM
If I remember the code correctly, there is only the limit to local density, not any enforced limit that there is no other unit on the plot.

You're right. I remembered incorrectly. Here is Koshling's post on that:

http://forums.civfanatics.com/showpost.php?p=10794060&postcount=190


So they won't spawn if the tile is owned by someone or a non-barb unit is on it. Or depending on density-- though now that I read it again, I'm not sure if that means no spawn if there is a single unit of that same type within a radius of the tile # specified, or if the density = number of units per some area size he defines as "local" ??? :confused:

Edit: Sorry, Koshling. Should have been you :mischief:

Koshling
Sep 21, 2011, 11:43 AM
You're right. I remembered incorrectly. Here is DH's post on that:

http://forums.civfanatics.com/showpost.php?p=10794715&postcount=192

So they won't spawn if the tile is owned by someone or a non-barb unit is on it. Or depending on density-- though now that I read it again, I'm not sure if that means no spawn if there is a single unit of that same type within a radius of the tile # specified, or if the density = number of units per some area size he defines as "local" ??? :confused:

'he' was me actually. 'local' means within a not-disclosed-extrernally radius, but it's currently 3. The actual radius doesn't effect the XML tuning since it's specified in min 'tiles/unit' - any more than that ratio an the spawn is inhibitted (so if you're in the middle of a landmass there will be 49 tiles considered so its (#units)/49 as the local density - if you're on a coast it may be less than 49 but it still calculates the same area-independent ratio). The density counts only the unit of type being spawned, so it's strictly a density for THAT spawn type.

EldrinFal
Sep 21, 2011, 12:14 PM
'he' was me actually. 'local' means within a not-disclosed-extrernally radius, but it's currently 3. The actual radius doesn't effect the XML tuning since it's specified in min 'tiles/unit' - any more than that ratio an the spawn is inhibitted (so if you're in the middle of a landmass there will be 49 tiles considered so its (#units)/49 as the local density - if you're on a coast it may be less than 49 but it still calculates the same area-independent ratio). The density counts only the unit of type being spawned, so it's strictly a density for THAT spawn type.

Ok, so if the setting is 1 then, the same unit type will NOT spawn if another unit of that same type already exists within that radius 3, including the spawn tile itself, correct? And by type that means the exact same unit, so even if 20 Cows were grazing in the area, a Bison could spring up in the middle of them-- or any other non-Cow.


I edited my earlier post to quote the right person. Sorry about that. :blush:

Koshling
Sep 21, 2011, 12:44 PM
Ok, so if the setting is 1 then, the same unit type will NOT spawn if another unit of that same type already exists within that radius 3, including the spawn tile itself, correct? And by type that means the exact same unit, so even if 20 Cows were grazing in the area, a Bison could spring up in the middle of them-- or any other non-Cow.


I edited my earlier post to quote the right person. Sorry about that. :blush:

No. A value of 1 means there cannot be more than 1 per tile, so the spawn would be disabled if there were already 49 units of that type within the 3 radius (7X7 square centereed on the spawn point)! '1' is NOT a number I recommend using :-) Neandertahls I think are set to 5, so the spawn will stop if the there is more than 1 neanderthal per 5 tiles locally (10 in the 7X7 square in the simple case).

On the second part, correct. A Bison spawn will only count other bison in its density evaluation (if need be we could extend the spawn XML to have a concept of a 'unit family' thoguh so that density would apply to spawns within a family).

EldrinFal
Sep 21, 2011, 01:12 PM
No. A value of 1 means there cannot be more than 1 per tile, so the spawn would be disabled if there were already 49 units of that type within the 3 radius (7X7 square centereed on the spawn point)! '1' is NOT a number I recommend using :-) Neandertahls I think are set to 5, so the spawn will stop if the there is more than 1 neanderthal per 5 tiles locally (10 in the 7X7 square in the simple case).

Ok, it is a little confusing then. Intuitively I would consider the number as how many units maximum within the set radius. Not unit per set tile ratio. So if the radius is 3 tiles, then a setting of 5 would mean that the spawn stops if there are 5 or more of those units within the radius of 3. That is what "MaxLocalDensity" sounds like to me anyway.



On the second part, correct. A Bison spawn will only count other bison in its density evaluation (if need be we could extend the spawn XML to have a concept of a 'unit family' thoguh so that density would apply to spawns within a family).

Maybe in the future, but I don't see an immediate need. :)

Dancing Hoskuld
Sep 21, 2011, 02:11 PM
AIAndy, If you want, you can do what you like with the spawns for Gorilla, Orangutan, Panda, and both salt water crocs. The first three are a bit low due the choice of resource I had available. The crocs are about right but need to be restricted in spawn range to the tropics.

With higher rates of animals I don't get any barbarian units or cities spawning.

I do use my graphically challenged units when I test and I will have to up the mermaids and leviathans call them various sharks and whales.

Koshling
Sep 21, 2011, 02:51 PM
Ok, it is a little confusing then. Intuitively I would consider the number as how many units maximum within the set radius. Not unit per set tile ratio. So if the radius is 3 tiles, then a setting of 5 would mean that the spawn stops if there are 5 or more of those units within the radius of 3. That is what "MaxLocalDensity" sounds like to me anyway.

Right, but the number of tiles within the radius varies depending on the terrain (sea etc. cuts out possible places units can be). That's why I dont tell you its a radius of 3 because you cant draw any conclusions on the number of tiles involved anyway, and why it has to be a density, NOT an absolute number. Ideally it would be 1/5th rather than '5' but then I'd have to make it a non-integer which I didn't want to do, so it's actually 1/density which I admit is slightly confusing ;-) However, this way is more flexible and works correctly with any defintion of 'local' in a totally terrain-independent manner which was the main point.

Hydromancerx
Sep 21, 2011, 03:16 PM
I noticed that a lot of animals spawned resources on the map. So much so I would get like huge clusters of them in areas. I think that they should not spawn resources on the map as often OR have the resources that do spawn from units not generate on the map as much to compensate for the units making them.

Dancing Hoskuld
Sep 21, 2011, 03:23 PM
I noticed that a lot of animals spawned resources on the map. So much so I would get like huge clusters of them in areas. I think that they should not spawn resources on the map as often OR have the resources that do spawn from units not generate on the map as much to compensate for the units making them.

Currently there is only a 40% chance of the subdued animal spawning a resource instead of being captured. What % do you suggest?

Hydromancerx
Sep 21, 2011, 03:40 PM
Currently there is only a 40% chance of the subdued animal spawning a resource instead of being captured. What % do you suggest?

Maybe half that (like 20%) and then we can see if its still too much or not enough.

Koshling
Sep 21, 2011, 03:54 PM
Animal spawn rates seem VERY low to me. In 50 turns in quite a large area I saw noen at all. I ran debug to see what was happening and it was averaging about 1 animal per turn WORLDWIDE.

AIAndy
Sep 21, 2011, 04:08 PM
AIAndy, If you want, you can do what you like with the spawns for Gorilla, Orangutan, Panda, and both salt water crocs. The first three are a bit low due the choice of resource I had available. The crocs are about right but need to be restricted in spawn range to the tropics.

With higher rates of animals I don't get any barbarian units or cities spawning.

I do use my graphically challenged units when I test and I will have to up the mermaids and leviathans call them various sharks and whales.
Added gorilla and orangutan spawn rule from jungle.
Panda only spawns from Bamboo now (as it should be).
Salt water crocs restricted to 30 degrees from equator.
Penguins restricted to southern hemisphere.
Polar bear restricted to northern hemisphere near the poles.

Dancing Hoskuld
Sep 21, 2011, 04:20 PM
Added gorilla and orangutan spawn rule from jungle.
Panda only spawns from Bamboo now (as it should be).
Salt water crocs restricted to 30 degrees from equator.
Penguins restricted to southern hemisphere.
Polar bear restricted to northern hemisphere near the poles.

I must be using an old schema because I could not find the latitude restrictions. I was about to release river crocs and snakes.

AIAndy
Sep 21, 2011, 04:31 PM
I just added that feature and pushed it to the SVN before that post (only the Afforess schema in the main xml folder is changed, so copy to modules when needed).
Looks like this:
<bLatitudeAbs>1</bLatitudeAbs>
<iMinLatitude>0</iMinLatitude>
<iMaxLatitude>30</iMaxLatitude>
The first one governs if the the absolute value of the latitude should be used (0 - 90) or not (-90 - 90).

Hydromancerx
Sep 21, 2011, 04:32 PM
Penguins restricted to southern hemisphere.
Polar bear restricted to northern hemisphere near the poles.

That's awesome! Good job for realism!

strategyonly
Sep 21, 2011, 06:09 PM
I just added that feature and pushed it to the SVN before that post (only the Afforess schema in the main xml folder is changed, so copy to modules when needed).
Looks like this:
<bLatitudeAbs>1</bLatitudeAbs>
<iMinLatitude>0</iMinLatitude>
<iMaxLatitude>30</iMaxLatitude>
The first one governs if the the absolute value of the latitude should be used (0 - 90) or not (-90 - 90).


Yeah, i was just looking at FfH2 and they have that also.

colonelflag
Sep 21, 2011, 09:08 PM
Animal spawn rates seem VERY low to me. In 50 turns in quite a large area I saw noen at all. I ran debug to see what was happening and it was averaging about 1 animal per turn WORLDWIDE.
@Koshling.

I too am experiencing VERY LOW animal spawn rates on a Giant sized map.(V17). I have played over 500 turns and have never seen a Neanderthal unit either.

Dancing Hoskuld
Sep 22, 2011, 12:16 AM
Animal spawn rates seem VERY low to me. In 50 turns in quite a large area I saw noen at all. I ran debug to see what was happening and it was averaging about 1 animal per turn WORLDWIDE.

I find that at higher rates of animal spawn you don't get any barbarian units or cities. There is still some room between what it is now and the higher rates I tried.

EldrinFal
Sep 22, 2011, 01:40 AM
Started a new game with Planet Generator on Marathon, Raging Barbs. Started getting attacked quite early and it has turned into a steady stream of Neanderthals as they spawn over and over and then head to my city.

After checking the world map, I found 2-3 areas with loads of Neanderthals, and the rest pretty much none. (pic attached) I think it's really a matter of them spawning from the bonus placements and where there are no Bison, Deer, or Ivory, there are no Neanderthals. I think spawning them from terrain and feature combinations will spread them out a bit more. Same goes for animals. Tried to use AIAndy's tags for those, but don't think they are setup to use with Neanderthals yet.

On a related note, I had a lot of turns to test the -75% City Attack and it seemed to work pretty well. I had 2 Slingers and 2 Clubmen (and the Cave Dwelling NW) and they were able to hold the city, although they were taking damage. Some of the other AIs were wiped out already-- the ones in those Neanderthal infested areas, but I saw ONE civ that had the Cave Dwelling, so I'm hopeful he'll survive.

AIAndy
Sep 22, 2011, 02:00 AM
@EldrinFal: You have to copy the new scheme to the Neanderthal folder to use those tags (Afforess_CIV4UnitSchema.xml in the main Assets/XML/Units folder). Also rename it so it replaces the schema in the respective subfolder.

EldrinFal
Sep 22, 2011, 08:45 AM
@EldrinFal: You have to copy the new scheme to the Neanderthal folder to use those tags (Afforess_CIV4UnitSchema.xml in the main Assets/XML/Units folder). Also rename it so it replaces the schema in the respective subfolder.

Thanks. I'll test that out when I get home today. :)

AIAndy, were you going to integrate the previous mentioned idea for reducing spawn chance based on world population of that unit? (To help improve variety of animal units)

AIAndy
Sep 22, 2011, 10:08 AM
Thanks. I'll test that out when I get home today. :)

AIAndy, were you going to integrate the previous mentioned idea for reducing spawn chance based on world population of that unit? (To help improve variety of animal units)
I will introduce some such method but I don't know yet when (probably I will go with one initial analysis of spawn spots though).
At first reducing the spawn chance based on the local density might be enough.

Koshling
Sep 22, 2011, 10:08 AM
Thanks. I'll test that out when I get home today. :)

AIAndy, were you going to integrate the previous mentioned idea for reducing spawn chance based on world population of that unit? (To help improve variety of animal units)

It won't impact variety at all, since one type spawning has utterly zero impact on the probability of another type spawning - EVERY spawen is applied (completely independently) every turn. All it would do is reduce population of the over-spawning type a bit (without any compensatory increase in any other type)

EldrinFal
Sep 22, 2011, 10:56 AM
It won't impact variety at all, since one type spawning has utterly zero impact on the probability of another type spawning - EVERY spawen is applied (completely independently) every turn. All it would do is reduce population of the over-spawning type a bit (without any compensatory increase in any other type)

That's what happens when I reply early in the morning. Brain isn't fully awake :coffee:

I still had it in my mind that the spawn was a single queue of sorts where if one animal spawned, it wouldn't spawn another (that turn in that tile).

Let's see how terrain/feature based spawn spreads them and if it makes the distribution more even, then that should take care of it (which it should in theory). If not, then we'll have to look at spawn density in general to help distribute.

I will do the schema for the Neanderthals later today and have them spawn from several variations to see how that works. It should be a good test case for the process as a whole.

Koshling
Sep 22, 2011, 11:49 AM
That's what happens when I reply early in the morning. Brain isn't fully awake :coffee:

I still had it in my mind that the spawn was a single queue of sorts where if one animal spawned, it wouldn't spawn another (that turn in that tile).

Let's see how terrain/feature based spawn spreads them and if it makes the distribution more even, then that should take care of it (which it should in theory). If not, then we'll have to look at spawn density in general to help distribute.

I will do the schema for the Neanderthals later today and have them spawn from several variations to see how that works. It should be a good test case for the process as a whole.

Ok. Bear in mind the relative frequency of the terrains you use though as compared to the resources it uses now. A forest spawn for example will need a MUCH lower spawn rate because there are many moer forest tiles.

EldrinFal
Sep 22, 2011, 12:30 PM
Ok. Bear in mind the relative frequency of the terrains you use though as compared to the resources it uses now. A forest spawn for example will need a MUCH lower spawn rate because there are many moer forest tiles.

Yeah, I was going to bring the rate to 24. If Raging doubles that, then I expect 12 as the effective rate. We'll see how that works with Forest, which I suspect has the widest range of growth.

Koshling
Sep 22, 2011, 12:46 PM
Yeah, I was going to bring the rate to 24. If Raging doubles that, then I expect 12 as the effective rate. We'll see how that works with Forest, which I suspect has the widest range of growth.

Rate, not density. The existing rates are 15, 15, and 10 for the 3 waves. That means (taking the first wave as illustration), each suitable bonus tile will spawn a Neanderthal every 15 turns. Since forest is about 10 times more prevalent than the bonuses (guess) you'll need somewhere closer to 150 I think.

AIAndy
Sep 22, 2011, 12:55 PM
Ok. Bear in mind the relative frequency of the terrains you use though as compared to the resources it uses now. A forest spawn for example will need a MUCH lower spawn rate because there are many moer forest tiles.
That is one of the main things that need correction because in many cases that varies a lot.
So I guess the actual spawn rate should be a formula depending on these things:

Number of plots in the area the spawn plot belongs to
Number of spawn plots in the area
Number of units spawned in that area from this spawn rule
Number of units in the area belonging to the same SpawnGroup (meaning a new int tag for the unit xml)
Local density of the unit type
Local density of the units belonging to the same SpawnGroup

Koshling
Sep 22, 2011, 01:13 PM
That is one of the main things that need correction because in many cases that varies a lot.
So I guess the actual spawn rate should be a formula depending on these things:

Number of plots in the area the spawn plot belongs to
Number of spawn plots in the area
Number of units spawned in that area from this spawn rule
Number of units in the area belonging to the same SpawnGroup (meaning a new int tag for the unit xml)
Local density of the unit type
Local density of the units belonging to the same SpawnGroup


Depends what you want. If you want a flat distribution independent of the frequency of the terrains etc. then you just want an option that allows spawn from any plot really! Some spawns may deliberately be connected with the frequency of certain bonuses and so on (horses from horse for example), and deliberately be rare when those bonuses are.

Neanderthals are a bit odd, since the choice of bonuses to spawn them is a little arbitrary. A value that says 'give me a flat spawn rate' while STILL forcing the spawns to occur on bonuses might be good, since flat rate is probably what we want (more or less) for Neanderthals, BUT having them spawn from a few fixed points adds flavor and also strategy (since keeping those spots under observation will prevent the spawns - which you lose by going to terain-based, or pure flat).

So actually what you ideally want is to restrict the spawn points to bonuses [or some other restricted small set of plots] (and have map generators assure that at least one is present on each substantial land mass), yet still have the landmass-wide rate directly proportional to the size of the landmass (or some other area-based normalization). The problem is that while you can define such a flag easily, implementing it without starting to chew up significant CPU time on spawns for large maps) is harder.

I'm actually thinking we're better off spending our effort elsewhere and tweaking the binus distrubution in a map-post-script.

strategyonly
Sep 22, 2011, 01:27 PM
I'm actually thinking we're better off spending our effort elsewhere and tweaking the bonus distribution in a map-post-script.

I agree completely.

AIAndy
Sep 22, 2011, 01:45 PM
I'll go the fast way.
Allow scaling with area size (that one is cheap).
While going through all plots for all spawn rules (that is done already), enumerate all valid spawn locations for each rule first.
Then go through the areas and spawn for each.
That is not really more expensive and rather easy to program.

So the formula can take into account area size, spawn plot num in area and local density.

Dancing Hoskuld
Sep 22, 2011, 01:48 PM
With spawning, I tried to specify river crocodiles spawning only on flood plains in the tropics and seem to have gotten spawn on flood plains and in the tropics. Is that so or am I imagining those crocs in the deserts?

EldrinFal
Sep 22, 2011, 01:58 PM
Right now Neanderthals spawn from Bison, Ivory, and Deer only. The issue I ran into was that those resources are not always distributed evenly. So some players will get SWARMED,while others get completely left alone. I figured spawning them from forest, (combined with a low density setting) which is found all over the map, would encourage a more even distribution.

One bad thing about a certain animal spawning from only a specific resource is that it means not only does the nearby player have access to that bonus, but they have access to the animal spawning from it.

Modifying the map scripts could work to even out bonus placement, but I figured since the spawn from terrain was already present, that could provide more varied spawn sites.

Dancing Hoskuld
Sep 22, 2011, 02:03 PM
One bad thing about a certain animal spawning from only a specific resource is that it means not only does the nearby player have access to that bonus, but they have access to the animal spawning from it.

Actually, that is the point. If there are no pig resources on you continent then there will be no pigs spawned. Therefore you will have to trade for them later in the game.

Almost every thing that gets done has the effect of destroying the trade system making it irrelevant. I decided it was about time to do something that helped it instead.

AIAndy
Sep 22, 2011, 02:13 PM
With spawning, I tried to specify river crocodiles spawning only on flood plains in the tropics and seem to have gotten spawn on flood plains and in the tropics. Is that so or am I imagining those crocs in the deserts?
Can you post the xml code or is it already on the SVN?

Dancing Hoskuld
Sep 22, 2011, 02:16 PM
Can you post the xml code or is it already on the SVN?

In the SVN in the folder Modules/DancingHoskuld/Subdue_Animals_zExperimental/RiverCroc.

Koshling
Sep 22, 2011, 02:30 PM
Right now Neanderthals spawn from Bison, Ivory, and Deer only. The issue I ran into was that those resources are not always distributed evenly. So some players will get SWARMED,while others get completely left alone. I figured spawning them from forest, (combined with a low density setting) which is found all over the map, would encourage a more even distribution.

One bad thing about a certain animal spawning from only a specific resource is that it means not only does the nearby player have access to that bonus, but they have access to the animal spawning from it.

Modifying the map scripts could work to even out bonus placement, but I figured since the spawn from terrain was already present, that could provide more varied spawn sites.

Problem is that it removes the small number of spawn points, so you lose the strategic ability to garrison units near the spawns to keep them in check.

Hydromancerx
Sep 22, 2011, 02:31 PM
Right now Neanderthals spawn from Bison, Ivory, and Deer only.

I think Mammoth resource should be added to the list. I mean what is more prehistoric than having mammoths and neanderthals in the same place?

strategyonly
Sep 22, 2011, 02:33 PM
Actually, that is the point. If there are no pig resources on you continent then there will be no pigs spawned. Therefore you will have to trade for them later in the game.

Almost every thing that gets done has the effect of destroying the trade system making it irrelevant. I decided it was about time to do something that helped it instead.

Right now Neanderthals spawn from Bison, Ivory, and Deer only. The issue I ran into was that those resources are not always distributed evenly. So some players will get SWARMED,while others get completely left alone. I figured spawning them from forest, (combined with a low density setting) which is found all over the map, would encourage a more even distribution.

One bad thing about a certain animal spawning from only a specific resource is that it means not only does the nearby player have access to that bonus, but they have access to the animal spawning from it.

Modifying the map scripts could work to even out bonus placement, but I figured since the spawn from terrain was already present, that could provide more varied spawn sites.

I agree with DH, he seems to know what he is talking about, and good at it.:hatsoff:

AIAndy
Sep 22, 2011, 02:55 PM
In the SVN in the folder Modules/DancingHoskuld/Subdue_Animals_zExperimental/RiverCroc.
I increased the spawn rate massively to see where they spawn and they only spawned between 30 degrees north and 30 degrees south on flood plains. That seems correct. Mind though that 30 degrees is one third of the way to the poles from the equator which is not that small. For pure tropical reaches 23 degree or so as limit is more accurate.
Some maps also change min and max latitude which influences this spawning.

Using purely a feature without featureterrain was not supported. I changed that now so only specifying a feature and no featureterrain is valid on any plot with that feature. I will push it after some testing.
You have two entries with the name SPAWN_RIVERCROC_SMALL_NATIVE which might have weird effects.

EldrinFal
Sep 22, 2011, 03:00 PM
Problem is that it removes the small number of spawn points, so you lose the strategic ability to garrison units near the spawns to keep them in check.

If the spawn point is within LoS doesn't that stop spawning though?

EldrinFal
Sep 22, 2011, 03:02 PM
I think Mammoth resource should be added to the list. I mean what is more prehistoric than having mammoths and neanderthals in the same place?

Mammoths, Neanderthals, and Dinosaurs! :lol: :joke:

(Now I'm just teasing you :mischief:)

Koshling
Sep 22, 2011, 03:03 PM
If the spawn point is within LoS doesn't that stop spawning though?

Yes, but with a large number of (say) forest plots you're never going to meet that criteria. LoS (for most units) is just one tile unless they are on a hill.

EldrinFal
Sep 22, 2011, 03:07 PM
Actually, that is the point. If there are no pig resources on you continent then there will be no pigs spawned. Therefore you will have to trade for them later in the game.

Almost every thing that gets done has the effect of destroying the trade system making it irrelevant. I decided it was about time to do something that helped it instead.

The Great Farmer defeats trade more than spawns do. And wasn't the purpose of an animal unit turning into a bonus plot upon death to give that extra bonus opportunity? :confused:

If you want to keep trade relevant, maybe only have it so ONLY tile bonuses give normal resources, and subdued animal buildings provide Fake Goods only. You may not need the resource to produce units, but there is still the happiness or health bonus.

EldrinFal
Sep 22, 2011, 03:11 PM
Yes, but with a large number of (say) forest plots you're never going to meet that criteria. LoS (for most units) is just one tile unless they are on a hill.

Oh, you mean to PREVENT the unit from spawning?? I thought you were talking about farming the spawns. That's what I would do with an animal spawn.

For Neanderthals... I suppose. But that seems like a cheap way to defeat their purpose. At the least then they should be popping up from some kind of village/cave/settlement that can be destroyed.

Or... make a Slaver unit that can turn their spawn point into a Prison Camp or something :lol:

Dancing Hoskuld
Sep 22, 2011, 04:46 PM
Or... make a Slaver unit that can turn their spawn point into a Prison Camp or something :lol:

Got stuff somewhere for that. Not implemented in C2C until we can get change of civic exposed to Python. That way you only get slaves with slavery (or lower) and pions/hostages/prisoners of war at other times.

Koshling
Sep 22, 2011, 05:26 PM
Got stuff somewhere for that. Not implemented in C2C until we can get change of civic exposed to Python. That way you only get slaves with slavery (or lower) and pions/hostages/prisoners of war at other times.

I'll do it tomorrow hopefully

EldrinFal
Sep 22, 2011, 06:02 PM
I'll do it tomorrow hopefully

Got stuff somewhere for that. Not implemented in C2C until we can get change of civic exposed to Python. That way you only get slaves with slavery (or lower) and pions/hostages/prisoners of war at other times.

Cool. That will be useful for some ideas I had for FORCED Civics down the road; future-type eras mostly. As a preview, Machines/AI taking over if humanity can't manage it's cities. And Alien Occupation, if we end up going the invasion route.

EldrinFal
Sep 22, 2011, 10:45 PM
@EldrinFal: You have to copy the new scheme to the Neanderthal folder to use those tags (Afforess_CIV4UnitSchema.xml in the main Assets/XML/Units folder). Also rename it so it replaces the schema in the respective subfolder.

Got that to work, thanks! :goodjob:

Ok. Bear in mind the relative frequency of the terrains you use though as compared to the resources it uses now. A forest spawn for example will need a MUCH lower spawn rate because there are many moer forest tiles.

I've been testing the Neanderthal spawn on Forest. The overall spread is VERY diverse. I get Neanderthals more evenly placed across the entire map now. However, the NUMBER of them is still too much. Is there a tag to limit the number on the map? I didn't see it among the tags already there. That or the radius to check has to go beyond 3.

I also saw in two instances a spawn in an area visible to me. One was a Cave Lion and the other a Neanderthal. They spawned literally adjacent to my Wanderer. It was my understanding that spawns shouldn't appear on visible land, am I wrong?

Dancing Hoskuld
Sep 22, 2011, 11:36 PM
Got that to work, thanks! :goodjob:

I've been testing the Neanderthal spawn on Forest. The overall spread is VERY diverse. I get Neanderthals more evenly placed across the entire map now. However, the NUMBER of them is still too much. Is there a tag to limit the number on the map? I didn't see it among the tags already there. That or the radius to check has to go beyond 3.

<iTurns> is used to raise and lower the spawn rate. the higher the number the lower the rate.

I also saw in two instances a spawn in an area visible to me. One was a Cave Lion and the other a Neanderthal. They spawned literally adjacent to my Wanderer. It was my understanding that spawns shouldn't appear on visible land, am I wrong?

That depends on the tag <bNotInView> which I have not set for any of the animals yet.

EldrinFal
Sep 22, 2011, 11:43 PM
<iTurns> is used to raise and lower the spawn rate. the higher the number the lower the rate.

I have it at the default of 15. What is the specific logic so I can figure out a good number to mess with?


That depends on the tag <bNotInView> which I have not set for any of the animals yet.

I see.

AIAndy
Sep 23, 2011, 12:51 AM
I have it at the default of 15. What is the specific logic so I can figure out a good number to mess with?
iTurns is currently the average number of turns to spawn one on every valid spawn plot.
So if you have set it to 15 and valid spawn plot as desert without features then every single desert without features will spawn a unit every 15 turns on average.
With 30 deserts like that on the map 2 would spawn every turn on average.

strategyonly
Sep 23, 2011, 06:48 AM
iTurns is currently the average number of turns to spawn one on every valid spawn plot.
So if you have set it to 15 and valid spawn plot as desert without features then every single desert without features will spawn a unit every 15 turns on average.
With 30 deserts like that on the map 2 would spawn every turn on average.

HUH, thats quite nifty to know, and nice work btw;)

EldrinFal
Sep 23, 2011, 09:35 AM
iTurns is currently the average number of turns to spawn one on every valid spawn plot.
So if you have set it to 15 and valid spawn plot as desert without features then every single desert without features will spawn a unit every 15 turns on average.
With 30 deserts like that on the map 2 would spawn every turn on average.

You guys really like using complex variables :confused:

What about just a straight number of maximum spawns allowed per turn? That way regardless of number of tiles that fit the spawn point value, the number is capped per turn.

Koshling
Sep 23, 2011, 10:41 AM
You guys really like using complex variables :confused:

What about just a straight number of maximum spawns allowed per turn? That way regardless of number of tiles that fit the spawn point value, the number is capped per turn.

That would be way harder to normalize - you'd have to use a 2-pass process (or store significantly more state) to ensure a randomized distribution even when the cap on number-per-turn is being hit. It also would need normalization for total land area/sea area not just map size, which the current system doesn't.

EldrinFal
Sep 23, 2011, 11:34 AM
That would be way harder to normalize - you'd have to use a 2-pass process (or store significantly more state) to ensure a randomized distribution even when the cap on number-per-turn is being hit. It also would need normalization for total land area/sea area not just map size, which the current system doesn't.

The cap would be in addition to the density and feature/terrain setting.

Koshling
Sep 23, 2011, 11:43 AM
The cap would be in addition to the density and feature/terrain setting.

Right, but how would you apply it? If you just stop spawning in a given turn after <cap> is reached then only the plots considred first will get spawn chances, which just means all spawns will bunch up in whatever subset of plots is processed first. That's why you need 2 passes (or a non-geographically localized enumeration order possibly), so that you can evaluate the want-to-spawns in the first pass then actually spawn a culled set (by striping say) that is not biased to any particular enumeration order. It just makes it more complex (and slower) is all - the original system is simple and intended to be very efficiently implementable since it's an overhead on every turn.

AIAndy
Sep 23, 2011, 11:48 AM
Lets get in a bit of a systematic approach (and I will not implement further stuff in the spawn system until we have reached a consensus).

There are two parts to the spawn system:
One defines where each spawn rule might spawn something.
The other defines when it should spawn.

Currently for each plot from part one an independent check for part two is done.

There would also be the possibility to go top down. First evaluate chances to see what you want to spawn, then find a spawning plot.
Having both variants with each spawn rule selecting one is a possibility as well.
The chance calculation has many possibilities how it can be done as well (and currently it is entirely flat for each possible spawn plot).

So what would you actually want?

EldrinFal
Sep 23, 2011, 12:07 PM
Right, but how would you apply it? If you just stop spawning in a given turn after <cap> is reached then only the plots considred first will get spawn chances, which just means all spawns will bunch up in whatever subset of plots is processed first. That's why you need 2 passes (or a non-geographically localized enumeration order possibly), so that you can evaluate the want-to-spawns in the first pass then actually spawn a culled set (by striping say) that is not biased to any particular enumeration order. It just makes it more complex (and slower) is all - the original system is simple and intended to be very efficiently implementable since it's an overhead on every turn.

I understand, however, it doesn't distribute evenly as is. On the several new games I started, when Neanderthals spawn from bonuses, they end up grouped in specific areas of the map only. So some Civs have to contend with them and the rest not at all.


Lets get in a bit of a systematic approach (and I will not implement further stuff in the spawn system until we have reached a consensus).

There are two parts to the spawn system:
One defines where each spawn rule might spawn something.
The other defines when it should spawn.

Currently for each plot from part one an independent check for part two is done.

There would also be the possibility to go top down. First evaluate chances to see what you want to spawn, then find a spawning plot.
Having both variants with each spawn rule selecting one is a possibility as well.
The chance calculation has many possibilities how it can be done as well (and currently it is entirely flat for each possible spawn plot).

So what would you actually want?

My goal is to create a more even distribution of Neanderthal spawns. We can leave animals out for now because there are different issues to consider. As I mentioned in my reply to Koshling, when the Neanderthals come out of bonuses, you always (in each game I started on Huge with a large land mass) get a case of Neanderthals being in certain areas of the map only.

With the new Terrain/Feature capability, I tested them spawning simply from "Forest." The distribution was great, but the total number was too much. Even when I set the current density value to 48. Granted, I was testing the extreme case, and I used a Wet map with Raging Barbarians. But if I can get that to feel right, the normal settings will fall in line.

From my understanding of the spawning, it sounds like the system starts from say the 0,0 coordinate and then works along the X or Y axis going through each tile systemically. With a limit, that is why it would create them on just one portion of the map, yes?

So it sounds like what we need is either more than one point of origination for checking (i.e. handle 4 quadrants at the same time) or generate a list of all tiles with forest and then randomly choose X number of those plots based on the number of spawns in the turn.

Koshling
Sep 23, 2011, 12:22 PM
I understand, however, it doesn't distribute evenly as is. On the several new games I started, when Neanderthals spawn from bonuses, they end up grouped in specific areas of the map only. So some Civs have to contend with them and the rest not at all.




My goal is to create a more even distribution of Neanderthal spawns. We can leave animals out for now because there are different issues to consider. As I mentioned in my reply to Koshling, when the Neanderthals come out of bonuses, you always (in each game I started on Huge with a large land mass) get a case of Neanderthals being in certain areas of the map only.

With the new Terrain/Feature capability, I tested them spawning simply from "Forest." The distribution was great, but the total number was too much. Even when I set the current density value to 48. Granted, I was testing the extreme case, and I used a Wet map with Raging Barbarians. But if I can get that to feel right, the normal settings will fall in line.

From my understanding of the spawning, it sounds like the system starts from say the 0,0 coordinate and then works along the X or Y axis going through each tile systemically. With a limit, that is why it would create them on just one portion of the map, yes?

So it sounds like what we need is either more than one point of origination for checking (i.e. handle 4 quadrants at the same time) or generate a list of all tiles with forest and then randomly choose X number of those plots based on the number of spawns in the turn.

If the distribution is fine (with spawn from forest), but you're just getting too many why can't you just increase the iTurns values to lower the rate with the existing system?

EldrinFal
Sep 23, 2011, 12:45 PM
If the distribution is fine (with spawn from forest), but you're just getting too many why can't you just increase the iTurns values to lower the rate with the existing system?

I plan to test that out tonight. I didn't know what it specifically meant until I read the forum reply from AIAndy this morning. I just wondered why a more intuitive value couldn't be used.

I was a programming hobbyist when I was younger (Basic & Pascal) and then studied for a year at the university. But the uni I went to used Ada :p and that turned me off to it. So I tend to think in those terms for the logic of these sorts of issues, but likely my thinking is a bit outdated compared to Python and C++.

Dancing Hoskuld
Sep 23, 2011, 02:07 PM
I plan to test that out tonight. I didn't know what it specifically meant until I read the forum reply from AIAndy this morning. I just wondered why a more intuitive value couldn't be used.

I was a programming hobbyist when I was younger (Basic & Pascal) and then studied for a year at the university. But the uni I went to used Ada :p and that turned me off to it. So I tend to think in those terms for the logic of these sorts of issues, but likely my thinking is a bit outdated compared to Python and C++.

Programming is still programming, it is just the way you turn the mathematics into code. Programmers don't always make the right choice when exposing stuff to the people who are going to use it. The example in this case is using the name iTurns which is correct for the maths as is having decreasing numbers increase the chance. However it is not intuitive to those not familiar with the math. I have not thought of a better name.

Hydromancerx
Sep 23, 2011, 04:48 PM
What if you linked the Neanderthals to the land formations. We have polar, desert and rocky ones they should in theory spread the Neanderthals across the globe in each zone but not be nearly as numerous as linking them to forests. Since the land formations spawn much less.

EldrinFal
Sep 23, 2011, 04:56 PM
Programming is still programming, it is just the way you turn the mathematics into code. Programmers don't always make the right choice when exposing stuff to the people who are going to use it. The example in this case is using the name iTurns which is correct for the maths as is having decreasing numbers increase the chance. However it is not intuitive to those not familiar with the math. I have not thought of a better name.

Naming of the tag is part of it, lack of Annotation / Inclusive Documentation within the XML file, is the other. If there were definitions of the tags included I could have figured it out on my own. Might be worthwhile to include that so anyone modifying the XML will know what those are all for.


What if you linked the Neanderthals to the land formations. We have polar, desert and rocky ones they should in theory spread the Neanderthals across the globe in each zone but not be nearly as numerous as linking them to forests. Since the land formations spawn much less.

I'll give that a try, Hydro. What is the nomenclature for the land formation feature? Is there is a list somewhere?

Hydromancerx
Sep 23, 2011, 06:08 PM
I'll give that a try, Hydro. What is the nomenclature for the land formation feature? Is there is a list somewhere?

Location: Assets/Modules/Resources/NewTerrainFeatures/Landforms

Arid Landforms (Generates in Scrub, Desert and Dunes)
FEATURE_ROCK_FORM1 (1 to 4)
FEATURE_ROCK_ARCH1 (1 to 2)

Rocky Landforms (Generates in Rocky and Barren)
FEATURE_DARK_ROCK_FORM1 (1 to 4)
FEATURE_DARK_ROCK_ARCH1 (1 to 2)

Polar Landforms (Generates in Tundra, Permafrost and Ice)
FEATURE_POLAR_ROCK_FORM1 (1 to 4)
FEATURE_POLAR_ROCK_ARCH1 (1 to 2)

Not sure if you want to use the FORM or the ARCH or both. Just know there are 18 individual ones and 6 of the 3 types.

Dancing Hoskuld
Sep 23, 2011, 07:45 PM
Naming of the tag is part of it, lack of Annotation / Inclusive Documentation within the XML file, is the other. If there were definitions of the tags included I could have figured it out on my own. Might be worthwhile to include that so anyone modifying the XML will know what those are all for.

Doco here (http://forums.civfanatics.com/showpost.php?p=10794060&postcount=190)

strategyonly
Sep 23, 2011, 07:47 PM
Would this work, if i just put in a NEW file and have this? Or what else do i have to do to get it to work, and how?

<CivilizationInfo>
<Type>CIVILIZATION_HUN</Type>
<Leader>LEADER_HUN_HORDE</Leader>
<SpawnTech>TECH_CONSTRUCTION</SpawnTech>
<NumberOfSpawnTech>2</NumberOfSpawnTech>
<SpawnChance>75</SpawnChance>
<IsBarbarianCiv>True</IsBarbarianCiv>
<StartAtCoast>False</StartAtCoast>
<TotalGold>25</TotalGold>
<TechPercent>40</TechPercent>
<DefaultShips>NONE</DefaultShips>
<NumberShipsPerCity>0</NumberShipsPerCity>
<NumberOfCities>1</NumberOfCities>
<StartX>-1</StartX>
<StartY>-1</StartY>
<NumWorkerPerCity>1</NumWorkerPerCity>
<CapitalCityUnit>UNIT_ATTILA</CapitalCityUnit>
<NumCapitalUnit>1</NumCapitalUnit>
<DefaultCityDefender>UNIT_HORSE_ARCHER</DefaultCityDefender>
<NumberCityDefendersPerCity>3</NumberCityDefendersPerCity>
<DefaultSecondUnit>UNIT_HORSEMAN<DefaultSecondUnit>
<NumberSecondUnit>3</NumberSecondUnit>
</CivilizationInfo>

Would this work?

##SpawnCivUtil
###MODDER READ THIS:
###You do not have to change anything in this file (only if you changed default terrain)
###all changes have to be done in the CvEventManager.
###This file has to be in the same folder like the CvEventManager.py.

from CvPythonExtensions import *
import sys
import pickle
gc = CyGlobalContext()
SpawnCivList = []

def TriggerCiv(iPlayer,iTechType,DataPlotX,DataPlotY):
PopList = []
for i in xrange(len(SpawnCivList)):
Spawned = SpawnACiv(SpawnCivList[i],i,iPlayer,iTechType)
if Spawned:
PopList.append(SpawnCivList[i])
iMaxLoadCiv = len(SpawnCivList)
bListSpawnedCiv = []
for j in range(iMaxLoadCiv):
bListSpawnedCiv.append(SpawnCivList[j].AlreadyTriggered)
DataPlot = CyMap().plot(DataPlotX,DataPlotY)
DataPlot.setScriptData(pickle.dumps(bListSpawnedCi v))

###obsolete
#for i in xrange(len(PopList),0,1):
#SpawnCivList.pop(PopList[i])


def SpawnACiv(SpawnCiv,ListNum,iPlayer,iTechType):
###Test if right tech###
Tech = SpawnCiv.SpawnTech
if not iTechType ==gc.getInfoTypeForString(Tech):
return
if SpawnCiv.AlreadyTriggered:
return
###test, if right number of civs have tech
TechCounter=0
for i in xrange (gc.getMAX_CIV_TEAMS ()):
Team = gc.getTeam(i)
if Team.isHasTech(iTechType):
TechCounter=TechCounter+1
if TechCounter>=SpawnCiv.SpawnTechNumber:
break

if not TechCounter>=SpawnCiv.SpawnTechNumber:
return
SpawningChance = CyGame().getSorenRandNum(100, "HowGoodIsTheChance")
if SpawningChance>SpawnCiv.SpawnChance:
SpawnCiv.AlreadyTriggered = True
return
###test, if spawn civ is not already alive
for i in xrange (gc.getMAX_CIV_PLAYERS ()):
pPlayer = gc.getPlayer(i)
myName = pPlayer.getCivilizationType ()
otherName = gc.getInfoTypeForString(SpawnCiv.CivString)
if myName ==otherName:
return
###Find a ID for the civ###
NewID = -1
for NumCiv in xrange (gc.getMAX_PLAYERS ()):
PotPlayer = gc.getPlayer(NumCiv)
if not PotPlayer.isAlive():
NewID = NumCiv
break
if NewID ==-1:
return
###Add Civ to game
iCiv = gc.getInfoTypeForString(SpawnCiv.CivString)
if not str(SpawnCiv.LeaderString)=="-1":
NewLeaderID=gc.getInfoTypeForString(SpawnCiv.Leade rString)
if str(SpawnCiv.LeaderString)=="-1":

CurCiv = gc.getCivilizationInfo(iCiv)
NumLeaders = CurCiv.getNumLeaders ()
dice = gc.getGame().getMapRand()
LeaderNum = dice.get(NumLeaders , "OracleSayMeTheLeader" )
LeaderCounter=0
for iLeaders in range(gc.getNumLeaderHeadInfos ()):
if CurCiv.isLeaders(iLeaders):
if NumLeaders==1:
NewLeaderID =iLeaders
break
else:
if LeaderCounter==LeaderNum:
NewLeaderID=iLeaders
break
LeaderCounter=LeaderCounter+1
CyGame().addPlayer(NewID,NewLeaderID,iCiv)
NewPlayer = gc.getPlayer(NewID)
NewTeam = gc.getTeam(NewPlayer.getTeam())
NewTeamID = NewTeam.getID()

###from an old version, may be reactived later, you never
###now; declareWar is custom function in this file, not used
###at the moment
### function testIfBarb is current version
#declareWar(NewID,SpawnCiv)
#if SpawnCiv.bBarb==True:
#MaxCivs = gc.getMAX_CIV_TEAMS()
#for i in xrange (MaxCivs):
#if i==NewTeamID:continue
#NewTeam.setPermanentWarPeace(i,True)
maxX = CyMap().getGridWidth ()
maxY = CyMap().getGridHeight ()
iTundra = gc.getInfoTypeForString("TERRAIN_TUNDRA")
iDesert = gc.getInfoTypeForString("TERRAIN_DESERT")
iSnow = gc.getInfoTypeForString("TERRAIN_SNOW")
NumSetCities = 0
Counter=0
NewPlayer.setGold(SpawnCiv.Gold)
if SpawnCiv.SpawnX>-1 and SpawnCiv.SpawnY>-1:
if SpawnCiv.SpawnX<CyMap().getGridWidth () and SpawnCiv.SpawnY<CyMap().getGridHeight ():
pPlot = CyMap().plot(SpawnCiv.SpawnX,SpawnCiv.SpawnY)
if not pPlot.isCity():
numUnits = pPlot.getNumUnits ()
for iUnits in xrange(numUnits):
pUnit = pPlot.getUnit(iUnits)
UnitX = pUnit.getX()
UnitY = pUnit.getY()
NewPlot = CyMap().plot(UnitX+1,UnitY+1)
if not NewPlot.isNone() and not NewPlot.isCity():
pUnit.setXY(UnitX+1,UnitY+1,True,True,True)
elif not CyMap().plot(UnitX-1,UnitY-1).isNone() and not CyMap().plot(UnitX-1,UnitY-1).isCity():
pUnit.setXY(UnitX-1,UnitY-1,True,True,True)
elif not CyMap().plot(UnitX+1,UnitY-1).isNone() and not CyMap().plot(UnitX+1,UnitY-1).isCity():
pUnit.setXY(UnitX+1,UnitY-1,True,True,True)
elif not CyMap().plot(UnitX-1,UnitY+1).isNone() and not CyMap().plot(UnitX-1,UnitY+1).isCity():
pUnit.setXY(UnitX-1,UnitY+1,True,True,True)

NewPlayer.initCity(SpawnCiv.SpawnX,SpawnCiv.SpawnY )
NumSetCities = NumSetCities+1
AddTechToPlayer(iPlayer,NewID,SpawnCiv.TechPercent )
AddUnitsToCity(SpawnCiv.SpawnX,SpawnCiv.SpawnY,New ID,SpawnCiv)

while NumSetCities <SpawnCiv.NumCities:
EndangeredPlot = []
CrapPlot = []
SetCity = False
Counter=Counter+1
Endangered = False
if Counter>100:return
if Counter>SpawnCiv.NumCities:return
for iX in xrange (maxX):
for iY in xrange(maxY):
pPlot = CyMap().plot(iX,iY)
if pPlot.isWater() or pPlot.isImpassable():
continue
if pPlot.isOwned():
continue
if pPlot.isUnit():
continue
if SpawnCiv.bCoast:
if not pPlot.isCoastalLand ():
continue
if (pPlot.getTerrainType ()==iDesert) or(pPlot.getTerrainType()==iSnow)or(pPlot.getTerra inType()==iTundra):
CrapPlot.append([pPlot.getX(),pPlot.getY()])
continue
if pPlot.isAdjacentOwned ():
continue

IsCity = checkCity(iX,iY)
if IsCity:continue
for iXLoop in xrange(iX - 2, iX + 3, 1):
for iYLoop in xrange(iY - 2, iY + 3, 1):
TempPlot = CyMap().plot(iXLoop,iYLoop)
if TempPlot.isOwned() or TempPlot.isUnit():
EndangeredPlot.append([pPlot.getX(),pPlot.getY()])
Endangered = True
break
if (Endangered == False):
NewPlayer.initCity(iX,iY)
NumSetCities = NumSetCities+1
SetCity = True
AddTechToPlayer(iPlayer,NewID,SpawnCiv.TechPercent )
AddUnitsToCity(iX,iY,NewID,SpawnCiv)
break

if SetCity ==False:
if len(EndangeredPlot)>0:
iRandPlot = CyGame().getSorenRandNum(len(EndangeredPlot), 'EndangeredPlot')
RandPlot = EndangeredPlot[iRandPlot]
CityX=RandPlot[0]
CityY=RandPlot[1]
NewPlayer.initCity(CityX,CityY)
NumSetCities = NumSetCities+1
AddTechToPlayer(iPlayer,NewID,SpawnCiv.TechPercent )
AddUnitsToCity(CityX,CityY,NewID,SpawnCiv)
elif len(CrapPlot)>0:
iRandPlot = CyGame().getSorenRandNum(len(CrapPlot), 'Crap Plot')
RandPlot = EndangeredPlot[iRandPlot]
CityX=RandPlot[0]
CityY=RandPlot[1]
NewPlayer.initCity(CityX,CityY)
NumSetCities = NumSetCities+1
AddTechToPlayer(iPlayer,NewID,SpawnCiv.TechPercent )
AddUnitsToCity(CityX,CityY,NewID,SpawnCiv)
if SetCity == True:
AddUnitsToCapital(NewID,SpawnCiv)
SpawnCiv.AlreadyTriggered = True
return True

###function should be obsolete
###not used at the moment
### function testIfBarb is current version
def declareWar(iPlayer,SpawnCiv):
if SpawnCiv.bBarb==True:
NewPlayer = gc.getPlayer(iPlayer)
TeamID = NewPlayer.getTeam()
NewTeam = gc.getTeam(TeamID)
for i in xrange(gc.getMAX_CIV_TEAMS ()):
if i==TeamID:continue
NewTeam.declareWar(i,False,WarPlanTypes.WARPLAN_TO TAL)
CurTeam = gc.getTeam(i)
CurTeam.declareWar(TeamID,False,WarPlanTypes.WARPL AN_TOTAL)
for i in range(gc.getMAX_CIV_PLAYERS()):
if i==iPlayer:continue
NewPlayer.AI_setAttitudeExtra(i,-999)
CurPlayer = gc.getPlayer(i)
CurPlayer.AI_setAttitudeExtra(iPlayer,-999)



def AddTechToPlayer(iPlayer,iNewPlayer,TechPercent):
pPlayer = gc.getPlayer(iPlayer)
pTeam = gc.getTeam(pPlayer.getTeam())
NewPlayer = gc.getPlayer(iNewPlayer)
NewTeam = gc.getTeam(NewPlayer.getTeam())
TechPercent = float(TechPercent)/100
TotalTechCounter=0
GridWidth=0
for i in xrange(gc.getNumTechInfos ()):
if pTeam.isHasTech(i):
TotalTechCounter=TotalTechCounter+1
CurTech= gc.getTechInfo(i)
if CurTech.getGridX()>GridWidth:
GridWidth=CurTech.getGridX()
TotalTechCounter=int(TotalTechCounter*TechPercent)
TempTechCounter=0
#CyInterface().addMessage(0,False,15,CyTranslator( ).getText(str(TotalTechCounter),()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(44), 1, 1, True,True)
for j in xrange(GridWidth):
for i in xrange(gc.getNumTechInfos ()):
CurTech= gc.getTechInfo(i)
if pTeam.isHasTech(i):
if CurTech.getGridX()==j:
NewTeam.setHasTech(i,True,iNewPlayer,False,False)
TempTechCounter=TempTechCounter+1
if TempTechCounter>=TotalTechCounter:
break
if TempTechCounter>=TotalTechCounter:
break


def AddUnitsToCapital(iNewID,SpawnCiv):
pPlayer = gc.getPlayer(iNewID)
Capital = pPlayer.getCapitalCity()
iX = Capital.getX()
iY = Capital.getY()
if SpawnCiv.CapitalUnit !="NONE" and SpawnCiv.CapitalUnit !=-1:
if SpawnCiv.NumberCapitalUnit>0:
for i in xrange(SpawnCiv.NumberCapitalUnit):
pPlayer.initUnit( gc.getInfoTypeForString(SpawnCiv.CapitalUnit), iX,iY, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION )

def AddUnitsToCity(iX,iY,iNewPlayer,SpawnCiv):
NewPlayer = gc.getPlayer(iNewPlayer)
if SpawnCiv.NumWorker>0:
for i in xrange(SpawnCiv.NumWorker):
NewPlayer.initUnit( gc.getInfoTypeForString("UNIT_WORKER"), iX,iY, UnitAITypes.UNITAI_WORKER, DirectionTypes.NO_DIRECTION )
pCity = CyMap().plot(iX,iY).getPlotCity()
if SpawnCiv.DefenderUnit !="NONE":
if SpawnCiv.DefenderUnit=="-1":
Defender = pCity.getConscriptUnit ()
else:
Defender = gc.getInfoTypeForString(SpawnCiv.DefenderUnit)
if SpawnCiv.NumberDefenderUnit>0:
for i in xrange(SpawnCiv.NumberDefenderUnit):
NewPlayer.initUnit( Defender, iX,iY, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION )
if SpawnCiv.SecondUnit !="NONE":
if SpawnCiv.SecondUnit=="-1":
Second = pCity.getConscriptUnit ()
else:
Second = gc.getInfoTypeForString(SpawnCiv.SecondUnit)
if SpawnCiv.NumSecondUnit>0:
for i in xrange(SpawnCiv.NumSecondUnit):
NewPlayer.initUnit( Second, iX,iY, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION )
if pCity.isCoastal(20):
if ((not SpawnCiv.Ships=="-1")and(not SpawnCiv.Ships=="NONE")) and (not SpawnCiv.NumberShips<1):
ThisShip = SpawnCiv.Ships
CurShip = gc.getInfoTypeForString(ThisShip)
NumShip = SpawnCiv.NumberShips
for i in xrange(NumShip):
NewPlayer.initUnit( CurShip, iX,iY, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION )


def checkCity(iX,iY):
for iXLoop in xrange(iX - 2, iX + 3, 1):
for iYLoop in xrange(iY - 2, iY + 3, 1):
TempPlot = CyMap().plot(iXLoop,iYLoop)
if TempPlot.isCity():return True
return False

def ReadMyFile(MyFile,DataPlotX,DataPlotY):
del SpawnCivList[:]
for CurString in MyFile.readlines():
if "CIVILIZATION_" in CurString:
CurCiv = SpawningCiv()
CurCiv.CivString = CutString(CurString)
elif "Leader" in CurString:
CurCiv.LeaderString = CutString(CurString)
elif "TECH_" in CurString:
CurCiv.SpawnTech = CutString(CurString)
elif "NumberOfSpawnTech" in CurString:
CurCiv.SpawnTechNumber = int(CutString(CurString))
elif "SpawnChance" in CurString:
CurCiv.SpawnChance = float(CutString(CurString))
elif "IsBarbarianCiv" in CurString:
CuttedString = CutString(CurString)
CurCiv.bBarb = bool(eval(CuttedString))
elif "StartAtCoast" in CurString:
CuttedString = CutString(CurString)
CurCiv.bCoast = bool(eval(CuttedString))
elif "TotalGold" in CurString:
CurCiv.Gold = int(CutString(CurString))
elif "TechPercent" in CurString:
CurCiv.TechPercent =int(CutString(CurString))
elif "DefaultShips" in CurString:
CurCiv.Ships = CutString(CurString)
elif "NumberShipsPerCity" in CurString:
CurCiv.NumberShips = int(CutString(CurString))
elif "NumberOfCities" in CurString:
CurCiv.NumCities = int(CutString(CurString))
elif "StartX" in CurString:
CurCiv.SpawnX = int(CutString(CurString))
elif "StartY" in CurString:
CurCiv.SpawnY = int(CutString(CurString))
elif "NumWorkerPerCity" in CurString:
CurCiv.NumWorker = int(CutString(CurString))
elif "CapitalCityUnit" in CurString:
CurCiv.CapitalUnit = CutString(CurString)
elif "NumCapitalUnit" in CurString:
CurCiv.NumberCapitalUnit = int(CutString(CurString))
elif "DefaultCityDefender" in CurString:
CurCiv.DefenderUnit = CutString(CurString)
elif "NumberCityDefendersPerCity" in CurString:
CurCiv.NumberDefenderUnit = int(CutString(CurString))
elif "DefaultSecondUnit" in CurString:
CurCiv.SecondUnit = CutString(CurString)
elif "NumberSecondUnit" in CurString:
CurCiv.NumSecondUnit = int(CutString(CurString))
SpawnCivList.append(CurCiv)
AddCivAlreadySpawnedInfo(SpawnCivList,DataPlotX,Da taPlotY)

def AddCivAlreadySpawnedInfo(SpawnCivList,DataPlotX,Da taPlotY):
DataPlot = CyMap().plot(DataPlotX,DataPlotY)
bListSpawnedCiv = pickle.loads(DataPlot.getScriptData ())
iMaxLoadCiv = len(SpawnCivList)
if len(bListSpawnedCiv)>0:
for i in range (iMaxLoadCiv):
SpawnCivList[i].AlreadyTriggered = bListSpawnedCiv[i]

def TestIfBarb(iTeamX,iHasMetTeamY):
if iTeamX == iHasMetTeamY:
return False
TeamOne = gc.getTeam(iTeamX)
TeamTwo = gc.getTeam(iHasMetTeamY)
pPlayerOne = gc.getPlayer(TeamOne.getLeaderID())
pPlayerTwo = gc.getPlayer(TeamTwo.getLeaderID())
iLenSpawnCiv = len(SpawnCivList)
for i in range(iLenSpawnCiv):
if SpawnCivList[i].bBarb:
if (gc.getInfoTypeForString(SpawnCivList[i].CivString)== pPlayerOne.getCivilizationType () ):
TeamOne.declareWar(iHasMetTeamY,False,WarPlanTypes .WARPLAN_TOTAL)
TeamOne.setPermanentWarPeace(iHasMetTeamY,True)
elif (gc.getInfoTypeForString(SpawnCivList[i].CivString)== pPlayerTwo.getCivilizationType () ):
TeamTwo.declareWar(iTeamX,False,WarPlanTypes.WARPL AN_TOTAL)
TeamTwo.setPermanentWarPeace(iTeamX,True)

def CutString(string):
string = str(string)
string = string.strip()
string = string[2:-1]
BeginPos=-1
EndPos = -1
for i in xrange(len(string)):
if string[i]==">":
BeginPos=i
elif string[i]=="<":
EndPos=i
break
else:
return "-1"
NewString = string[BeginPos+1:EndPos]
return str(NewString)

class SpawningCiv:
def __init__(self):
self.CivString = 0
self.LeaderString = 0
self.SpawnTech = 0
self.SpawnTechNumber = 0
self.SpawnChance = 0
self.bCoast = 0
self.Ships = 0
self.NumberShips = 0
self.bBarb = 0
self.NumCities = 0
self.SpawnX = 0
self.SpawnY = 0
self.CapitalUnit = 0
self.NumberCapitalUnit = 0
self.DefenderUnit = 0
self.NumberDefenderUnit = 0
self.NumWorker=0
self.Gold = 0
self.SecondUnit=0
self.NumSecondUnit=0
self.TechPercent=0
self.AlreadyTriggered = False

EldrinFal
Sep 24, 2011, 11:58 AM
@Koshling

This value in the spawn file:

rateOverrideDefineName - name of a global define value which can be used to adjust the spawn rate - it is a percentage and can be any value from 0 upwards (set to 100 in what I have pushed). Higher numbers imply more spawns, with 100 being the pure XML-defined rate - I put this in to give players an easy way to adjust the overall setting

Currently has a setting as follows:

<rateOverrideDefineName>NEANDERTHAL_SPAWN_MODIFIER</rateOverrideDefineName>

Would I just erase NEANDERTHAL_SPAWN_MODIFIER and put in a percent value? Or is this a variable defined elsewhere?

Koshling
Sep 24, 2011, 12:09 PM
@Koshling

This value in the spawn file:



Currently has a setting as follows:



Would I just erase NEANDERTHAL_SPAWN_MODIFIER and put in a percent value? Or is this a variable defined elsewhere?

Don't use that to tune the mod. It's intended as an end-user override so people with different taste can tune everything up/down easily - it refers to a define in the global defines (its the name of the global define variable that contains the overriding value). The global defines are all in assets/xml/...GlobalDefines.xml

EldrinFal
Sep 24, 2011, 01:03 PM
Don't use that to tune the mod. It's intended as an end-user override so people with different taste can tune everything up/down easily - it refers to a define in the global defines (its the name of the global define variable that contains the overriding value). The global defines are all in assets/xml/...GlobalDefines.xml

Ah. Gotcha. Thanks. :)

EldrinFal
Sep 27, 2011, 10:03 AM
If the distribution is fine (with spawn from forest), but you're just getting too many why can't you just increase the iTurns values to lower the rate with the existing system?

Reporting back on this...

The Forest spawn in wave 1 was still too much with a fairly high iTurns setting. I've instead got it down to using some other Features, which are common, but not AS common as Forest. The two waves that follow change their spawning points to mix things up a bit.

In my test, 50% of the AI civs have survived 80% of the Neanderthal waves (on Raging), which is a whole lot better than it was before. However, expansion is at a complete halt since no one can leave their borders nor improve tiles around the capitals. :lol:

strategyonly
Sep 27, 2011, 12:56 PM
Reporting back on this...

The Forest spawn in wave 1 was still too much with a fairly high iTurns setting. I've instead got it down to using some other Features, which are common, but not AS common as Forest. The two waves that follow change their spawning points to mix things up a bit.

In my test, 50% of the AI civs have survived 80% of the Neanderthal waves (on Raging), which is a whole lot better than it was before. However, expansion is at a complete halt since no one can leave their borders nor improve tiles around the capitals. :lol:

YES< i just started a NEW game, with the CURRENT SVN, an this is happening, nobody is expanding, well hardly at all, i am at turn 500 and the largest civ has only 3 cities, something is terribly wrong here:sad::eek:

EldrinFal
Sep 27, 2011, 01:05 PM
YES< i just started a NEW game, with the CURRENT SVN, an this is happening, nobody is expanding, well hardly at all, i am at turn 500 and the largest civ has only 3 cities, something is terribly wrong here:sad::eek:

I haven't pushed any Neanderthal spawn changes to the SVN. With the settings in there, a few Civs may get attacked by Neanderthals, the rest will likely be left alone.

But it takes awhile to move beyond Slingers and Clubmen, which is necessary to start being aggressive against Neanderthals. I was approaching year 6000 or so BC and still didn't have Stone Axemen or Spearmen (Marathon game). I don't think even Raging Barbs is meant to equal 4000 years of turtling in the cities.

strategyonly
Sep 27, 2011, 01:08 PM
I haven't pushed any Neanderthal spawn changes to the SVN. With the settings in there, a few Civs may get attacked by Neanderthals, the rest will likely be left alone.

But it takes awhile to move beyond Slingers and Clubmen, which is necessary to start being aggressive against Neanderthals. I was approaching year 6000 or so BC and still didn't have Stone Axemen or Spearmen (Marathon game). I don't think even Raging Barbs is meant to equal 4000 years of turtling in the cities.

I think the ADDITION of the Neanderthals, PLUS the spawning of the NEW animals system is causing this, my map was completely FULL of barbarian(s) each and almost every tile:eek::eek::sad: While i LIKE this, most wont, cause, they will just go and raid thier enemies and poof game over before you hit Medieval Era.

Koshling
Sep 27, 2011, 01:10 PM
I think the ADDITION of the Neanderthals, PLUS the spawning of the NEW animals system is causing this, my map was completely FULL of barbarian(s) each and almost every tile:eek::eek::sad:

Regular barbarians are not spawned using the new system. Only Neanderthals and animals. If your map is full of (regular) barbs it must have some other cause (as far as I know no chnages have been made for regular barbs for many months)

strategyonly
Sep 27, 2011, 01:11 PM
Regular barbarians are not spawned using the new system. Only Neanderthals and animals. If your map is full of (regular) barbs it must have some other cause (as far as I know no changes have been made for regular barbs for many months)

Nope NOT regular barb, infact i dont see any of them, but maybe 10 and i am at turn 500. Bad use of words i guess, i was referring to Neanderthals and Animals, sorry.

EldrinFal
Sep 27, 2011, 01:15 PM
Nope NOT regular barb, infact i dont see any of them, but maybe 10 and i am at turn 500. Bad use of words i guess, i was referring to Neanderthals and Animals, sorry.

What game speed?

strategyonly
Sep 27, 2011, 01:35 PM
What game speed?

Just like yours Marathon, sorry, pills are having an effect on me from the pain, sorry.

EldrinFal
Sep 27, 2011, 01:44 PM
Just like yours Marathon, sorry, pills are having an effect on me from the pain, sorry.

No problem. :)

The iTurn setting is a bit faster on the XML in SVN right now compared to what I've been tweaking. You may happen to have a lot of bonuses that they are spawning from and with the "density" setting you may be spawning them every turn from those bonuses.

I'll push the spawn file I've tested later today. Even on Raging I don't get tile to tile Neanderthals.

strategyonly
Sep 27, 2011, 02:55 PM
No problem. :)

The iTurn setting is a bit faster on the XML in SVN right now compared to what I've been tweaking. You may happen to have a lot of bonuses that they are spawning from and with the "density" setting you may be spawning them every turn from those bonuses.

I'll push the spawn file I've tested later today. Even on Raging I don't get tile to tile Neanderthals.

OH, yeah thats correct, i forgot i have TONs and TONs of bonuses all over this map, its the way I made it, DUH!!.:blush:

Dancing Hoskuld
Sep 27, 2011, 03:27 PM
I have been working with the animal spawning numbers to ensure some barbarians do spawn in the old fashioned way. The last update is the one I think is about right but I did not check it for Neanderthals or Raging Barbarians. Earlier spawn rates gave more animals so there was no room for barbarians to spawn.

Which reminds me, I need to convert all those 100% to ANIMAL_SPAWN_MODIFIER. Kashling is there anything special that needs to be done beyond adding it to the A_New_Dawn_GlobalDefines.xml file?

EldrinFal
Sep 27, 2011, 03:30 PM
I have been working with the animal spawning numbers to ensure some barbarians do spawn in the old fashioned way. The last update is the one I think is about right but I did not check it for Neanderthals or Raging Barbarians. Earlier spawn rates gave more animals so there was no room for barbarians to spawn.


I haven't touched the animal spawning, only the Neanderthal spawn values in the Neanderthal folder. But in my games I've had a very good mix of animals as well. And the density is pretty good across the entire Huge map.

It may be, DH, that you don't need to tweak the animals too much once a more refined Neanderthal spawn is used.

Dancing Hoskuld
Sep 27, 2011, 03:33 PM
I haven't touched the animal spawning, only the Neanderthal spawn values in the Neanderthal folder. But in my games I've had a very good mix of animals as well. And the density is pretty good across the entire Huge map.

It may be, DH, that you don't need to tweak the animals too much once a more refined Neanderthal spawn is used.

The Crocodiles (river and salt water) are the only ones I am still working actively on.

EldrinFal
Sep 27, 2011, 03:40 PM
The Crocodiles (river and salt water) are the only ones I am still working actively on.

I really like the increasing variety of animals in the early game. Including (especially?) the Alternate Timeline wild animals. It's also nice to see more in the ocean, even though I tend to prefer maps with less water.

EldrinFal
Sep 27, 2011, 06:39 PM
Pushed my revised Neanderthal spawn file to SVN.

Necratoid
Sep 29, 2011, 03:19 PM
I got a solution to the spawn cluster issue and the order of spawn checks thing... for every X number of a unit on a map add +1 to the area size check that type of unit from each spawn point. That way you will have high density spawn clusters increasingly negated until only the ones that haven't produced any of that unit are viable candidates to spawn that type of unit.

AIAndy
Oct 02, 2011, 05:34 AM
It is possible now to use iGlobalTurns in the spawn system (the new schema needs to be copied to the respective modules though). If there are 100 plots that can spawn the unit then a iGlobalTurns of 5 means that on one of the plots a unit will spawn on average every 500 turns which means that on average every 5 turns a unit will spawn somewhere in the world.
iGlobalTurns can be used in combination with iTurns.
Spawn plot number and chances are logged to ANewDawn.log.

EldrinFal
Oct 02, 2011, 05:23 PM
It is possible now to use iGlobalTurns in the spawn system (the new schema needs to be copied to the respective modules though). If there are 100 plots that can spawn the unit then a iGlobalTurns of 5 means that on one of the plots a unit will spawn on average every 500 turns which means that on average every 5 turns a unit will spawn somewhere in the world.
iGlobalTurns can be used in combination with iTurns.
Spawn plot number and chances are logged to ANewDawn.log.

@AiAndy

Would it be difficult to create a MaximumGlobal value for the spawns? The density ones are great for pacing, but in the case where animals, neanderthals, or barbs aren't being regularly killed, it seems they just keep building up. They may spawn in area X but then move to area Y (usually near an AI/Player city), which means more can spawn in area X again.

In my game on Raging it went fine because they would attack the cities and die (when the city is defended well enough) so that kept the overall pop down. But with Raging off, since they don't attack cities, someone else said the units just pile up.

The value would need to be map size scaling, or have separate values for each size.

AIAndy
Oct 03, 2011, 03:35 AM
@AiAndy

Would it be difficult to create a MaximumGlobal value for the spawns? The density ones are great for pacing, but in the case where animals, neanderthals, or barbs aren't being regularly killed, it seems they just keep building up. They may spawn in area X but then move to area Y (usually near an AI/Player city), which means more can spawn in area X again.

In my game on Raging it went fine because they would attack the cities and die (when the city is defended well enough) so that kept the overall pop down. But with Raging off, since they don't attack cities, someone else said the units just pile up.

The value would need to be map size scaling, or have separate values for each size.
Hmm, something easy to do would be a maximum density in the area for the barbarian player after which the spawn rule would be ignored for those plots.
The number of units of each player is already tracked so that is rather easy and cheap compared to counting all the units of the specific spawn type in each area or global (although that is not that hard either).

Koshling
Oct 03, 2011, 06:31 AM
Hmm, something easy to do would be a maximum density in the area for the barbarian player after which the spawn rule would be ignored for those plots.
The number of units of each player is already tracked so that is rather easy and cheap compared to counting all the units of the specific spawn type in each area or global (although that is not that hard either).

Max area density seems right given the things people are having issues with (which are basically down to either a (un)lucky density of spawn resources, or an unoccupied landmass that just has the entire spawn period unchallenged)

EldrinFal
Oct 03, 2011, 09:42 AM
Max area density seems right given the things people are having issues with (which are basically down to either a (un)lucky density of spawn resources, or an unoccupied landmass that just has the entire spawn period unchallenged)

Currently the only issue I've seen for Neanderthals is their amassing along cultural borders, posted by Necrotoid. However, in his post it sounded like he is using stock v17, which may very well account for what he's seeing.

So for now unless people with SVN report similar issues, we can hold tight. How has Neanderthal spawning been for you guys?

AIAndy
Oct 03, 2011, 09:58 AM
Currently the only issue I've seen for Neanderthals is their amassing along cultural borders, posted by Necrotoid. However, in his post it sounded like he is using stock v17, which may very well account for what he's seeing.

So for now unless people with SVN report similar issues, we can hold tight. How has Neanderthal spawning been for you guys?
Already implemented iMaxAreaTotalDensity.
It can be used to deactivate a spawning rule when a specified density of barbarian units is exceeded in an area. Similar to the local density setting. Added it to SPAWN_BEAR_FOREST as an example.

EldrinFal
Oct 03, 2011, 10:38 AM
Already implemented iMaxAreaTotalDensity.
It can be used to deactivate a spawning rule when a specified density of barbarian units is exceeded in an area. Similar to the local density setting. Added it to SPAWN_BEAR_FOREST as an example.

This applies to ALL barbarian units then? (i.e. any animal, neanderthal, regular barb?)

Same area range as local density? (49 tiles)

Koshling
Oct 03, 2011, 11:19 AM
This applies to ALL barbarian units then? (i.e. any animal, neanderthal, regular barb?)

Same area range as local density? (49 tiles)

I'll let AIAndy confirm, but I suspect he is using 'area' in the sense the code does (has a class called cvArea), which means 'landmass'

AIAndy
Oct 03, 2011, 11:57 AM
I'll let AIAndy confirm, but I suspect he is using 'area' in the sense the code does (has a class called cvArea), which means 'landmass'
Indeed, an area is a continent, an island, a lake, the ocean. And the limit counts all units belonging to the barbarian player in the respective area which means neanderthals, animals and regular barbs.

Dancing Hoskuld
Oct 06, 2011, 11:59 PM
Two things I would like but are can live without.

1) Initial spawn, on turn 11, to put a bunch of units on the map so you don't have to wait for units to spawn "naturally".

2) Spawn on terrain and not feature. Eg Bison spawn on plains but not in plains with forest.

I have asked this before but it got missed. How do I define a ANIMAL_SPAWN_MODIFIER which behaves like the NEANDERTHAL_SPAWN_MODIFIER does? Currently I have 100 everywhere where as it I could use ANIMAL_SPAWN_MODIFIER I could quickly see what effect a small change might have leading perhaps to some better numbers.

AIAndy
Oct 07, 2011, 01:00 AM
Two things I would like but are can live without.

1) Initial spawn, on turn 11, to put a bunch of units on the map so you don't have to wait for units to spawn "naturally".
You can do something similar by adding high spawning rate rules that are only active in the years around turn 11 (probably useful to use the area density limit also). Best also use a SPAWN_MODIFIER for those so you can easily adjust.

2) Spawn on terrain and not feature. Eg Bison spawn on plains but not in plains with forest.
That is what happens when you use a terrain instead of feature and featureterrain in the spawning rule.

I have asked this before but it got missed. How do I define a ANIMAL_SPAWN_MODIFIER which behaves like the NEANDERTHAL_SPAWN_MODIFIER does? Currently I have 100 everywhere where as it I could use ANIMAL_SPAWN_MODIFIER I could quickly see what effect a small change might have leading perhaps to some better numbers.
Add a global define with your new spawn modifier and reference it in the spawn rule.

Koshling
Oct 07, 2011, 06:39 AM
Add a global define with your new spawn modifier and reference it in the spawn rule.

As AIAndy says.

There is a saying in programming circles: 'there is no problem that cannot be solved by adding levels of indirection'. This mechanism is an example of that, which is why I did it that way ;)

Dancing Hoskuld
Oct 07, 2011, 03:42 PM
You can do something similar by adding high spawning rate rules that are only active in the years around turn 11 (probably useful to use the area density limit also). Best also use a SPAWN_MODIFIER for those so you can easily adjust.

Except I don't know when turn 11 is.

As AIAndy says.

There is a saying in programming circles: 'there is no problem that cannot be solved by adding levels of indirection'. This mechanism is an example of that, which is why I did it that way ;)

As long as you provide some documentation for the people who are going to use it.

Koshling
Oct 07, 2011, 03:46 PM
Except I don't know when turn 11 is.



As long as you provide some documentation for the people who are going to use it.

I described it in the original post about the params (which you've linked form the modders info thread).

Regarding 'turn 11' - that will need either a new tag as an alternative to the date tag (not legal to specify both, but either one is ok)

AIAndy
Oct 07, 2011, 05:14 PM
Regarding 'turn 11' - that will need either a new tag as an alternative to the date tag (not legal to specify both, but either one is ok)
I don't think having some spawn on exactly turn 11 will feel right. I would suggest having the initial animal wave start spawning at the year you have after 5 turns on epic and end it after around 20 turns on epic have passed. That way they will spawn smoothly but still considerably faster than that would happen with the normal spawn rules.

Dancing Hoskuld
Oct 07, 2011, 05:26 PM
I don't think having some spawn on exactly turn 11 will feel right. I would suggest having the initial animal wave start spawning at the year you have after 5 turns on epic and end it after around 20 turns on epic have passed. That way they will spawn smoothly but still considerably faster than that would happen with the normal spawn rules.

Pity, because that is what default BtS does with barbarians. Nothing spawns anywhere for the first 10 turns to let you and the AI find a nice spot to settle and do a bit of safe exploration.:p

The real problem is that we stat with a blank map so it takes awhile for animals to build up.

Koshling
Oct 07, 2011, 07:48 PM
I don't think having some spawn on exactly turn 11 will feel right. I would suggest having the initial animal wave start spawning at the year you have after 5 turns on epic and end it after around 20 turns on epic have passed. That way they will spawn smoothly but still considerably faster than that would happen with the normal spawn rules.

I think the point DH is making is that there needs to be an initial 'filler' spawn shortly after the game starts ( can't be right at the start because you could be immediately wiped out before having a chance t even found your capital). This cannot be date based for two reasons - game speed, and advanced start. Hence it needs to be triggered.

Now, rather than an extra spawn wave we could choose to do this implicitly, by running the spawn rules with an amplified rate (say 10 times on all the probabilities) for 2 or 3 turns. We'd probably want to space it out just a little, but maybe auto run all the active spawns with the amplified rate on turns 10, 20, and 30. The only problem I see with this is that it would populate the neadthals as well as the animals which is probably not desirable, so we'd need an extra tag anyway (bIntitialPopulation=1 say) to say whether to run this implicit spawning for any given rule, but this would be much simpler in the XML than having to define an entire seperate spawn rule to do it.

AIAndy
Oct 08, 2011, 04:59 AM
Good idea, and certainly less effort than a full extra set of spawn rules.
I'll also add some global multipliers to govern it (after the freeze, that is). A rate multiplier, a start turn, an end turn and a multiplier for the density limits (so you can have higher spawn rate with lower density limits if you want).

Thunderbrd
Oct 08, 2011, 03:35 PM
This is one of the most impressive developments in the game PERIOD! Ultimately, this is what DH and I had discussed on a number of occasions, a biological spawning system like this. You've done very well with it but I do have a couple of issues I'd like to point out.

At current, my experience of the game suggests that we are causing animals to spawn based on the resources that have been placed on the map (whether we see them yet or not is irrelevant.) Now that seems to work fine except that when your map fails to place certain game-critical resources, such as deer, sheep, horses (as our current game has failed to) it leads to the world flat out not having any of those resources - ever. Mind, this is probably more of a problem to be addressed with the mapscripts but could be overcome by some consideration for it here.

Otherwise... very well done. I agree that an initial spawn is good to work on and have nothing to really add to what you're working on now except to say its spot on to what I thought it needed.

Dancing Hoskuld
Oct 08, 2011, 03:50 PM
This is one of the most impressive developments in the game PERIOD! Ultimately, this is what DH and I had discussed on a number of occasions, a biological spawning system like this. You've done very well with it but I do have a couple of issues I'd like to point out.

At current, my experience of the game suggests that we are causing animals to spawn based on the resources that have been placed on the map (whether we see them yet or not is irrelevant.) Now that seems to work fine except that when your map fails to place certain game-critical resources, such as deer, sheep, horses (as our current game has failed to) it leads to the world flat out not having any of those resources - ever. Mind, this is probably more of a problem to be addressed with the mapscripts but could be overcome by some consideration for it here.

Otherwise... very well done. I agree that an initial spawn is good to work on and have nothing to really add to what you're working on now except to say its spot on to what I thought it needed.

My insistence on trying the biological approach has been paying of in the trade system for me. The AI has actually started real trades offering things I want, not just extras of things I have.

Thunderbrd
Oct 08, 2011, 04:26 PM
I agree that it works out ever so nicely like that and is exactly what we're looking for. But when it denies an entire planet of certain resources it creates a problem. There MUST be something built in to the mapscripts to compell at least one of EVERY resource type to exist SOMEwhere. (unless perhaps the player has opted to eliminate some terrain types that some resources only exist on...)

AIAndy
Oct 08, 2011, 04:37 PM
I agree that it works out ever so nicely like that and is exactly what we're looking for. But when it denies an entire planet of certain resources it creates a problem. There MUST be something built in to the mapscripts to compell at least one of EVERY resource type to exist SOMEwhere. (unless perhaps the player has opted to eliminate some terrain types that some resources only exist on...)
The PW scripts do that. They place at least one of every resource unless in very rare cases when both emergency placement procedures fail.

Thunderbrd
Oct 08, 2011, 04:44 PM
Its on a PW mapscript that I've had this problem.

They are as close as it gets to perfect but I'd like to see them spawn about 25% more resources in general, and give us an option for a LOT more rivers. I used to use a mapscript that allowed me to make nearly every space touch a river... I don't need it to be that intense but most world cities are on rivers for a reason and given the amount of space each square should represent on a map our average computers can handle (standard), we really need more than we currently have. (btw, is there a thread for the PW mapscript discussions that this should be in?)

Koshling
Oct 08, 2011, 04:57 PM
Its on a PW mapscript that I've had this problem.

They are as close as it gets to perfect but I'd like to see them spawn about 25% more resources in general, and give us an option for a LOT more rivers. I used to use a mapscript that allowed me to make nearly every space touch a river... I don't need it to be that intense but most world cities are on rivers for a reason and given the amount of space each square should represent on a map our average computers can handle (standard), we really need more than we currently have. (btw, is there a thread for the PW mapscript discussions that this should be in?)

I'd second this for rivers. In particular this script doesn't seem to result in long rivers. (as an FYI, far in my game there are no sheep, cows, or piges anywhere I know about - and that's 1500 turns in)

AIAndy
Oct 08, 2011, 07:05 PM
Its on a PW mapscript that I've had this problem.

They are as close as it gets to perfect but I'd like to see them spawn about 25% more resources in general, and give us an option for a LOT more rivers. I used to use a mapscript that allowed me to make nearly every space touch a river... I don't need it to be that intense but most world cities are on rivers for a reason and given the amount of space each square should represent on a map our average computers can handle (standard), we really need more than we currently have. (btw, is there a thread for the PW mapscript discussions that this should be in?)
Feel free to make a new thread about the PW map scripts. Currently there is none.

The Perfect Mongoose map script recently got me a lot of rivers on a map.
Anyway, you can govern the amount of rivers by changing the river threshold values they all have in their map constants (near the top of the script, search for river). If you play around with the values to find good ones, tell me afterwards and I make them the default.

Bonus placement is difficult. With logging activated the amount the PW map scripts try to place and the amount they achieve to place are written into PythonDbg.log.
With some they simply do not achieve to place them because of the rules for the bonus defined in the XMLs. Especially the unique in class range prevents proper placement for some (common is Obsidian unless placement in mountains is allowed but then you do not get to use it until after it is useful).

Thunderbrd
Oct 08, 2011, 07:12 PM
I'll revisit this soon then. I have never played with mapscripts from the coding sense at all but isn't it possible to add more options on these kinds of things? I always look for the most options I can get, and that was one of the attractive things about Mongoose and PW scripts over the others.

From what you are saying, it appears that the guidlines for placement are perhaps too restrictive for some resources? I mean... to play correctly, the mod requires a few of every animal type really... thats the most important because at least with minerals they can pop up in undefined spaces with mines.

AIAndy
Oct 08, 2011, 07:19 PM
I'll revisit this soon then. I have never played with mapscripts from the coding sense at all but isn't it possible to add more options on these kinds of things? I always look for the most options I can get, and that was one of the attractive things about Mongoose and PW scripts over the others.
Hmm, an option to select between lots of rivers and less? Could do that.

From what you are saying, it appears that the guidlines for placement are perhaps too restrictive for some resources? I mean... to play correctly, the mod requires a few of every animal type really... thats the most important because at least with minerals they can pop up in undefined spaces with mines.
Yes, the new terrains changed quite some of that and I am not sure if everything with bonuses has been adapted to that yet.

Thunderbrd
Oct 08, 2011, 07:25 PM
Sounds like we've discovered the culprit... terrain requirements for resource spawning needs a complete audit then. Love the new terrains and some bugs that result from them is completely understandable. There's always going to be little issues like that when something new is introduced, unexpected problems. lol Just glad to bring it up to get to a point of figuring out what may be the problem.

And yes, river frequency would be an awesome option to develop into the mapscripts!

Hydromancerx
Oct 08, 2011, 09:50 PM
Sounds like we may need a new map called "Perfect Caveman" to add all these changes.

But I do agree that we need more rivers generated.

Thunderbrd
Oct 09, 2011, 03:52 AM
I've also always appreciated being able to toggle overall resource frequencies. Sometimes I just like playing with resource rich maps while other times I go for a more challenging resource poor game.

EldrinFal
Oct 09, 2011, 01:25 PM
I've seen map scripts with all those sorts of things. I believe it was SmartMap. That one had like almost every aspect configurable. Maybe you can loot it to add to other more popular map scripts?

I don't care for massive oceans (pita for wars) so I always use PlanetGenerator that lets me lower ocean %.

AIAndy
Oct 09, 2011, 02:03 PM
I've seen map scripts with all those sorts of things. I believe it was SmartMap. That one had like almost every aspect configurable. Maybe you can loot it to add to other more popular map scripts?

I don't care for massive oceans (pita for wars) so I always use PlanetGenerator that lets me lower ocean %.
Looting code is rarely possible for that as the approaches of the scripts for map generation vary a lot.

Btw, I have added a sea level option to PerfectMongoose some time ago that causes more or less ocean size.

Koshling
Oct 09, 2011, 02:48 PM
Looting code is rarely possible for that as the approaches of the scripts for map generation vary a lot.

Btw, I have added a sea level option to PerfectMongoose some time ago that causes more or less ocean size.

Could (should?) we go so far as to have a strongly-recommended map family for C2C (almost certainly based on Mongoose), which has it's own Python screen during map generation and allows the parameters to be selected in a nice UI? (sea level, river density, resource density, aridity, ...)

Thunderbrd
Oct 09, 2011, 03:09 PM
I couldn't agree more Koshling

AIAndy
Oct 09, 2011, 05:16 PM
Could (should?) we go so far as to have a strongly-recommended map family for C2C (almost certainly based on Mongoose), which has it's own Python screen during map generation and allows the parameters to be selected in a nice UI? (sea level, river density, resource density, aridity, ...)
Well, the standard map script selection screen allows custom options. Not sure though if we have any access that would allow us to change it beyond that.

Hydromancerx
Oct 09, 2011, 06:35 PM
I couldn't agree more Koshling

I second this.

EldrinFal
Oct 09, 2011, 07:08 PM
Btw, I have added a sea level option to PerfectMongoose some time ago that causes more or less ocean size.

Oh cool, didn't know. :goodjob: I'll definitely give it a whirl when I make start a new game.

Dancing Hoskuld
Oct 09, 2011, 07:45 PM
Well, the standard map script selection screen allows custom options. Not sure though if we have any access that would allow us to change it beyond that.

It is possible. I think it is the "Full of Resources" map script that puts up a new screen over the main screen with lots and lots of options for you to set.

AIAndy
Oct 10, 2011, 12:20 AM
It is possible. I think it is the "Full of Resources" map script that puts up a new screen over the main screen with lots and lots of options for you to set.
Very interesting. I will have a look at that when I am back at the end of the week (flying to a conference today).

AIAndy
Oct 10, 2011, 03:57 PM
That UI is really interesting. It would allow us to set up pretty much any number of game parameters we want and then allow the user to store his selections (or maybe provide presets even).
So beyond setting map script options that could really be used to set different options of the mod.

While that would require adaption of the different map scripts, maybe it is possible to have one pseudo map script as base that has the option settings and then forwards the different map generation calls from the DLL to the real map scripts which are moved to a Python subfolder.

Nonetheless all that is quite some effort to set up properly.
If we go that way, what kind of options would you like to see?

Koshling
Oct 10, 2011, 03:59 PM
That UI is really interesting. It would allow us to set up pretty much any number of game parameters we want and then allow the user to store his selections (or maybe provide presets even).
So beyond setting map script options that could really be used to set different options of the mod.

While that would require adaption of the different map scripts, maybe it is possible to have one pseudo map script as base that has the option settings and then forwards the different map generation calls from the DLL to the real map scripts which are moved to a Python subfolder.

Nonetheless all that is quite some effort to set up properly.
If we go that way, what kind of options would you like to see?

That would be awesome. If it could save a template for favorite game options generally I'd like to see all the major options that people seem to like to tweak (city limits, city soft limits, REV, guilds, great commanders, surround&destroy, raging barbs, ...) as well as whatever you think the most appropriate maop params are (aridity, river density, resource bountifulness, ...)

Thunderbrd
Oct 10, 2011, 04:51 PM
You wouldn't be setting game options but map options with such a UI (I think). The game options do semi-save themselves to your preferences - it can sometimes seem to remember what you used last if you aren't constantly using a newly downloaded mod ;) I think I understand the behavior that makes it 'forget' sometimes but that's pretty complex and not worthy of more discussion here I feel.

One thing I felt about the Full of Resources script was that it was perhaps over complex and it had a few places where either the options were not well expressed and lent themselves to confusion as to their meaning or they just weren't working as intended. This was very frustrating but I still played that map despite not being able to get a handle on some of its metrics because it gave some options I found critical.

I would be happy to add to my list a task to go through and identify all the options I think are important to be able to utilize and if we can stick to those (and what you all wish to add from your own values) without overlapping metrics then we should be able to create the best possible C2C map generation system. It could become one of the best elements of the mod if we do it right, imo, as I don't think ANYONE has EVER done it quite right.

So yeah, using the methods that mapscript shows us how to use is the first trick to take from it I would think. Then, instead of doing everything it does, we try to figure out what we really want and not allow it to overlap itself and get lost in its own complexity as it currently does.

Koshling
Oct 10, 2011, 05:09 PM
You wouldn't be setting game options but map options with such a UI (I think). The game options do semi-save themselves to your preferences - it can sometimes seem to remember what you used last if you aren't constantly using a newly downloaded mod ;) I think I understand the behavior that makes it 'forget' sometimes but that's pretty complex and not worthy of more discussion here I feel.

I was referring to AIAndy's comment:
That UI is really interesting. It would allow us to set up pretty much any number of game parameters we want and then allow the user to store his selections (or maybe provide presets even).

which I took to be ranging wider than just map options...

Thunderbrd
Oct 10, 2011, 05:21 PM
Well... if you could save it all in one bundle that could certainly be an interesting way to make sure you always keep your playstyle logged away and would definately improve on the speed and complexity of starting a new game.

Would we be able to include the Rev DCM options that on multiplayer games don't like being changed once the game has begun? That would be VERY nice to preselect without messing with the mod files.

AIAndy
Oct 11, 2011, 11:37 AM
Well... if you could save it all in one bundle that could certainly be an interesting way to make sure you always keep your playstyle logged away and would definately improve on the speed and complexity of starting a new game.

Would we be able to include the Rev DCM options that on multiplayer games don't like being changed once the game has begun? That would be VERY nice to preselect without messing with the mod files.
I mean not only map settings but all you wish to set and yes, store it all in a bunch then.
It looks possible at least, just a matter of effort.

Necratoid
Oct 11, 2011, 03:56 PM
Just as a side note, I've played a game before where horses didn't spawn at all, granted v10 but the principle holds here, my problem wasn't that the lack of horse specifically. The issue was that their are more than a dozen techs that require horses to exist for the raw idea behind the riding 'horses' or domesticating 'equines' when they don't exist is maddening.

My point is that if your going to make a super amazing customizable map, you'll need to make alternate tech trees to go along with them. Its the next logical customizable step. Not really a v18 or even v19 thing, but something that C2C will likely end up doing so the modders don't get meh with the mod. Eventually.

Just tossing an idea into the wild, so it mentioned for the future.

Dancing Hoskuld
Oct 11, 2011, 04:10 PM
Just as a side note, I've played a game before where horses didn't spawn at all, granted v10 but the principle holds here, my problem wasn't that the lack of horse specifically. The issue was that their are more than a dozen techs that require horses to exist for the raw idea behind the riding 'horses' or domesticating 'equines' when they don't exist is maddening.

My point is that if your going to make a super amazing customizable map, you'll need to make alternate tech trees to go along with them. Its the next logical customizable step. Not really a v18 or even v19 thing, but something that C2C will likely end up doing so the modders don't get meh with the mod. Eventually.

Just tossing an idea into the wild, so it mentioned for the future.

Already thinking along those lines.:mischief:

EldrinFal
Oct 16, 2011, 02:19 AM
Already implemented iMaxAreaTotalDensity.
It can be used to deactivate a spawning rule when a specified density of barbarian units is exceeded in an area. Similar to the local density setting. Added it to SPAWN_BEAR_FOREST as an example.

@AIAndy or Koshling

Is this number doubled with the Raging Barbarian setting?

AIAndy
Oct 16, 2011, 04:02 AM
@AIAndy or Koshling

Is this number doubled with the Raging Barbarian setting?
It is (or rather halfed because it is that weird inverse density).
Mind though that it currently only works with threads on (it is a global define now with standard off to find out if some of the random crashes people experienced come from there). I will do some changes to that code so the non threaded code uses the same sequence and has all the features.

EDIT: Pushed the change to the SVN.

Koshling
Oct 16, 2011, 08:05 AM
It is (or rather halfed because it is that weird inverse density).
Mind though that it currently only works with threads on (it is a global define now with standard off to find out if some of the random crashes people experienced come from there). I will do some changes to that code so the non threaded code uses the same sequence and has all the features.

EDIT: Pushed the change to the SVN.

Whether spawns are doubled by raging depends on if the spawn is tagged as barbarian or not. The spawn XML lets you decide. Animals currently are I think (though personally I'm not convinced that is correct)

EldrinFal
Oct 16, 2011, 11:55 AM
Whether spawns are doubled by raging depends on if the spawn is tagged as barbarian or not. The spawn XML lets you decide. Animals currently are I think (though personally I'm not convinced that is correct)

Yes, but I was wondering which particular value is doubled/halved to achieve that. And if AIAndy's two new tags he added were included in that doubling. If the density isn't doubled, a fast spawn would reach or maintain the density faster, but not increase the total number of spawns achievable in that Area.

I think the standard setting is a little soft currently to be honest. I think Neanderthals and Animals should wander into cultural borders. I don't think animals should attack cities, but Neanderthals should as should the normal barbs. Raging should just double their intensity and maybe widen the range they will move to seek out Civs.

If we change TreatAsBarb for animals to 0, then we may need an option to Double Animals-- like they have in FFH2. Think they call it Wild Animals or Animal Kingdom or something like that.

Dancing Hoskuld
Oct 16, 2011, 02:15 PM
Yes, but I was wondering which particular value is doubled/halved to achieve that. And if AIAndy's two new tags he added were included in that doubling. If the density isn't doubled, a fast spawn would reach or maintain the density faster, but not increase the total number of spawns achievable in that Area.

I think the standard setting is a little soft currently to be honest. I think Neanderthals and Animals should wander into cultural borders. I don't think animals should attack cities, but Neanderthals should as should the normal barbs. Raging should just double their intensity and maybe widen the range they will move to seek out Civs.

If we change TreatAsBarb for animals to 0, then we may need an option to Double Animals-- like they have in FFH2. Think they call it Wild Animals or Animal Kingdom or something like that.

The definition of animal in BtS = "barbarian that can't enter borders".;)

EldrinFal
Oct 16, 2011, 02:17 PM
The definition of animal in BtS = "barbarian that can't enter borders".;)

Doesn't mean we can't redefine it. :D

EldrinFal
Oct 18, 2011, 02:13 AM
@Dancing Hoskuld

Just letting you know the animal spawn rate overall seems high. I ran a bunch of autoplay games tonight to test the Neanderthal adjustments and there were quite a large number of animals. They seemed diverse, but added up together, quite prolific! :)

Maybe once AIAndy implements his change to divide the "barbarians" into "teams" we can have a dedicated animal one (or two) and then get some spawn code to limit their numbers as a group.

Koshling
Oct 18, 2011, 06:24 AM
@Dancing Hoskuld

Just letting you know the animal spawn rate overall seems high. I ran a bunch of autoplay games tonight to test the Neanderthal adjustments and there were quite a large number of animals. They seemed diverse, but added up together, quite prolific! :)

Maybe once AIAndy implements his change to divide the "barbarians" into "teams" we can have a dedicated animal one (or two) and then get some spawn code to limit their numbers as a group.

It wouldn't be hard to add a 'group' concept so that you could tag spawns into groups and have the density limits apply to the group regardless of the teasm they eventually wind up on.

EldrinFal
Oct 18, 2011, 09:17 AM
It wouldn't be hard to add a 'group' concept so that you could tag spawns into groups and have the density limits apply to the group regardless of the teasm they eventually wind up on.

Sounds good to me. Then we can separate animals and Neanderthals (and future barbs), and even sub-divide animals. Ideally I think only Barbarian and Predator-type animals should actually attack other units. Other animal types I'm wondering if they should flee away from units? Might be an interesting concept to force the player to use more than one unit or strategic movement to corner those non-aggressive but valuable types.

Koshling
Oct 18, 2011, 10:22 AM
Sounds good to me. Then we can separate animals and Neanderthals (and future barbs), and even sub-divide animals. Ideally I think only Barbarian and Predator-type animals should actually attack other units. Other animal types I'm wondering if they should flee away from units? Might be an interesting concept to force the player to use more than one unit or strategic movement to corner those non-aggressive but valuable types.

You misunderstand I think. Changing their behaviour once spawned would require modification to the animal AI. I'm only talking about grouping them for spawn purposes so that the spawn densities can correspond to groups (so overall animal density, or predator density or whatever could be controled in the spawn). This would not influence their behaviour once spawned at all.

Adding multiple animal AIs (or just tweaking the one we have to interpret some new predator/prey tag) is a separate thing.

EldrinFal
Oct 18, 2011, 10:50 AM
You misunderstand I think. Changing their behaviour once spawned would require modification to the animal AI. I'm only talking about grouping them for spawn purposes so that the spawn densities can correspond to groups (so overall animal density, or predator density or whatever could be controled in the spawn). This would not influence their behaviour once spawned at all.

Adding multiple animal AIs (or just tweaking the one we have to interpret some new predator/prey tag) is a separate thing.

Ah.. yeah, and I guess AI settings are per individual unit anyway. For some reason I had it in my head that the AI was attached to "Barbarian." :blush:

But I do understand the spawning aspect. Off the top of my head I would think all Land animals would be in one group, Water in another, and then Neanderthals / Normal barbarian unit types. Do you see a reason to sub-divide land animal spawns?

Maybe we need some Neanderthal chiefs that are a little more powerful. Then group them separately for a much less rare chance. Would need a slightly altered model though. :mischief:

Thunderbrd
Oct 18, 2011, 11:01 AM
We have an ability to make an animal 'aggressive' and thus willing to attack, vs ... I'm not sure the setting, but nevertheless, it was a line in the XML from what I understand.

Splitting groups into Barbarian, Predator, and Prey categories would be helpful nevertheless to create a very biologically self interacting world. And I agree that most Prey creatures wouldn't be aggressive but should have a strong ability to flee built in with defensive withdraw and some withdraw percentage (even some predators should have this though since most animals, even the really fierce ones, cats in particular, will flee as soon as they are hurt in any way.)

This wouldn't change the ai settings for the animals at all I don't think... since we already have a toggle to tell them whether to be aggressive or to avoid combat.

EldrinFal
Oct 18, 2011, 11:37 AM
We have an ability to make an animal 'aggressive' and thus willing to attack, vs ... I'm not sure the setting, but nevertheless, it was a line in the XML from what I understand.

Splitting groups into Barbarian, Predator, and Prey categories would be helpful nevertheless to create a very biologically self interacting world. And I agree that most Prey creatures wouldn't be aggressive but should have a strong ability to flee built in with defensive withdraw and some withdraw percentage (even some predators should have this though since most animals, even the really fierce ones, cats in particular, will flee as soon as they are hurt in any way.)

This wouldn't change the ai settings for the animals at all I don't think... since we already have a toggle to tell them whether to be aggressive or to avoid combat.

If we have it that's great. :) But there IS a difference between simply not attacking and actively moving away from all Human units (maybe even eventually include fleeing away from predators, who will attack them).

Although there has to be a limit to the distance. It would be pointless if every single "Bambi" unit clustered in the farthest peninsula of the continent! :lol:

Dancing Hoskuld
Oct 18, 2011, 01:23 PM
@Dancing Hoskuld

Just letting you know the animal spawn rate overall seems high. I ran a bunch of autoplay games tonight to test the Neanderthal adjustments and there were quite a large number of animals. They seemed diverse, but added up together, quite prolific! :)

Maybe once AIAndy implements his change to divide the "barbarians" into "teams" we can have a dedicated animal one (or two) and then get some spawn code to limit their numbers as a group.

I know. I had them working fine then, probably with all the new animals, they have blown out.

We have an ability to make an animal 'aggressive' and thus willing to attack, vs ... I'm not sure the setting, but nevertheless, it was a line in the XML from what I understand.

That is the bDefendOnly tag. If it is on they wont attack. If off they will. All wild animals have it off and subdued animals have it on.

When the animals were not aggressive, you could not capture them because human units could not catch up with them.

Splitting groups into Barbarian, Predator, and Prey categories would be helpful nevertheless to create a very biologically self interacting world. And I agree that most Prey creatures wouldn't be aggressive but should have a strong ability to flee built in with defensive withdraw and some withdraw percentage (even some predators should have this though since most animals, even the really fierce ones, cats in particular, will flee as soon as they are hurt in any way.)

This wouldn't change the ai settings for the animals at all I don't think... since we already have a toggle to tell them whether to be aggressive or to avoid combat.

The cobra has a chance to withdraw, and does on occasion. However I am suspecting that this chance to withdraw is causing human units to get excessive promotions since they survive the combat also.

If I remember my ecosystem stuff it is one predator for every 200 prey.

Koshling
Oct 18, 2011, 03:02 PM
If I remember my ecosystem stuff it is one predator for every 200 prey.

Depends on the specific predator and prey to some extent. More than 200 plankton to each Sperm whale ;-)

AIAndy
Oct 18, 2011, 03:06 PM
Depends on the specific predator and prey to some extent. More than 200 plankton to each Sperm whale ;-)
In the end it depends on the flow and loss of energy throughout the ecosystem.
From the sun to the plants to the herbivores and onwards through the food chain. Every level loses a lot of the energy and has therefore considerably lower biomass.

Koshling
Oct 18, 2011, 03:11 PM
In the end it depends on the flow and loss of energy throughout the ecosystem.
From the sun to the plants to the herbivores and onwards through the food chain. Every level loses a lot of the energy and has therefore considerably lower biomass.

There was a smiley on my post for a reason! ;)

Hydromancerx
Oct 18, 2011, 04:50 PM
We have an ability to make an animal 'aggressive' and thus willing to attack, vs ... I'm not sure the setting, but nevertheless, it was a line in the XML from what I understand.

Splitting groups into Barbarian, Predator, and Prey categories would be helpful nevertheless to create a very biologically self interacting world. And I agree that most Prey creatures wouldn't be aggressive but should have a strong ability to flee built in with defensive withdraw and some withdraw percentage (even some predators should have this though since most animals, even the really fierce ones, cats in particular, will flee as soon as they are hurt in any way.)

This wouldn't change the ai settings for the animals at all I don't think... since we already have a toggle to tell them whether to be aggressive or to avoid combat.

What if you had flight or fight system like this ...

Aggressive = Always attacks you on sight.
Defensive = Attacks you if you get too close.
Indifferent = Will not run or attack you on sight.
Cautious = Runs Away if you get too close.
Skittish = Runs away from you on sight.

Thunderbrd
Oct 18, 2011, 07:03 PM
Great options Hydro... I'd like to add:

Arrogant = Moves randomly and if happens to attack you in so doing, so be it.

Hmm... so how would we do this Koshling? Establish an ai routine for animals based on each of these sorts?

Koshling
Oct 19, 2011, 06:59 AM
Great options Hydro... I'd like to add:

Arrogant = Moves randomly and if happens to attack you in so doing, so be it.

Hmm... so how would we do this Koshling? Establish an ai routine for animals based on each of these sorts?

Easiest way would be to create new unitAIs for each (which implies a separate routine in unitAI.cpp yes, though obviously they would share mostly common sub-routines from the current animal AI). However, this would not be enough to cause them to fight other animals (or barbarians) - AIAndy's proposed splitting into multipel barbarian teasm would eb needs AS WELL for that.

AIAndy
Oct 19, 2011, 07:28 AM
Easiest way would be to create new unitAIs for each (which implies a separate routine in unitAI.cpp yes, though obviously they would share mostly common sub-routines from the current animal AI). However, this would not be enough to cause them to fight other animals (or barbarians) - AIAndy's proposed splitting into multipel barbarian teasm would eb needs AS WELL for that.
The long term plan I would suggest is:

A new XML file for specifying special players and their relation to each other (will also require going over a LOT of code referencing BARBARIAN_PLAYER and the barbarian or minor civ property of players)
Several new unit AIs
Specify special player and unit AI in the spawn info

For starters maybe just some unit AIs and the possibility to spawn with a specified unit AI.

Koshling
Oct 19, 2011, 07:51 AM
The long term plan I would suggest is:

A new XML file for specifying special players and their relation to each other (will also require going over a LOT of code referencing BARBARIAN_PLAYER and the barbarian or minor civ property of players)
Several new unit AIs
Specify special player and unit AI in the spawn info

For starters maybe just some unit AIs and the possibility to spawn with a specified unit AI.

Don't think we need the unitAI seopecified in teh sopwn for now. Just new unitAIs and they would be the default AIs for those animals in the animal's def (regardless how they spawn)

AIAndy
Oct 19, 2011, 10:59 AM
Don't think we need the unitAI seopecified in teh sopwn for now. Just new unitAIs and they would be the default AIs for those animals in the animal's def (regardless how they spawn)
I am not sure if in the long run you might want to spawn the same animal sometimes with one AI and sometimes with another. But you are right that that can easily be added later.

EldrinFal
Oct 19, 2011, 11:45 AM
I am not sure if in the long run you might want to spawn the same animal sometimes with one AI and sometimes with another. But you are right that that can easily be added later.

I suppose that could be interesting if you could assign a name tag to them at the same time. "Rabid Boar" "Timid Elephant"

Once the barbarians are broken up, I'm wondering if they should have some kind of location restriction so two tribes aggro to each other aren't spawning from the same points on the map.

Thunderbrd
Oct 19, 2011, 07:38 PM
Well... and before I bring this up again I want to say I realize this is probably frustrating to those who've done all this amazing work on the current spawning mechanisms of which I am currently in awe of...

But this takes us back to having the map initially establish spawn point terrain improvements, spawn batteries as it were, that spit out their supported 'spawn creature' rather than functioning off of resource points as we currently do.

This wouldn't mean we would need to completely rewrite everything but I do think that creatures could then have missions that will allow them to sacrifice themselves to generate new spawn points when they find themselves on their 'perfect habitat'. For carnivores, this could be a space away from their perfect prey's spawning point. It could be as simple as, say, for deer, they would be inclined to plant a spawn point as long as they are in a forest and over 5 spaces away from any other deer spawn point.

Anyhow, players could 'ravage' spawn points to eliminate certain species, allow spawn points to keep access to species that they wish to repeatedly hunt, and would have to replace them entirely if they wish to develop that space for a city's use.

Such a concept could become quite biological. A prey's spawning could be regular while a predator's spawning might be based on spitting out one creature for every 3 prey devoured times the amount of that predator existing on the map. We could play with numbers until we get some really neat frequency effects.

And that would only be possible by establishing these ideas we've been discussing about splitting up barbarian types into new groupings and AIs.

robomani
Oct 19, 2011, 08:30 PM
If you want I know that in Rife there is animal unit that spawn other unit when they win (I think it is the lion that have something like 35% chance to spawn a new lion unit when they win a combat)

Hydromancerx
Oct 19, 2011, 08:55 PM
@Thunderbrd

Some ideas for spawn points ...

Outback (Desert or Scrub)
- Kangaroo
- Emu (once made)
- Wild Boar

Serengeti (Plain or Savanna)
- Elephant
- Rhino
- Hippo
- Giraffe
- Water Buffalo
- Zebra
- Aardvark
- Ratel
- Ostrich
- Panther
- Cheetah
- Lion
- Pack of Lions
- Hyena
- Vulture

Arabia (Desert or Dunes)
- Gemsbok
- Camel
- Vulture
- Cobra
- Ibex
- Onager

Great Plains (Grassland or Plains)
- Bison
- Deer
- Wolf

Euasian Steppes (Grassland or Plains)
- Horse
- Camel
- Deer
- Wolf

Europe (Forest)
- Auroch
- Wolf
- Bear
- Deer

Amazon (Rainforest)
- Jaguar
- Tapir

Congo (Rainforest)
- Gorilla
- Panther
- Bongo
- Okapi
- Mandrill
- Elephant

Pampas (Plains or Savanna)
- Rhea (need to make)
- Anteater (need to make)

India (Jungle or Scrub)
- Elephant
- Bengal Tiger
- Panther
- Bear
- Cobra
- Deer

Southeast Asia (Jungle)
- Cassowary
- Elephant
- Orangutan
- Komodo Dragon
- Bengal Tiger
- Water Bufffalo

Canada (Pine Forest)
- Moose
- Caribou
- Deer
- Wolf
- Beaver
- Wolverine
- Bear
- Wild Boar

China (Bamboo)
- Panda
- Deer
- Siberian Tiger
- Wolf

Arctic (Tundra, Permafrost or Ice)
- Polar Bear
- Musk Ox
- Caribou
- Wolf

Antarctica (Tundra, Permafrost or Ice)
- Penguin

EldrinFal
Oct 19, 2011, 09:29 PM
Well... and before I bring this up again I want to say I realize this is probably frustrating to those who've done all this amazing work on the current spawning mechanisms of which I am currently in awe of...

But this takes us back to having the map initially establish spawn point terrain improvements, spawn batteries as it were, that spit out their supported 'spawn creature' rather than functioning off of resource points as we currently do.

This wouldn't mean we would need to completely rewrite everything but I do think that creatures could then have missions that will allow them to sacrifice themselves to generate new spawn points when they find themselves on their 'perfect habitat'. For carnivores, this could be a space away from their perfect prey's spawning point. It could be as simple as, say, for deer, they would be inclined to plant a spawn point as long as they are in a forest and over 5 spaces away from any other deer spawn point.

Anyhow, players could 'ravage' spawn points to eliminate certain species, allow spawn points to keep access to species that they wish to repeatedly hunt, and would have to replace them entirely if they wish to develop that space for a city's use.

Such a concept could become quite biological. A prey's spawning could be regular while a predator's spawning might be based on spitting out one creature for every 3 prey devoured times the amount of that predator existing on the map. We could play with numbers until we get some really neat frequency effects.

And that would only be possible by establishing these ideas we've been discussing about splitting up barbarian types into new groupings and AIs.

I guess you didn't read all the threads when you returned. :)

http://forums.civfanatics.com/showthread.php?t=377892&page=180

http://forums.civfanatics.com/showthread.php?t=440430

AIAndy
Oct 20, 2011, 02:42 AM
Well, from a mechanic stand point to have such spawn points we would need:

Improvements as source for spawn rules (easy change)
An Improvement for every kind of spawn point you want with graphics
Build actions for the spawn point improvements given to the animals that consume the unit
Animal unit AIs that build them now and then


So most of the mechanics for that are already there and also the possibility of removal of those spawn points by razing the improvement.
The main job will be for Hydro to define all the improvements and have graphics for them and for Koshling to write the unit AIs.

The restrictions on where the improvement can be built define the "perfect habitat".
I'll do the change to allow improvements as spawn source.

Hydromancerx
Oct 20, 2011, 05:04 AM
The main job will be for Hydro to define all the improvements and have graphics for them and for Koshling to write the unit AIs.


What exactly do you need me to do? :crazyeye:

AIAndy
Oct 20, 2011, 09:02 AM
What exactly do you need me to do? :crazyeye:
Well, if I got it correctly the idea was to have dens, nests and similar structures or Outback, Serengeti and the like as the main source of animal spawning (at least for some animals).
Those would be modelled as improvements and would now and then be built by an animal unit, sacrificing itself.
There would then be extra spawning rules from those improvements with an increased spawning chance compared to normal terrain.

That means the player has the chance to reduce animal spawning by destroying the lairs or leave them be to get more animals to hunt.

If we go with that, then someone needs to find graphical representations for the lairs and add them as improvements to the game.

Koshling
Oct 20, 2011, 09:51 AM
Well, if I got it correctly the idea was to have dens, nests and similar structures or Outback, Serengeti and the like as the main source of animal spawning (at least for some animals).
Those would be modelled as improvements and would now and then be built by an animal unit, sacrificing itself.
There would then be extra spawning rules from those improvements with an increased spawning chance compared to normal terrain.

That means the player has the chance to reduce animal spawning by destroying the lairs or leave them be to get more animals to hunt.

If we go with that, then someone needs to find graphical representations for the lairs and add them as improvements to the game.

Is this really a good return on the effort given everything else we have to d?

AIAndy
Oct 20, 2011, 10:04 AM
Is this really a good return on the effort given everything else we have to d?
Hmm, I am not sure.
It could result in some interesting dynamics. Like if applied to Neanderthals by having them plant a Neanderthal settlement that you could plunder for gold (and to have less Neanderthals spawning).
Or getting some specific ecosystems depending on the lairs that are around. Maybe you could use your subdued animals to create a lair, reintroduce them into the wild (same ability as the wild animals then use) and influence the animal ecosystem that way or keep some wildlife reservats around when your cultural borders have spread a lot and there is not a lot of spawning from the natural terrain any more.

But in the end that has to be decided if it is worth it by those who would do most of the graphics/AI work.

Koshling
Oct 20, 2011, 10:12 AM
Hmm, I am not sure.
It could result in some interesting dynamics. Like if applied to Neanderthals by having them plant a Neanderthal settlement that you could plunder for gold (and to have less Neanderthals spawning).
Or getting some specific ecosystems depending on the lairs that are around. Maybe you could use your subdued animals to create a lair, reintroduce them into the wild (same ability as the wild animals then use) and influence the animal ecosystem that way or keep some wildlife reservats around when your cultural borders have spread a lot and there is not a lot of spawning from the natural terrain any more.

But in the end that has to be decided if it is worth it by those who would do most of the graphics/AI work.

It could have benefits but it's a lot of work, and we have been polishing the prehistoric era (which is when it most matters) for some time. It's really time we spent more of our efforts a bit deeper into the game IMO.

Dancing Hoskuld
Oct 20, 2011, 12:25 PM
It could have benefits but it's a lot of work, and we have been polishing the prehistoric era (which is when it most matters) for some time. It's really time we spent more of our efforts a bit deeper into the game IMO.

I agree. We need to move on to later eras. This is an idea we can come back to.

Hydromancerx
Oct 20, 2011, 06:28 PM
http://forums.civfanatics.com/attachment.php?attachmentid=298088&d=1312974341

Well if you want caves, there were caves in Dune Wars (see upper right corner). This graphic might work as a new terrain feature. Not just for animals but for other buildings such a cave exploration, cave dwelling or collecting bat guano.

Thunderbrd
Oct 20, 2011, 07:59 PM
AIAndy listed off a lot of the vision that such changes lead to. Systems where humanity can, down the road, use their captured animals to create new animal spawn points, a concept that could support more complex zoos and such as well which means we are polishing later eras as we go here too.

I don't think it would be the sort of thing that would take us a LOT of time... No problem in reusing most graphics over and over (the caves above would apply for most I think) - a mouseover reveals what the improvement is anyhow. Hydro... is it possible to use some of the animal herd resource graphics for those animal spawn points?

Now, since its Koshling raising concerns about the workload, I suspect its a matter of the ai routines being difficult to program... and I can understand THAT. But I mean, that's a fairly simple routine that would be checked just before the animal would, say, move (and only if not considering an attack in so doing). Check 1: Is the animal currently standing on perfect terrain for that animal? IF yes, then: Is the animal within an amt of spaces equal to the mapsize value to another improvement of that animal's type? IF yes, ignore the routine and move on, IF no, continue to a random check, say 25% chance to decide to push the mission to sacrifice itself and plant the improvement.

Most of these kinds of checks have corresponding examples elsewhere... I could do it myself but would be fairly confused on how when it came to checking for the right sort of building within the proper range... My point is, it wouldn't be tooooooo difficult to include in the animal ai routines, would it?

Hydromancerx
Oct 20, 2011, 08:37 PM
I don't think it would be the sort of thing that would take us a LOT of time... No problem in reusing most graphics over and over (the caves above would apply for most I think) - a mouseover reveals what the improvement is anyhow. Hydro... is it possible to use some of the animal herd resource graphics for those animal spawn points?

If you are going tht road why not just use the existing animal resources?

Koshling
Oct 21, 2011, 07:12 AM
If you are going tht road why not just use the existing animal resources?

Because you don't want to provide the resource just because there is a spawn point (or we're back to exactly where we started with animals only spawning from resources and so on!). If you mean you could use the existing resource GRAPHIC then also yuck - there would be no visual differentiation betwen a resource (that you want to improve) and a spawn-point, which has no value apart from knowing it's somewhere that might produce a spawn.

Hydromancerx
Oct 21, 2011, 03:45 PM
Because you don't want to provide the resource just because there is a spawn point (or we're back to exactly where we started with animals only spawning from resources and so on!). If you mean you could use the existing resource GRAPHIC then also yuck - there would be no visual differentiation betwen a resource (that you want to improve) and a spawn-point, which has no value apart from knowing it's somewhere that might produce a spawn.

How about this. We have a new feature called the "Watering Hole". It looks and works just like an oasis. Animals spawn from the watering hole but since they look the same you cannot tell what type of animals will spawn from it. Note that the real oasis can be used for desert animals.

Good idea? Bad idea? What do you think?

Dancing Hoskuld
Oct 21, 2011, 03:52 PM
If you are going for this then remember it, the spawn point, has to be an improvement not a feature. Unless you want to duplicate all features ... maybe I don't want to mention that .. more work for Koshling, AIAndy or me.

AIAndy
Oct 21, 2011, 05:33 PM
If you are going for this then remember it, the spawn point, has to be an improvement not a feature. Unless you want to duplicate all features ... maybe I don't want to mention that .. more work for Koshling, AIAndy or me.
Not that hard to add a tag for improvements as spawning source. The code will be quite similar to what there already is.
So I'll add that if you want it.

Thunderbrd
Oct 21, 2011, 06:16 PM
I see why you wouldn't want to make the same animal spawning point improvement graphic and resource graphic the same thing.

But I can see an interrelation between the two... perhaps animals that have a correlating 'resource' feature can get an edge up on the competition in a way. Most of those animals are herbivores that found the basis of an ecology anyhow... so perhaps we should make those resources spawn points for those animals ALSO (the spawn points that CAN'T be eliminated by razing...) We've been saying that the prey would need to largely outnumber the predators anyhow.

Along those lines of thinking, perhaps tribal villages should be spawn points for barbs (and in early eras neanderthals).

For spawn point improvements for those animals that also spawn off permanent resource herds, we could still use the graphics from the features - just not animated perhaps.

The ideas of watering holes and caves could form the graphics for most spawn improvements. It would only take a mouseover to see what KIND of spawning den it is. Perhaps smaller scale outcrops, thickets and nests would work well too. I think someone said we had a nest with eggs for a graphic didn't they? That'd work nicely for the bird and snake animals.


Now here's another thought... rather than making these spawn points for just the particular animal, we could use these to craft entire ecosystems. Make each spawn point type a 'system spawn' improvement. Thus you'd have American Southwest spawn improvements that spit out rattlesnakes, donkeys, wild horses, scorpions, rabbits, etc... and each of those types of animals have the mission to plant another American Southwest spawn improvement if they find another desert spot with barrel cactus, or something along those lines. (This is not to suggest we not split up predators and prey from the normal barbarian flag...)

Dancing Hoskuld
Oct 29, 2011, 07:10 PM
A couple of things that would be nice

not terrain and not feature tags
spawn location on river with perhaps a cannot move away from river function too. for all those crocs :)
location on fresh water coast - probably the same thing as on river.


Edit thinking on it those last two are plots with "fresh water" present. Which would be enough for my needs.

Koshling
Oct 30, 2011, 07:49 AM
A couple of things that would be nice

not terrain and not feature tags
spawn location on river with perhaps a cannot move away from river function too. for all those crocs :)
location on fresh water coast - probably the same thing as on river.


Edit thinking on it those last two are plots with "fresh water" present. Which would be enough for my needs.

That cannot be done in the spawn system code, but needs to be a new general unit movement restriction (so a unit tag, not a spawn tag), but shouldn't be hard to do.

Dancing Hoskuld
Oct 30, 2011, 02:18 PM
The spawn on "plains but not forest" or "on plot with fresh water" can be?

AIAndy
Oct 30, 2011, 02:40 PM
The spawn on "plains but not forest" or "on plot with fresh water" can be?
"Plains but not forest" you can already do. Check SPAWN_BISON_PLAINS which only spawns on plains with no features.

"Plot with fresh water" can be added.

Dancing Hoskuld
Oct 30, 2011, 02:47 PM
"Plains but not forest" you can already do. Check SPAWN_BISON_PLAINS which only spawns on plains with no features.

"Plot with fresh water" can be added.

Ah, I thought that plains meant all plains even those with features but if you wanted to limit what features you could. :blush:

Bug animals are spawning on peaks. This is probably OK for some but not all. Note that they can't move into peaks only out of them.

AIAndy
Oct 30, 2011, 03:09 PM
Ah, I thought that plains meant all plains even those with features but if you wanted to limit what features you could. :blush:
I think if you want a specific terrain with any feature you have to enumerate all possible features on that terrain. I can change that behavior so if you specify a featureterrain but no features that any feature on that terrain is valid then.

Bug animals are spawning on peaks. This is probably OK for some but not all. Note that they can't move into peaks only out of them.
I can either remove spawning from peaks or add a tag to specify if peaks are valid spawn spots.

Dancing Hoskuld
Oct 30, 2011, 03:28 PM
I think if you want a specific terrain with any feature you have to enumerate all possible features on that terrain. I can change that behavior so if you specify a featureterrain but no features that any feature on that terrain is valid then.

As is is fine, it was just my understanding that needed fixing.

I can either remove spawning from peaks or add a tag to specify if peaks are valid spawn spots.

Make spawn on peaks an option/tag with default of no.

Dancing Hoskuld
Nov 02, 2011, 08:21 PM
I am really enjoying the way that different parts of the world have different animals. Unfortunately this is only done on a north- south/latitude split at the moment.

I a wondering if it may be possible to split it even further. EG by region old world/new world. Or even more. That way we may be able to get improved "ecologies" and increase the potential for trade.

Hydromancerx
Nov 02, 2011, 11:04 PM
I am really enjoying the way that different parts of the world have different animals. Unfortunately this is only done on a north- south/latitude split at the moment.

I a wondering if it may be possible to split it even further. EG by region old world/new world. Or even more. That way we may be able to get improved "ecologies" and increase the potential for trade.

Hmm. How many different ones can you have? If only 4 then maybe ...

Northern Old World = Eurasia
Northern New World = Americas
Southern Old World = Africa
Southern New World = Oceania

Dancing Hoskuld
Nov 02, 2011, 11:08 PM
Hmm. How many different ones can you have? If only 4 then maybe ...

Northern Old World = Eurasia
Northern New World = Americas
Southern Old World = Africa
Southern New World = Oceania

Sorry, the word "region" has a meaning in map scripts and map generation. If I remember correctly a region is a landmass plus "islands" connected by sea. So a in theory a non-ocean going nation can get to anywhere in a region.

Hydromancerx
Nov 02, 2011, 11:35 PM
Sorry, the word "region" has a meaning in map scripts and map generation. If I remember correctly a region is a landmass plus "islands" connected by sea. So a in theory a non-ocean going nation can get to anywhere in a region.

What I mean is say African animals like lions, giraffes, zebras, gorillas, etc would spawn only in the old world in the southern hemisphere. While say Kangaroos, Emus, Koalas, etc would only spawn in the new world in the southern hemisphere.

Dancing Hoskuld
Nov 07, 2011, 04:29 AM
Something appears to have changed in the spawn system recently. I am seeing very very few animals now. I have had to increase the modifier to 600%:eek:

AIAndy
Nov 07, 2011, 04:44 AM
Something appears to have changed in the spawn system recently. I am seeing very very few animals now. I have had to increase the modifier to 600%:eek:
I found the mistake and will fix it this evening (European time). The result is that currently most animals won't spawn on flatlands (as the variable is overwritten with the content of the new tags).

AIAndy
Nov 07, 2011, 12:11 PM
Something appears to have changed in the spawn system recently. I am seeing very very few animals now. I have had to increase the modifier to 600%:eek:
The DLL I just pushed to SVN should fix it.

Dancing Hoskuld
Nov 30, 2011, 07:28 PM
I have tried the bFreshWaterOnly tag but I a not getting any spawns. Does it also require a feature or terrain?

AIAndy
Jan 11, 2012, 04:05 PM
Spawn rules can now be restricted by longitude with the tags iMinLongitude and iMaxLongitude. Longitude values are from -180 to 180. You can specify from 70 to 170 but 150 to -115 is also valid (-145 would be in that range but not -20).

Dancing Hoskuld
Jan 11, 2012, 05:12 PM
Spawn rules can now be restricted by longitude with the tags iMinLongitude and iMaxLongitude. Longitude values are from -180 to 180. You can specify from 70 to 170 but 150 to -115 is also valid (-145 would be in that range but not -20).

Longitude is not that useful since we want spawning on different continents on the map.

AIAndy
Jan 11, 2012, 05:59 PM
Longitude is not that useful since we want spawning on different continents on the map.
It was easy and fast to implement and allows at least some differentiation between eastern and western hemisphere.

Hydromancerx
Jan 11, 2012, 07:41 PM
So if there is no land in say the Northwest Hemisphere then the animals will just not show up if they are specified to be in the Northern and the Western hemisphere?

AIAndy
Jan 12, 2012, 01:24 AM
So if there is no land in say the Northwest Hemisphere then the animals will just not show up if they are specified to be in the Northern and the Western hemisphere?
Yes, that is the disadvantage of that approach. In the long run I'll add a proper solution.

Dancing Hoskuld
Jan 27, 2012, 07:42 PM
@AIAndy would it be possible to get all the tags to do with dependancies on other things in here. E.G. I want to turn off giraffes if the att-timelines giraffes are not in the game.

AIAndy
Jan 28, 2012, 12:50 PM
@AIAndy would it be possible to get all the tags to do with dependancies on other things in here. E.G. I want to turn off giraffes if the att-timelines giraffes are not in the game.
It is probably enough to add them to the schema as they are processed by the base info class.

EDIT: I have added them (untested).

Dancing Hoskuld
Jan 28, 2012, 02:37 PM
It is probably enough to add them to the schema as they are processed by the base info class.

EDIT: I have added them (untested).

I was about to do it as my next task is to test the longitude parameters.

Dancing Hoskuld
Feb 07, 2012, 03:47 PM
I have experimented with the east-west spawning restrictions for animals. It is mostly OK. Except if your continent ends up where Central-South America are and there is no land link to the Arctic Circle. There is just to small a variety of animals.

If you are lucky enough to have some animal resources then it isn't so bad, but I did not even get a Llama resource:p

Dancing Hoskuld
Apr 06, 2013, 06:37 PM
Would it be possible to add improvements to the spawn sites. It would be the same as bonuses or terrains. I want to add in Lairs:evil: it is the only way I can figure of making the Ancient Forests more mysterious.:D

Sgtslick
Apr 09, 2013, 10:20 AM
Would it be possible to add improvements to the spawn sites. It would be the same as bonuses or terrains. I want to add in Lairs:evil: it is the only way I can figure of making the Ancient Forests more mysterious.:D

Sounds epic! Even like neanderthal caves would be cool too :cool:

ls612
Apr 09, 2013, 04:00 PM
Would it be possible to add improvements to the spawn sites. It would be the same as bonuses or terrains. I want to add in Lairs:evil: it is the only way I can figure of making the Ancient Forests more mysterious.:D

You could make spawn sites secondary features with no graphics potentially and then make Improvements that use those features as dependencies.

Dancing Hoskuld
Apr 09, 2013, 04:48 PM
You could make spawn sites secondary features with no graphics potentially and then make Improvements that use those features as dependencies.

I was going to use something similar but then I would have to destroy the feature when the improvement is destroyed.

AIAndy
Apr 10, 2013, 03:00 PM
Would it be possible to add improvements to the spawn sites. It would be the same as bonuses or terrains. I want to add in Lairs:evil: it is the only way I can figure of making the Ancient Forests more mysterious.:D
You can now use a SpawnCondition on the spawn infos for that kind of things. It is evaluated on the plot and the plot is only considered valid if the rest of the spawn info definitions fit as well (but you can now leave out bonus, terrain and feature definitions which previously would have been considered invalid).

EDIT: Of course the SpawnCondition can also be used to evaluate other stuff like properties on the plot and similar (so you could have a bandit spawn from high crime forest plots).