Opened 6 years ago
Closed 6 years ago
#5041 closed defect (fixed)
Sometimes nomad units aren't placed / SimpleObject maxFailCount can't be disabled
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 23 |
Component: | Maps | Keywords: | |
Cc: | Patch: |
Description
In some svn testgames we sometimes had a player that didn't spawn with all treasures or all units when spawned near the map border.
Change History (3)
comment:1 by , 6 years ago
Summary: | Sometimes nomad units aren't placed → Sometimes nomad units aren't placed / SimpleObject maxFailCount can't be disabled |
---|
comment:2 by , 6 years ago
About SimpleObject
:
The name maxFailCount
is misleading, since one would expect it to do the same as maxFailFraction
what placers have. But the groups variable is about retry counts, while the placer variable is about allowed only returning a subset of the desired area. The groups instance does return a number of locations >= minCount and <= maxCount.
About the nomad bug:
It should be the g_Map.validTile
check in SimpleObject
returning true for the map border being a good idea to place units. While this is true for actors, it's not for units with obstructions and unitMotion and those goodies.
The SimpleGroup
then silently drops the SimpleObject
when calling g_Map.placeEntityPassable
.
So the clean way to distinguish that would be to add yet another argument to SimpleObject
stating if it's an actor or not.
That argument could remain the last one and default to the entity
variant, while a SimpleActorObject
would default to true.
On the other hand, keeping that in sync costs effort and is prone to bugs.
In fact we can test if the thing starts with actor|
.
Initially I suspected it were the same as #4338, but reading the code it must be themaxFailCount = 20
argument ofSimpleObject.prototype.place
being fixed.Everynew SimpleObject
call I saw hasmaxCount < maxFailCount = 20
. So practically it'sInfinity
.This means that placing 0 entities can be considered successful! Testing it confirms that.(0 is only considered a valid placement ifminCount
is 0.)