CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.73k stars 4.21k forks source link

JSONifying mapgen & Bountysource #21207

Closed Toothspit closed 7 years ago

Toothspit commented 7 years ago

Came up in IRC, probably not the first time. We want to post a big ol' fat bounty on JSONifying some of mapgen_functions, but aren't sure on the best way to go about it. There also aren't, to my knowledge, any issues for a JSONification PR to close. And if I can be real for second, those mapgen functions are godawful to read when you're trying to do something like #21192.

This issue is merely to establish consensus on how to handle bounties for projects like this: since Bountysource doesn't appear to support Github's -[ ] task lists nor Projects, we would have to make a separate issue for each mapgen function to be JSONified to preserve credit for the bounty. Is this acceptable, or is there a better method we didn't know about?

1skandar commented 7 years ago

I'm working on it. I'm kinda waiting for my first PR to be merged before moving on to the rest. Now I know what I'm doing, more or less, single tile buildings won't take more than 2 or 3 hours each.

ZhilkinSerg commented 7 years ago

The major PITA is multiple tile overmaps and its savegame compatibility.

Coolthulhu commented 7 years ago

we would have to make a separate issue for each mapgen function to be JSONified to preserve credit for the bounty

Sounds fine to me. Those specials are huge - for example, prison is over 1k lines.

Leland commented 7 years ago

Yup, multiple issues and then probably a project to associate them all. It's the same thing that was done for the Z-index feature.

ZhilkinSerg commented 7 years ago

There are only 16 buildings left in the mapgen_functions.cpp save for specials like sewer, roads, subways, rivers, caves, etc.

More is in mapgen.cpp:

ZhilkinSerg commented 7 years ago

Buildings with computers cannot be jsonized until #20770 will be merged.

ZhilkinSerg commented 7 years ago

Some of the buildings (like mil_surplus) are generated in random sizes - it is not possible to directly reimplement them in json now, but probably lua_mapgen can be used.

Leland commented 7 years ago

@ZhilkinSerg yeah, I'd noticed that! Do we feel that it's good to keep those randomly generated buildings, or should we transition them to static JSON structures?

Doing so would mean we lose out on the dynamic nature that the current hardcoded implementation brings, but we'd have a much more manageable (and standardized) codebase as a result.

1skandar commented 7 years ago

The big one is going to be the lab. Individual rooms won't be hard, but I'm not even sure how, or even if, the current JSON format can put it together correctly.

ZhilkinSerg commented 7 years ago

Example of lua mapgen: https://www.dropbox.com/s/pm8rpd1bhkhu9f5/cdda_lua_mapgen_example.zip?dl=0

Replaces dojo building with lua-generated house.

Also see http://smf.cataclysmdda.com/index.php?topic=14258.0.

Leland commented 7 years ago

Do note https://github.com/CleverRaven/Cataclysm-DDA/issues/20819, though.

We probably won't want to move map generation to be dependent on tech that's being sunsetted.

ZhilkinSerg commented 7 years ago

I guess LUA won't be removed if it will be actually used.

ZhilkinSerg commented 7 years ago

mil_surplus mapgen in LUA: https://www.dropbox.com/s/3gn2p4sgmt5gdmz/cdda_mapgen_mil_surplus.zip?dl=0

Please don't afraid excess amount of loot - i didn't add check for loot spawn chances yet.

kevingranade commented 7 years ago

I guess LUA won't be removed if it will be actually used.

Incorrect, there is still not a compelling case for LUA, and I don't intend to accept any new LUA functionality.

A note on the mapgen/bountysource issue. One, you probably do need to post separate bounties on separate chunks of mapgen.

ZhilkinSerg commented 7 years ago

Four overmaps converted to LUA - https://www.dropbox.com/s/rlgitvrk9hoo49r/cdda_lua_mapgen_v2.zip?dl=0:

ZhilkinSerg commented 7 years ago

LUA mapgen has major drawback - it seems that lua-generated buildings aren't automatically rotated. There is possibly a workaround with using overmap_specials.json, but I didn't find it yet.

EDIT: Actually is is possible - see #21738.

kevingranade commented 7 years ago

Question seems to have been answered, closing.