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

Grow map bounds to accommodate placed structures #1780

Closed
kostmo opened this issue Mar 2, 2024 · 0 comments · Fixed by #1826
Closed

Grow map bounds to accommodate placed structures #1780

kostmo opened this issue Mar 2, 2024 · 0 comments · Fixed by #1826
Labels
Z-Developer Experience This issue seeks to make life easier for developers writing Scenarios or other Swarm code. Z-Feature A new feature to be added to the game.

Comments

@kostmo
Copy link
Member

kostmo commented Mar 2, 2024

Currently, "structures" may be placed only inside the bounds of their parent map rectangle. Otherwise, they will be cropped to the parent bounds.

This is problematic if we want to place structures at great distances from each other; currently, it would require that an explicit cell grid of great size be included in the YAML file.

Design

The truncating behavior that is the status quo should be preserved as the default.
A new property of the placement object in YAML named truncate could default to True. When overridden to False, structures that are overlaid atop a base structure will enlarge its area instead of being truncated.

Importantly, the "origin" must be made consistent in the base structure, when multiple substructures are to be overlaid upon it. I think that the current behavior is that the upper left cell is treated as the origin. If one of the substructure placements happens to enlarge the area to the left, this could move the origin and mess up subsequent placements.

@kostmo kostmo added Z-Feature A new feature to be added to the game. Z-Developer Experience This issue seeks to make life easier for developers writing Scenarios or other Swarm code. labels Mar 2, 2024
mergify bot pushed a commit that referenced this issue Apr 29, 2024
Split the `Structure.hs` module in preparation for #1780.  This refactoring entails no functional change.

# Also included
* follow-up to #1804 to remove REPL re-exports
* reformat `swarm.cabal` for the latest version of `cabal-gild`
@mergify mergify bot closed this as completed in #1826 May 26, 2024
mergify bot pushed a commit that referenced this issue May 26, 2024
Closes #1780.

This change allows "child" structures to be placed outside of the bounds of their "parent" map.  Until now, any child structures that exceed the bounds of their parent were simply truncated.

# Demo
```
scripts/play.sh -i data/scenarios/Testing/1780-structure-merge-expansion/structure-composition.yaml
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-Developer Experience This issue seeks to make life easier for developers writing Scenarios or other Swarm code. Z-Feature A new feature to be added to the game.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant