Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#4814 closed defect (fixed)

Consistently exclude invalid mapborder tiles from rmgen

Reported by: elexis Owned by: elexis
Priority: Should Have Milestone: Alpha 23
Component: Maps Keywords:
Cc: Patch:

Description

There are three tiles near the map border that cannot be passed nor explored (and thus are always black).

That magic number is hardcoded in the pathfinder, rangemanager and rmgen (MAP_BORDER_WIDTH), see #4636.

The SimpleObject and its duplicate RandomObject have place functions that do not account for the map border. So the SimpleGroup place function calling these assumed the object was placed while it actually wasn't. This does not show any noticeable bug in alpha 22 yet. But if we add a retry loop for starting resources on maps that place the players very close to the map border (like Danubius on the tiny mapsize, or the Oasis replay in #4796), it will ensure that the starting resources are actually placed.

validT(x, y, dist) should return true, if the given coordinates are at least dist tiles within the valid region of tiles. So it should be the responsability of that function and not of each caller to apply that constant.

Change History (5)

comment:1 by elexis, 7 years ago

Resolution: fixed
Status: assignedclosed

In 20283:

Fix rmgen2 SimpleObject and RandomObject ignoring the 3 invalid map border tiles.
Let validT take the responsability to account for the actually valid region of map tiles instead of each caller.

Fixes #4814, refs #4636, #4796

comment:2 by elexis, 7 years ago

In 20286:

Fix incorrectly replaced unrelated magic number in rP20283, refs #4814.

comment:3 by elexis, 7 years ago

Similar work in #4012.

While all calls to validT do exclude these 3 tiles, there are placers which do not but should use validT, see Phab:rP14183#inline-688

This can be fixed by removing the duplicate code by just calling the copy, see Phab:rP9388.

Last edited 7 years ago by elexis (previous) (diff)

comment:4 by elexis, 6 years ago

In 20439:

Tidy up rmgen point location randomization and retry loops.

Remove retryPlacing args helperobject by making use of the hoisting effect.
Remove the deprecation warning in retryPlacing and equally and the unused behaveDeprecated argument from createAreas and createAreasInAreas, refs #4294, rP19929, D249.

Rename randomizePlacerCoordinates to randomizeCoordinates and placer to group in the four createObjectGroups functions following rP17728,
because Groups aren't Placers (as established in rP20355), just share the randomizable x/z properties.

Fix randomizeCoordinates on square maps offering entity locations outside of the passable map area that are only rejected later in the codeflow, missed first in rP14183, but also rP18450 and rP20283, refs #4012, #4814.
Clarify randomizeCoordinates by passing a boolean stating whether to include the impassable map border instead of a varying halfMapSize.
Remove the unused halfMapSize argument from the randomizePlacerCoordinatesFromAreas call in createAreasInAreas.

comment:5 by elexis, 6 years ago

In 20472:

On both Deep Forest (rP11444) and Schwarzwald (rP15327) random maps, replace the copy of the magic number approximating the engine constant specifying the impassable map border tiles with a passability check from the library. Refs #4814, #4805.
Remove the duplication of the subsequent createArea call as in rP20301.

Note: See TracTickets for help on using tickets.