Common Errors and/or Crashes Section

Status
Not open for further replies.
Sounds good.
The main reason for the way I did it was that it used a value already computed for each area so it comes pretty cheap (not sure if there is anything like that on a per unit type basis).
If we go with two tags and add further players then that would allow to balance spawns a lot better.

Just pushed to SVN:

  • Fixed total area density setting overwriting local density setting
  • Made total area density that of the specific unit type the spawn defines
  • Fixed the global defines override being set to 0 crashing instead of fully inhibiting the spawn

The 'any barbarian' interpretation and the 'specific unit type' interpretation are now compile-time switchable via a single define. The specific unit variation has to pre-calculate some extra totals because, as you say, CvArea doesn't do it for us, but it does this as a one-off pass shared between all spawn instances so it amortises out quite cheap.

@EldrinFal - let us know what you want in terms of these two interpretations, and also if you want any extended functionality such as grouping multiple spawns for density calculation purposes
 
  1. The code that AIAndy added for totalAreaDensity is broken and the net effect is to use the total area density number as the LOCAL density, which means the Neanderthal spawns will keep pumping out Neanderthals as long as there is less than 1 per 10 tiles around the spawn points, irrespective of the total numbe in the wider area
  2. The specified local density in the Neanderthal spawn info seems wrong (and would result in too FEW Neanderthlas), but this isn't having any effect anyway due to (1)
  3. The spawn rates from iTurns and iGlobalTurns are addative, so if both are used you're effectively getting the sum of the rates from using one or the other. Currently the Neanderthal spawns use both - this is fine but the numbers likely need to be toned down
  4. The third wave is specified as spawning Neanderthals from any forest tile, but it doesn't have any lower a per-tile rate than the bonus-restricted waves!! In your game this means each of 1624 tiles can spawn a Neadnerthal with a probability (after game speed adjustments) of about 1 in 40 from wave 3 - so over 40 per turn

I will fix (1), and leave Eldrin (who tuned the XML) to retune it.

@Eldrin - iMaxLocalDensity is currently set to 48 (so max of 1 in 48 tiles locally) and almost certainly needs to be lower (else no spawns will occur if more than 1 Neanderthal already exists within 3 tiles of the spawn point). Wave 3 almost certainly needs MUCH increased iTurns (since the contribution from iTurns dominates totally with a large number of possible spawn points, over that from iGlobalTurns which adjusts for the number of spawn points)

I intended the density to be low like that because the Neanderthals don't sit in the area they spawn in. Typically they move towards cities and start to cluster there, whether that means during an invasion in Raging or to sit around the borders in normal play. I just don't think there needs to be additional spawning when a Neanderthal already exists within 3 tiles of another one.

The issue is that they spawn and move away. So one area may have 100 of them and then 10 tiles away there are 0. So they will continue to spawn in that 0 area. This is why I used AIAndy's Area density of just 10, thinking that would limit them to 10 on a landmass.

I hate to ask for a different variable, but what I think would work best is something like the local density within an Area, where the value set = the number of tiles in an Area in which 1 Neanderthal will spawn. That way, smaller landmasses produce less, and large landmasses make more.

Example: A value of 10 would mean that for every 10 tiles in that Area, 1 Neanderthal has a chance to spawn on the specified spawn locations. This combined with a working Area maximum I think would achieve the correct results.
 
I intended the density to be low like that because the Neanderthals don't sit in the area they spawn in. Typically they move towards cities and start to cluster there, whether that means during an invasion in Raging or to sit around the borders in normal play. I just don't think there needs to be additional spawning when a Neanderthal already exists within 3 tiles of another one.

The issue is that they spawn and move away. So one area may have 100 of them and then 10 tiles away there are 0. So they will continue to spawn in that 0 area. This is why I used AIAndy's Area density of just 10, thinking that would limit them to 10 on a landmass.

I hate to ask for a different variable, but what I think would work best is something like the local density within an Area, where the value set = the number of tiles in an Area in which 1 Neanderthal will spawn. That way, smaller landmasses produce less, and large landmasses make more.

Example: A value of 10 would mean that for every 10 tiles in that Area, 1 Neanderthal has a chance to spawn on the specified spawn locations. This combined with a working Area maximum I think would achieve the correct results.

that would be pretty easy. However, it still might be a bit skewed. Imagine a large landmass that has only a few of the relevant resources and they happen to be clustered. The largeness of the landmass would then cause the one localized area to spam out units at a high rate, potentially disadvantaging the nearby players even more than would be the case without the area normalization.

The thing that urgently needs adjustment is the iTurns value for Neanderthal wave 3. Either increase it quite a lot, or simply do away with it and just have the iGlobalTurns value (which auto adjusts for the number of spawn points)
 
that would be pretty easy. However, it still might be a bit skewed. Imagine a large landmass that has only a few of the relevant resources and they happen to be clustered. The largeness of the landmass would then cause the one localized area to spam out units at a high rate, potentially disadvantaging the nearby players even more than would be the case without the area normalization.

I don't see how the rate would be any worse. The % chance of spawn remains the same, there is merely a stop gap depending on the side of land mass. Any civ next to a "cluster" of Neanderthal spawn points is going to have a tough time anyway. I se the spawn points to be very different through each wave to mix up where they come from so no 1 civ should get picked on exclusively.

The thing that urgently needs adjustment is the iTurns value for Neanderthal wave 3. Either increase it quite a lot, or simply do away with it and just have the iGlobalTurns value (which auto adjusts for the number of spawn points)

I will adjust it now and stick I think with iGlobalTurns since it does adjust for the additional spawn points.
 
Reproduced your crash. The reason is that the barbarians have 8191 units, and that's the limit - it crashes when they try to create their 8192nd! Underlying this is that something strange must have happened to the animals and Neanderthal spawning in that game -the entire world is literally crawling with them.

I could up the limit, but at the cost of more memory usage and some performance penalty, but I think that misses the point. 8192 barbarian units in play on turn 485 seems a bit crazy, even with raging Barbs.

Having found that out I have now looked at the spawn code and the spawn definitiosn and I see several errors:

  1. The code that AIAndy added for totalAreaDensity is broken and the net effect is to use the total area density number as the LOCAL density, which means the Neanderthal spawns will keep pumping out Neanderthals as long as there is less than 1 per 10 tiles around the spawn points, irrespective of the total numbe in the wider area
  2. The specified local density in the Neanderthal spawn info seems wrong (and would result in too FEW Neanderthlas), but this isn't having any effect anyway due to (1)
  3. The spawn rates from iTurns and iGlobalTurns are addative, so if both are used you're effectively getting the sum of the rates from using one or the other. Currently the Neanderthal spawns use both - this is fine but the numbers likely need to be toned down
  4. The third wave is specified as spawning Neanderthals from any forest tile, but it doesn't have any lower a per-tile rate than the bonus-restricted waves!! In your game this means each of 1624 tiles can spawn a Neadnerthal with a probability (after game speed adjustments) of about 1 in 40 from wave 3 - so over 40 per turn

I will fix (1), and leave Eldrin (who tuned the XML) to retune it.

@Eldrin - iMaxLocalDensity is currently set to 48 (so max of 1 in 48 tiles locally) and almost certainly needs to be lower (else no spawns will occur if more than 1 Neanderthal already exists within 3 tiles of the spawn point). Wave 3 almost certainly needs MUCH increased iTurns (since the contribution from iTurns dominates totally with a large number of possible spawn points, over that from iGlobalTurns which adjusts for the number of spawn points)

If you care enough to want desperately to rescue this game you can probably get away with changing the global define in xml/assets/A_New_Dawn_GlobalDefines.xml as follows:

Code:
	<Define>
		<DefineName>NEANDERTHAL_SPAWN_MODIFIER</DefineName>
		<iDefineIntVal>1</iDefineIntVal>
	</Define>

Changing this value from 100 (the default) to 1 will cut Neanderthals spawns down 100 times (0 should turn it off but its bugged currently, which I'll also fix). That will PROBABLY allow the natural death rate to prevent the limit being hit in your current game, though obviously the save is already very close to it.

Willing to let go of this game as learning experience and go with normal Barbarians until you can come out with a patch.

Thank you,

Buck

BTW It was one hell of a fight up to the crash. Figure I killed a zillion Barbarians not to mention the animal units.
 
Ok now I cannot figure this out. River Port goes obsolete "Insurance" which is a Classical Era tech.

If I just follow one list of tech reqs backwards it goes ...

Submarine Warfare -> Military Science -> Scientific Method -> Printing Press -> Paper -> Guilds -> Insurance

The River Port should be obsolete.

I have no idea why you are getting the river port again. :(

As I said some time ago Insurance is not on my tech tree. I do not play with advanced economy and suspect that this option is needed for Insurance to be in game.
 
As I said some time ago Insurance is not on my tech tree. I do not play with advanced economy and suspect that this option is needed for Insurance to be in game.

Ah ok. Well I will just change it to go obsolete at Guilds then. Its one step after Insurance and should fix things if you have advanced economy off.

EDIT: Fixed and pushed to the SVN.
 
I don't see how the rate would be any worse. The % chance of spawn remains the same, there is merely a stop gap depending on the side of land mass. Any civ next to a "cluster" of Neanderthal spawn points is going to have a tough time anyway. I se the spawn points to be very different through each wave to mix up where they come from so no 1 civ should get picked on exclusively.



I will adjust it now and stick I think with iGlobalTurns since it does adjust for the additional spawn points.

Pushed a revised Neanderthal spawn. I had trouble using iGlobalTurns. I tried to remove iTurns completely and got an XML parse error on load, so tried setting iTurns to 0 (thinking that would turn it off) but it ended up spawning no Neanderthals at all.

So in the end I had to go with iTurns, though I left a setting for iGlobalTurns thinking maybe that would pop a random extra Neand now and again. MaxAreaTotalDensity does not seem to be working.

I must have done close to 10 autoplays up to 100 turns each. The animal spawning is pretty darn high, but maybe once we get a good set of values for the Neanderthals, that can be applied similarly to animals.
 
Pushed a revised Neanderthal spawn. I had trouble using iGlobalTurns. I tried to remove iTurns completely and got an XML parse error on load, so tried setting iTurns to 0 (thinking that would turn it off) but it ended up spawning no Neanderthals at all.

So in the end I had to go with iTurns, though I left a setting for iGlobalTurns thinking maybe that would pop a random extra Neand now and again. MaxAreaTotalDensity does not seem to be working.

I must have done close to 10 autoplays up to 100 turns each. The animal spawning is pretty darn high, but maybe once we get a good set of values for the Neanderthals, that can be applied similarly to animals.

Tell me about it I had a carpet of mandrills and cassowaries on an offshore island. Luckily I landed two hunters at the same time.
 
Pushed a revised Neanderthal spawn. I had trouble using iGlobalTurns. I tried to remove iTurns completely and got an XML parse error on load, so tried setting iTurns to 0 (thinking that would turn it off) but it ended up spawning no Neanderthals at all.

So in the end I had to go with iTurns, though I left a setting for iGlobalTurns thinking maybe that would pop a random extra Neand now and again. MaxAreaTotalDensity does not seem to be working.

I must have done close to 10 autoplays up to 100 turns each. The animal spawning is pretty darn high, but maybe once we get a good set of values for the Neanderthals, that can be applied similarly to animals.
0 for iTurns should work. What values for iGlobalTurns did you try?

EDIT: Checked the spawn info:
<iGlobalTurns>25</iGlobalTurns>
That would mean a very, very low global spawn rate as it would only spawn a single neanderthal on average every 25 turns in the entire world.
For Neanderthals you probably want to use something like 1 or so. Maybe I should change it to a float so you have some better ways to adjust it in the area that matters.
 
Missing graphic for Zebra?

EDIT: ART_DEF_UNIT_ZEBRA requires donkey.nif, but there isn't the file in art/units/zebra.
EDIT: What does zebra.nif do? I tried it and tiny white dot showed up in pedia screen after I changed.
 
Willing to let go of this game as learning experience and go with normal Barbarians until you can come out with a patch.

Thank you,

Buck

BTW It was one hell of a fight up to the crash. Figure I killed a zillion Barbarians not to mention the animal units.

Yeh, but boy WHAT a great commander you had!
 
0 for iTurns should work. What values for iGlobalTurns did you try?

EDIT: Checked the spawn info:
<iGlobalTurns>25</iGlobalTurns>
That would mean a very, very low global spawn rate as it would only spawn a single neanderthal on average every 25 turns in the entire world.
For Neanderthals you probably want to use something like 1 or so. Maybe I should change it to a float so you have some better ways to adjust it in the area that matters.

Just scale it by 100 and document that fact (so its really iGlobalTurnsTimes100).
 
0 for iTurns should work. What values for iGlobalTurns did you try?

EDIT: Checked the spawn info:
<iGlobalTurns>25</iGlobalTurns>
That would mean a very, very low global spawn rate as it would only spawn a single neanderthal on average every 25 turns in the entire world.
For Neanderthals you probably want to use something like 1 or so. Maybe I should change it to a float so you have some better ways to adjust it in the area that matters.

I had the value much lower when I was trying to use it. Like 5-10. But when I set iTurns to 0, I wasn't getting Neanderthals. Only animals. So in the end I used iTurns and then set iGlobalTurns to 25 to act as a kind of wild card spawn that might appear.

It's really tough to make sense of some of the density values. I think something a bit more straightforward would be easier for people to understand. I have a little programming experience in my background and took some advanced math courses, but even I have trouble wrapping my head around some of those tags. Granted, it's been 15 years or so since those days.

Some tags that I think would be more intuitive would be..
- A percentage chance setting that operates per bonus resource on the map. A setting of 10% means that for each possible spawn point, there is a 10% chance the specific unit will spawn there. But only if the density values qualify, i.e. LocalDensity setting, AreaDensity, etc.
- The max density ratio setting I mentioned before where the value determines how many maximum units can exist on an Area dependent on Area size. So Max Units allowed in Area = 1 per X. If set to 10, that means 1 allowed per 10 tiles in that Area. So it would auto adjust for land mass size.
 
- A percentage chance setting that operates per bonus resource on the map. A setting of 10% means that for each possible spawn point, there is a 10% chance the specific unit will spawn there. But only if the density values qualify, i.e. LocalDensity setting, AreaDensity, etc.
That is what iTurns does: An iTurns of 10 means a 10% chance per spawn point, an iTurns of 20 means a 5% chance per spawn point. It is just inverse.
- The max density ratio setting I mentioned before where the value determines how many maximum units can exist on an Area dependent on Area size. So Max Units allowed in Area = 1 per X. If set to 10, that means 1 allowed per 10 tiles in that Area. So it would auto adjust for land mass size.
That is exactly what the area density limit does (it is inverse to a real density). If you set it to 10, then 1 spawn of the unit type is allowed per 10 tiles in the area.

iGlobalTurns of 5 still only means that you get 1 spawn per 5 turns on the entire map. That means after 50 turns there will still be only about 10 Neanderthals.
I will go with Koshling's suggestion and assume the multiplication by 100 so a value of 100 will do what 1 does now.
I will also add a separate tag for the unit type area density so you can specify both.
 
That is what iTurns does: An iTurns of 10 means a 10% chance per spawn point, an iTurns of 20 means a 5% chance per spawn point. It is just inverse.

That is exactly what the area density limit does (it is inverse to a real density). If you set it to 10, then 1 spawn of the unit type is allowed per 10 tiles in the area.

iGlobalTurns of 5 still only means that you get 1 spawn per 5 turns on the entire map. That means after 50 turns there will still be only about 10 Neanderthals.
I will go with Koshling's suggestion and assume the multiplication by 100 so a value of 100 will do what 1 does now.
I will also add a separate tag for the unit type area density so you can specify both.

That is a lot of inversion. :crazyeye:

As I said, I was doing 100 turn autoplays and when I had iTurns at 0, and the Global turns at 10, for example, I didn't see Neanderthals. And wave 1 spawns them on hills, flood plains, and some other features, so I would think there would be more.

For the max density setting, I had it at 10 - 12 initially and was getting way more. In fact, I think it was set at that value for stock v18, so it wasn't quite working. If that has been fixed, I will give it another go in testing tonight.
 
That is a lot of inversion. :crazyeye:

As I said, I was doing 100 turn autoplays and when I had iTurns at 0, and the Global turns at 10, for example, I didn't see Neanderthals. And wave 1 spawns them on hills, flood plains, and some other features, so I would think there would be more.

For the max density setting, I had it at 10 - 12 initially and was getting way more. In fact, I think it was set at that value for stock v18, so it wasn't quite working. If that has been fixed, I will give it another go in testing tonight.
Pushed the changes I mentioned to the SVN. iGlobalTurns is now given times 100 (so what previously was 1 is now 100).
Unit type area density limit and total area density limit are now separate tags.
I also set the Neanderthals to only spawn from iGlobalTurns and it works. Give it a try.
 
Pushed the changes I mentioned to the SVN. iGlobalTurns is now given times 100 (so what previously was 1 is now 100).
Unit type area density limit and total area density limit are now separate tags.
I also set the Neanderthals to only spawn from iGlobalTurns and it works. Give it a try.

Don't forget to update the modder's doc thread ;)
 
Pushed the changes I mentioned to the SVN. iGlobalTurns is now given times 100 (so what previously was 1 is now 100).
Unit type area density limit and total area density limit are now separate tags.
I also set the Neanderthals to only spawn from iGlobalTurns and it works. Give it a try.

I want to have an understanding of this so bear with me...

So iGlobalTurns of 100 now means every turn 1 unit will spawn somewhere in the world, regardless of number of spawn points?
 
Status
Not open for further replies.
Back
Top Bottom