Spawn system

AIAndy

Deity
Joined
Jun 8, 2011
Messages
3,428
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?
 
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:
 
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?

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!
 
@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?

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???
 
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.
 
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.
 
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:
 
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?
 
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.
 
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.
 
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.
 
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.
 
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:
 
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.
 
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.
 
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.
 
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.
 
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).
 
Top Bottom