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

Externalizing strategic map secrets #1262

Merged
merged 4 commits into from
Oct 15, 2020

Conversation

ja2-derek
Copy link
Member

@ja2-derek ja2-derek commented Oct 14, 2020

This PR externalizes (#665) map secrets to JSON data files. Map secrets in base game are: Tixa, Orta and the 4 SAM sites. They are hidden at the start of game, and revealed to the player by NPCs or when arriving at the sectors.

Summary

  • Moving the traversibility mapping (from string name to enum ID) to its own file
  • Extracting map secrets information from code:
    • Sector (as primary key); Map icon; Terrain land type string
  • Refactoring the sector description function (e.g. "Cambria Hospital", "Tixa Dungeon", "Farm, road")
    • Using the newly externalized data to determine land type for secret sectors
  • Generalizing map secrets and save games:
    • fFoundTixa is generalized as "1st non-SAM site secret"
    • fFoundOrta is generalized as "2nd non-SAM site secret"
    • SAM site secrets are now dynamically defined by JSON, so that a mod can have any number of hidden SAM sites
    • NPC actions and quests still have direct references to TIXA and ORTA

Limitations and assumptions

  • The "is secret found?" state of only the first 2 secrets and SAM sites are saved - to fit fFoundTixa and fFoundOrta. A mod can define more but state persistence will not handled by the base game.
    • Some possibilities are: changing field from BOOLEAN to bitset, or allowing Lua scripts to write extra data to saves.
  • There is at most one secret per sector
  • A secret town can only have 1 town sector

Possible use-cases

These should be feasible, but not tested. Testing was done with vanilla data

  • Replacing map secrets with other secret facilities on the map, and with new icons
  • SAM sites that are known on game start (SAM sites without corresponding secret)
  • Hide Estoni, until some NPC tells you about it
  • Make the random weapon cache a map secret - that can be revealed by quests or NPCs
  • Enabling PATCH106

Testing

  • Save/load of secret revealed states (Tixa, Orta and SAM sites)
  • Revealing of secrets by NPC
  • Revealing of secrets by visiting
  • Sector string in bottom-right, saves and strategic map pop-up

Map secrets are facilities and towns unknown to player at gaem start, for the player to discover.
Map secrets are now defined in JSON. Tixa and Orta are generalized as the 1st and 2nd non-SAM map secret.

Refactored and changed sector land type description logic to use the map secret models.

Map secrets in vanilla base game are: Tixa, Orta and the 4 SAM sites.
@ja2-derek ja2-derek added the externalization Extracting hard-coded data to externalized files label Oct 14, 2020
@ja2-derek ja2-derek force-pushed the externalize-map-secrets branch 3 times, most recently from b6220a4 to 7aa5575 Compare October 15, 2020 02:42
This is for mods so that they can define a secret for land type string
only and without an icon.
@selaux
Copy link
Member

selaux commented Oct 15, 2020

LGTM. Thanks.

@selaux selaux merged commit bae4a7e into ja2-stracciatella:master Oct 15, 2020
@ja2-derek ja2-derek deleted the externalize-map-secrets branch October 15, 2020 07:00
@lynxlynxlynx lynxlynxlynx added this to the v0.18 milestone Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
externalization Extracting hard-coded data to externalized files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants