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

List of hard-coded mapgen functions to be moved to JSON #21824

Closed ZhilkinSerg closed 6 years ago

ZhilkinSerg commented 7 years ago

There are a lot of hardcoded mapgen functions still in the code which should be moved out of CPP to JSON (or LUA):

This issue is aimed to track what functions are left to be jsonized.

Randomization can be implemented in LUA right now, but it is not an option for non-LUA builds.

Merged (as of 2018-01-05):

To be merged (as of 2018-01-05):

Not ready (possibly need randomization in JSON):

Not ready (most certainly need randomization in JSON)

Should be left in code (and probably need rework):

Ant-related:

Basement and houses:

Fungal:

Lab:

Mine:

River:

Road:

Sewer:

Spider:

Subway:

Triffid:

Other

Further progress tracking is moved to https://discourse.cataclysmdda.org/t/14736.

vache commented 7 years ago

fema, fema_entrance; hospital, hospital_entrance; mansion, mansion_entrance; megastore, megastore_entrance

These all make heavy use of randomization as implemented now. It will be next to impossible to duplicate their current functionality in JSON.

outpost;

I'm assuming this is the military outpost, in which case, it also uses a lot of random layouts, though it often generates very poorly and a more static layout is probably more desirable.

Coolthulhu commented 7 years ago

I could help with the randomization, but I'd need to know how should the interface look like to be usable.

ZhilkinSerg commented 7 years ago

I could help with the randomization, but I'd need to know how should the interface look like to be usable.

Thanks. Can you talk @kevingranade out of axing LUA? ;)

Seriously, that is the only way to keep random stuff in its current state when moving it out of hardcode. If you look through the hardcoded mapgen code most of random stuff is:

It is very easy to transfer most of such code from cpp to lua (actually I did it for several buldings and can say it was pretty easy). It will be very awkward to have it implemented in json: we need to implement several functions in JSON which are already in LUA (a more powerful tool), so why bothering with reimplementation?

Also lua is very good for post-processing of generated buildings: @vache wanted to implement such modifications in #7892 and actually I would like to either revive this PR or move it to dda-lua.

ZhilkinSerg commented 7 years ago

These all make heavy use of randomization as implemented now. It will be next to impossible to duplicate their current functionality in JSON.

There was very good approach for random layouts of overmap specials in Mansion Upgrade Project.

I believe we can use it for hospital, megastore, mansion, fema and similar multi-tile facilities. We probably don't even need any extra code - only some work with json maps to make tile connect properly.

vache commented 7 years ago

It should be possible to easily recreate a lot of the random aspects, at least of the FEMA camp and mansion by simply using alternate omts in the special definitions for them. So, instead of following the fema_entrance/fema pattern, follow the school_1_1, school_1_2, school_1_3 etc. pattern, and having multiple mapgens for each of the _1_1, _1_2 variants, and just ensuring that the linkages to adjacent overmaps always line up.

ZhilkinSerg commented 7 years ago

It should be possible to easily recreate a lot of the random aspects, at least of the FEMA camp and mansion by simply using alternate omts in the special definitions for them. So, instead of following the fema_entrance/fema pattern, follow the school_1_1, school_1_2, school_1_3 etc. pattern, and having multiple mapgens for each of the _1_1, _1_2 variants, and just ensuring that the linkages to adjacent overmaps always line up.

Yes, the only issue here is editing maps to fix linking to adjacent tiles.

vache commented 7 years ago

Also lua is very good for post-processing of generated buildings: @vache wanted to implement such modifications in #7892 and actually I would like to either revive this PR or move it to dda-lua.

I tried to rez that branch a little while back and never really made any major progress with it, my notes on it are still up though, https://github.com/vache/Cataclysm-DDA/issues/15

kevingranade commented 6 years ago

No recent progress, and issue scope is over-large. Please track this kind of thing in a wiki or forum post.

ZhilkinSerg commented 6 years ago

No recent progress, and issue scope is over-large.

May I disagree with the first statement? There are two huge PRs waiting to be merged: #22366 and #22543. The latter is just two weeks old.

ZhilkinSerg commented 6 years ago

Please track this kind of thing in a wiki or forum post.

Moved progress tracking to https://discourse.cataclysmdda.org/t/14736