这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ashleynewson
Copy link
Contributor

@ashleynewson ashleynewson commented Jan 10, 2025

Adds map generator support for CnC (all tilesets), largely on par with RA.

Most tilesets do not have a complete set of beach templates and therefore do not support terrain settings involving water. DESERT is the only tileset supporting water. Unlike in RA, water is not playable space in CnC (no naval units), so only terrain settings with small bodies of water are available.

Most changes are configuration (tileset and map generator config), with just a small number of code changes.

Depends on #21700

@ashleynewson
Copy link
Contributor Author

Note that this PR currently contains the changes of #21700. I recommend #21700 be merged first separately, and I will then rebase.

@ashleynewson ashleynewson force-pushed the ashleynewson/random-map-cnc-pr branch from 8ce7676 to b102921 Compare January 11, 2025 00:09
@dragunoff
Copy link
Contributor

Note that this PR currently contains the changes of #21700. I recommend #21700 be merged first separately, and I will then rebase.

Our convention is to add a "Depends on #21700" to the PR description to signal that. And then there is a label that someone with permissions can add.

@ashleynewson ashleynewson force-pushed the ashleynewson/random-map-cnc-pr branch from b102921 to 2559e58 Compare January 11, 2025 13:56
Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In snowy maps we generate way too much snow. It's usually used quite sparingly.

Unless one picked the overgrown or woodlands gen type, I think all the details are too sparce. Incase enclosed areas are generated with the onstruct option, then there may be enough details.

Usually a lot of the details in TD are added through actors and rivers and roads. And the current generator adds roads very sparingly and lacks a lot of the actors. No rivers as well

On temparate tileset generation can become very slow, something is getting bottlenecked?

Beach errors are quite common. You can also crash the game by choosing bounds in water

@ashleynewson
Copy link
Contributor Author

ashleynewson commented Jan 11, 2025

In snowy maps we generate way too much snow. It's usually used quite sparingly.

I should be able to adjust that using MultiBrush weights.

I think all the details are too sparce.

Fixing this starts getting into another set of non-trivial code changes, but the extra details could equally benefit RA maps. As such, it might be better to do the detail adding in a separate PR. (I'd propose a later PR, because then you can then at least test CnC skirmishes.)

Some ideas:

  • Rivers have a complete set of templates to work with, so they might not be too problematic. I could potentially use rivers in place of beaches for the otherwise waterless tilesets (or maybe also additionally for DESERT). I could filter out loops if moats-like rivers look a bit weird. Bridging over them is a non-trivial change, though.
  • Another option is to add rivers in a similar way to cliffs, though I'd have to introduce tiling errors and cover them up with trees. (Though, this is a common map-making technique for CnC's tileset limitations.)
  • I could add civilian buildings and civilians, perhaps biased around roads or their "junctions". Maybe using MultiBrush.
  • I could try making road laying more aggressive. The path tiling algorithm is probably more capable of road laying than it was when I initially started, so I can probably tweak a few settings.

On temparate tileset generation can become very slow, something is getting bottlenecked?

Can you quantify this? (Map size?, Generator settings?, Time taken?)

I'm aware of a O(actor_count**2) slowdown after generation when it's copying actors over to the map, which can be very significant for large tree-dense maps. EditorActorLayer.NextActorName() being the relevant bottleneck.

Beach errors are quite common.

I can probably tweak some things to relax the tiling constraints here or stricten the inputs to tiling.

You can also crash the game by choosing bounds in water

I don't know what that means. Can you share with me repro steps, logs, screenshots/video perhaps?

@ashleynewson
Copy link
Contributor Author

You can also crash the game by choosing bounds in water

Wait, I'm being dumb I know what you mean!

@ashleynewson
Copy link
Contributor Author

On temparate tileset generation can become very slow, something is getting bottlenecked?

EditorActorLayer.NextActorName() being the relevant bottleneck.

Having done some recent profiling, I'm not sure if this is likely to be the bottleneck in your case. I think it only applies to very very large maps. However, EditorActorLayer.Add and EditorActorLayer.Remove are, in general, quite slow.

Here is some left-heavy profiling of a few generations of 128x128 Rocky and Overgrown maps. Note that the repeated generation during the same editor instance consumes significant time to remove actors as well as adding them.

image

Zoomed in on the blitting:
image

  • The editor blitting outweighs the actual map generation.
  • EditorActorLayer.UpdateNeighbours is expensive.

My understanding is that these costs are editor-specific and won't apply to any maps generated directly via some skirmish UI, so might be somewhat unimportant in future.

@ashleynewson
Copy link
Contributor Author

Beach errors are quite common.

Turns out there was a bug I introduced during one of my many refactors! I have created a PR for the fix: #21704

@ashleynewson
Copy link
Contributor Author

the current generator adds roads very sparingly

#21705 should fix that.

Adds map generator support for CnC (all tilesets), largely on par with
RA.

Most tilesets do not have a complete set of beach templates and
therefore do not support terrain settings involving water. DESERT is the
only tileset supporting water. Unlike in RA, water is not playable space
in CnC (no naval units), so only terrain settings with small bodies of
water are available.

Most changes are configuration (tileset and map generator config), with
just a small number of code changes.
@ashleynewson ashleynewson force-pushed the ashleynewson/random-map-cnc-pr branch from 395f88f to 3b7d43b Compare January 18, 2025 19:39
Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this was quite the improvement

@PunkPun PunkPun merged commit 2126f3c into OpenRA:bleed Jan 20, 2025
2 checks passed
@PunkPun
Copy link
Member

PunkPun commented Jan 20, 2025

changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants