Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutable special chunk placement #52056

Merged

Conversation

jbytheway
Copy link
Contributor

@jbytheway jbytheway commented Oct 2, 2021

Summary

Infrastructure "Add support for chunks in mutable overmap specials"

Purpose of change

Sometimes when designing a mutable overmap special it's difficult to deal with the fact that certain OMTs might be placed without space for others that ought to go with them.

Describe the solution

To work around this, allow a placement rule to place multiple OMTs together in a chunk. This ensures that there is sufficient space for all of them and their joins, or none will be placed at all. This makes the placement an all-or-nothing scenario, and we don't end up with unresolved joins due to half-placed pieces of the special.

I reverted #52007 (i.e. reinstated the placement errors) since those issues should now be solvable.

Solve the overmap placement issues with the mutable microlab. In the process of doing so I introduced some issues with the tile-level mapgen which I don't fell qualified to solve. @John-Candlebury perhaps you can fix those in a follw-up PR. In particular:

  • The microlab_generic_hallway_end mapgen is backwards and needs to be flipped 180°.
  • I added hallway_blind_tee, hallway_blind_straight and hallway_blind_curve overmaps in the special, which are potentially needed to cope with some obscure corner cases, but they are using the mapgen for their non-blind variants. They might need new / altered mapgen.

Describe alternatives you've considered

Currently you need to define each OMT of the chunk separately in the special definition and then refer to them all in the placement rules as a chunk. This isn't ideal, but it does reflect the implementation. It would be nicer if a chunk could be defined in a similar manner to an overmap, but I think that can be added later as a QoL feature.

I haven't documented this yet. I hope to write those docs soon, but I wanted to get this PR out ASAP to help fix the microlab spawn issues. Documentation now written and pushed.

Testing

I made a new test special test_microlab which uses this feature to solve the spawning issues the existing mutable microlab has had. Like the other test specials, it is able to survive 10000 attempted spawns in the test run.

Additional context

Here's an example of a mutable microlab which spawned as intended:
mutable-microlab-succeeded
Here's the sort of thing that can go wrong, but this failure is now handled gracefully. Here one corridor ran into the mine on the left, which led to some extra corridor off to the side. To resolve this without very verbose mapgen requires support for alternate joins, which is the next feature I plan to work on.
mutable-microlab-failed

This reverts commit 8dd958e.

The infrastructure needed to re-enable these warnings should now be in
place.
It will help a lot with mutable overmap special design if a rule can
place multiple overmaps together in a chunk.

This attempts to implement that.  It entails a significant rewrite of
the guts of overmap special placement.

Add a test_microlab special to test this new feature.
A few tweaks to the mutable microlab to ensure that it doesn't suffer
unresoved join errors:

* Place the subway section as a single chunk.
* Have more blind hallway segments for obscure corner cases.
@Maleclypse Maleclypse added <Enhancement / Feature> New features, or enhancements on existing Map / Mapgen Overmap, Mapgen, Map extras, Map display labels Oct 3, 2021
@kevingranade kevingranade merged commit df9180c into CleverRaven:master Oct 3, 2021
@jbytheway jbytheway deleted the mutable_special_chunk_placement branch October 4, 2021 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Enhancement / Feature> New features, or enhancements on existing Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants