Opened 2 years ago

Closed 2 years ago

#6422 closed defect (fixed)

Often no passable path on unknown map with 2 players

Reported by: Langbart Owned by: Langbart
Priority: Should Have Milestone: Alpha 26
Component: Maps Keywords:
Cc: Patch: Phab:D4457

Description (last modified by Langbart)

A problem was noticed by rollieoo on a certain map, both opponents cannot reach each other.

to reproduce

  • Set up a game
    • Player: 2
    • Maptype: Random
    • Map: Unknown
    • Landscape: Passes
  • try to get your units across the mountain, often this won't work

example:

~/0ad/binaries/system/pyrogenesis -conf=mod.enabledmods:"mod public" -quickstart -autostart="random/unknown" -autostart-seed=1563851758  -autostart-size=256 -autostart-player=-1

bisect

  • It was not possible for me to find the changeset number.
  • In a quick test in A24b, the mountain was overcomeable, but if you try a few times, the problem could also occur there.
  • The problem also occurs in A23b.

solution (1)

A simple solution would be to adjust the map creation for 2 players || numPlayers == 2 so that there is always a lake in between.

Line 656 in Unknown.js

Line 
656 if (randBool(2/5) *|| numPlayers == 2*)
657 {
658 g_Map.log("Create central lake");
659 createArea(
660 new ClumpPlacer(diskArea(fractionToTiles(0.1)), 0.7, 0.1, Infinity, mapCenter),
661 [
662 new SmoothElevationPainter(ELEVATION_SET, waterHeight, 3),
663 new TileClassPainter(clWater)
664 ]);
665 }

input from elexis (1) (22/Jan/22)

[08:52:57] Langbart Hello, do you think the solution is good enough for https://trac.wildfiregames.com/ticket/6422 ?
[...]
[10:34:17] elexis making a lake is certainly a possibility but it changes the map gameplay a lot
[...]
[10:44:32] elexis so I guess either the placer isnt returning an area or the painter isnt doing something to it
[10:45:24] elexis same with the "Fill area between the paths" part, also Im not sure why that one paints clWater there when there isnt any water, probably to have nothing else placed there, but thats often asking for bugs like fish on land
[10:45:57] elexis better would be to add a specific class clPassage and have all the remaining statements make sure not to place on clPassage (water and land alike), but (probably) unrelated
[...]
[10:49:12] elexis could also be that the passage is too small on the given mapsize or something
[10:49:27] elexis yeah that looks like it
[...]
[10:55:53] elexis but its probably a wrong parameter in the mapscript rather than a rmgen library bug, judging by the screenshot

solution (2)

Replace diskArea(fractionToTiles(0.05)) with 0. Line 666 in Unknown.js

Line 
666 else
667 {
668 g_Map.log("Fill area between the paths");
669 createArea(
670 new ClumpPlacer(*0*, 0.7, 0.1, Infinity, mapCenter),
671 [
672 new SmoothElevationPainter(ELEVATION_SET, heightMountain, 4),
673 new TileClassPainter(clWater)
674 ]);
675 }

input from elexis (2) (22/Jan/22)

[13:18:07] elexis so the problem is first it places the passage through the middle then it places the mountain in the middle blocking the passage
[...]
[13:19:23] elexis then the bug was probably introduced in the first version of the map

solution (3) by elexis

[13:25:51] elexis you add an if (n != 2)
[13:26:22] // Dont block the passage we just created if the passage goes through the center

Attachments (3)

unknown_passes.jpg (194.8 KB ) - added by Langbart 2 years ago.
unknown_passes_lake.jpg (151.9 KB ) - added by Langbart 2 years ago.
diskArea.jpg (305.6 KB ) - added by Langbart 2 years ago.

Download all attachments as: .zip

Change History (7)

by Langbart, 2 years ago

Attachment: unknown_passes.jpg added

by Langbart, 2 years ago

Attachment: unknown_passes_lake.jpg added

comment:1 by Langbart, 2 years ago

Description: modified (diff)

add a new solution and input from elexis

by Langbart, 2 years ago

Attachment: diskArea.jpg added

comment:2 by Langbart, 2 years ago

Description: modified (diff)

issue was found, the map should not create a passage and then block it on numPlayers == 2

comment:3 by Langbart, 2 years ago

Owner: set to Langbart
Patch: Phab:D4457

added patch number

comment:4 by Stan, 2 years ago

Resolution: fixed
Status: newclosed

In 26578:

Fix unknown map: opponent being unreachable
Patch by: @elexis
Tweaks by: @Langbart, @marder
Fixes: #6422
Differential Revision: https://code.wildfiregames.com/D4457

Note: See TracTickets for help on using tickets.