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

(Ready) Region settings (playable wip) + jsonized shop lists + jsonized grass_or_dirt (biomes wip) + dynamic option values #5134

Merged

Conversation

Projects
None yet
6 participants
@atomicdryad
Copy link
Contributor

commented Dec 19, 2013

This is part of a larger overmap overhaul with the eventual goal of an overmap of overmaps (regionmap), and the introduction of coastlines, biomes, watersheds, and various spatial traits for demographics (human, criitter, and other).. I've forced myself to stop and pr before going on a fix_roads_and_by_roads_i_mean_sewers tangent, and think it best this is done in stages anyway. This pr adds:

  • 100% json adding of shops and parks (and speedboost)
  • region_settings: a compiled list of spatially relevent variables for overmap and map, including the jsonization of hard-coded forest and swamp variables, shop/park weight lists, and at the mapen level a jsonization of grass_or_dirt and shrub population (in a 'desert' region, all mapgens apply sand and tumbleweed instead of grass and dirt, mutated poppy plants are mutated cacti, and rubble is more commmon than shrubs)
  • dynamic option values from json: specifically the new START_REGION option.

The TODO is a mile long, however this pr is fully operational and should add variety to the game, if manually (vs geographically)

  • jsonize/regionalize overmap specials and spawn groups, leaving them as-is but open to future improvement
  • add recipes for generate_sub's ot_above logic to overmap_terrain entries
  • jsonize/regionalize more overmap landscape generation stuff: city size ( retaining option as a modifier or making it override 'default' ), rivers, subways/sewers
  • jsonize/regionalize forest flora.
  • jsonize/regionalize weather.
  • add region modifiers to mon/item groups ( fungus population affected by wetness of climate )
  • quantify region settings:
    • climate ( wetness, temperature, weather)
    • biome ( flora/fauna, forest % and forest flora/fauna)
    • demographics ( economy, population, culture )
    • catacylsm ( zombie/npc/monster population, vulcanism, flooding, anomalies, etc )
  • start on regionmap which generates coastlines / mountain ranges / rivers / actual cities and the above values, and provides region_settings to overmap. Ideally biomes and such are smoothed out. An ascii map will also be generated, however stuff would be rather silly as giant 4x4 kilometer overmap squares so basing things on vectors seems the way to go.

Suggestions/thoughts?

atomicdryad added some commits Dec 16, 2013

struct region_settings: Holds spatially relevent overmap variables. L…
…oads from json, populating a list of suggested defaults, which

  will eventually be provided to the overmap by a regional/over-overmap. (currently there is only 'default';
  semi-rural North West USA with scattered temperate forest biome.
* stores jsonized variables relevent to overmap generation:
  * forest and swamp variables
  * "house_basement_chance": one_in(?) house : house_base (default 2)
  * shop() weightlist jsonized and sped up. Uses oter_t.rotates instead of hard-coded rotate-everything-but-s_lot.
  * parks moved to another weightlist, replacing hard-coded one_in(5) ? pool : park
  * The voodoo constants used to radially determine shop/park/house zoning are jsonized. Variables remain obtuse
    until a way to make them friendlier without breaking stuff is determined.
  * todo: more stuff. oter_specials, etc
* stores jsonized variables relevent to mapgen (pointer stashed in mapgendata)
  * struct id_or_id default_groundcover replaces grass_or_dirt. Default is the same as grass_or_dirt:
    ( one_in(4) ? t_dirt : t_grass ). In a desert region/biome one_in(10) ? t_sand : t_grass or such would fit better.
  * struct plant_coverage abstracts the builtin 'field' mapgen, determining shrub frequency and type
    as percentages.

overmap:
  * see above
  * corrected oter_t.rotates
  * oterr_weight_list moved to header, stores string id as well as int id, set post-json/pre-game
  * global obasetermap["string"] takes "example" and spits out the base oter_t ("example", "example_north" for rotates,
    "example_ns" for line_drawing tiles, etc
struct id_or_id: specification for custom grass_or_dirt / dirt_or_pil…
…e / tomato_or_tomato.

set via id_or_id(str primary, int chance, str secondary), or (int,int,int)
int .get() returns one_in(chance) ? secondary : primary
bool .match(int) compares both
map: added fill/square functions that use id_or_id
mapdata: stash ptr to map and region_setting, add convenience functions
terfurn_tile: rename to ter_furn_id, move to mapdata.h
id_or_id: byte align struct, removing *_str into str_or_str temporary holding
  struct
Merge remote-tracking branch 'origin/master' into region_traits-ep01-…
…the_quickening

Conflicts:
	src/map.h
	src/mapgen.cpp
	src/mapgen_functions.cpp
	src/mapgenformat.cpp
	src/overmap.cpp
optionsdata class to allow adding string option values during json in…
…it. Also add "DEFAULT_REGION"

  option.
* executed via optionsdata.add_value("OPTION_NAME", "value", "optional value txt");
* handles de-clobbering values that are not builtin, if the value is added later
  ( the game loads options (and sets default for invalid options) before data_init)
overmap: support DEFAULT_REGION option for new overmaps, and save/loa…
…d the region

  settings id so players can choose another region for the next overmap, and there
  isn't a magical game-wide transformation of forests into deserts or such.
Add test_regions.json to demonstrate standalone regions and shop lists;
  region desert_test: A barren area near the Salton Sea that was half
    abandoned even before civilization went south.
  terrain t_searth_test: scorched earth
  furniture t_mutcactus_test: mutated cactus. It's like mutated poppy, only not.
  oterrain t_restaurant_deserted_test: yet-another-fast-food-joint, only the food and
    any hope of such is long gone.
@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Dec 19, 2013

Oh wow so much wow. Can't wait.

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Dec 19, 2013

I like everything about this.

@dwarfkoala

This comment has been minimized.

Copy link

commented Dec 20, 2013

You are a saint, you know that?

@duskgao

This comment has been minimized.

Copy link

commented Dec 20, 2013

awesome!!

@kevingranade

This comment has been minimized.

Copy link
Member

commented Dec 23, 2013

Looks awesome overall, but all the shelters are being generated overrun with cacti?
Also craters have odd square borders of all dirt, not sure if that's a change actually, just noticed it's happening.

std::vector<std::pair<std::string, std::string> > vPages;
std::map<int, std::vector<std::string> > mPageItems;
std::map<std::string, std::string> optionNames;
int iWorldOptPage;

options_data::options_data() {

This comment has been minimized.

Copy link
@kevingranade

kevingranade Dec 23, 2013

Member

Does this have anything to do with the PR as a whole? If it's disabled it seems like it doesn't.
If it's unrelated please PR seperately.

@dwarfkoala

This comment has been minimized.

Copy link

commented Dec 23, 2013

Shelters being overrun with... Cacti?

Cacti? This sounds really exciting.

@atomicdryad

This comment has been minimized.

Copy link
Contributor Author

commented Dec 24, 2013

  • In desert_test region, mutcactus_test can occasionally cluster in high numbers like berry bushes do. You might have had a lucky(?) dice roll. If they're actually in the shelter or such please clarify; that shouldn't happen.
  • Craters always had square dirt borders; they're more noticeable in desert_test (and should be dat.ground_cover() (fixed)
  • options_data() is required for the 'default region' option to work; options are initialized and loaded before init. I was tempted to refactor options but managed to stop myself.
@kevingranade

This comment has been minimized.

Copy link
Member

commented Dec 25, 2013

Sorry I was unclear, the terrain in and around the shelter was all being set to cactus.
I wasn't able to trace it to where it was happening.

@atomicdryad

This comment has been minimized.

Copy link
Contributor Author

commented Dec 26, 2013

Found the issue, fixed in #5212
equivalent fix for oter_t part of pending overmap optimize / road fix pr (not applicable to this)

@kevingranade

This comment has been minimized.

Copy link
Member

commented Dec 26, 2013

Cool, I'll take a look at merging this and the fix asap, because it looked
good other than that.

@kevingranade kevingranade merged commit 4a5f749 into CleverRaven:master Dec 27, 2013

1 check passed

default
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.