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

Custom scenario-defined terrain types #1641

Closed
kostmo opened this issue Nov 21, 2023 · 1 comment · Fixed by #1775
Closed

Custom scenario-defined terrain types #1641

kostmo opened this issue Nov 21, 2023 · 1 comment · Fixed by #1775
Assignees
Labels
C-Moderate Effort Should take a moderate amount of time to address. G-Design An issue having to do with game design. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Feature A new feature to be added to the game.

Comments

@kostmo
Copy link
Member

kostmo commented Nov 21, 2023

Currently, all terrain types are hard coded. There may be a use case for definitions in YAML and per-scenario extensibility as exists for Entities.

@kostmo kostmo added Z-Feature A new feature to be added to the game. G-Design An issue having to do with game design. labels Nov 21, 2023
@byorgey byorgey added S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. C-Moderate Effort Should take a moderate amount of time to address. labels Nov 21, 2023
@byorgey
Copy link
Member

byorgey commented Nov 21, 2023

Agreed, I created the existing terrain types in a very offhand sort of way and always kind of intended that there should be more, and customizable, terrain types in the future.

@kostmo kostmo self-assigned this Feb 20, 2024
kostmo added a commit that referenced this issue Feb 20, 2024
@mergify mergify bot closed this as completed in #1775 Feb 29, 2024
mergify bot pushed a commit that referenced this issue Feb 29, 2024
Closes #1641

The `data/terrain.yaml` file is now the authoritative source of terrains, though `BlankT` is still a hard-coded special case.

I have not changed the underlying integer representation of terrain in the world function, which means that the `terrainIndexByName` Map in the `TerrainMap` record is needed for translating between `Int` and `TerrainType`.

# Demo

    scripts/play.sh -i data/scenarios/Testing/1775-custom-terrain.yaml

![Screenshot from 2024-02-22 16-51-53](https://github.com/swarm-game/swarm/assets/261693/1d263c8b-4e9c-40bf-bdc8-bf5ba8e33c4d)

# Changes

* There used to be a function called `integrateScenarioEntities` that combined the `EntityMap` stored in the `Scenario` record with the global entity map.  However, the global entity map is accessible at parse time of the `Scenario`, so we do the combining there and only ever store the combined map in the `Scenario` record.
* JSON Schema for terrain
* Removed the distinction between "World" attributes and "Terrain" attributes
* Unit tests for scenario-defined terrain and related validations
    * Validate existence of referenced terrain at scenario parse time
    * Validate attributes referenced by terrains at parse time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Moderate Effort Should take a moderate amount of time to address. G-Design An issue having to do with game design. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Feature A new feature to be added to the game.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants