-
Notifications
You must be signed in to change notification settings - Fork 550
Procedural Generation #37561
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
Draft
west3436
wants to merge
37
commits into
vgstation-coders:Bleeding-Edge
Choose a base branch
from
west3436:planetgen
base: Bleeding-Edge
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,471
−81
Draft
Procedural Generation #37561
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
c966569
first
west3436 c8eebde
inhale shiptest
west3436 59bed96
the beach episode
west3436 49c0a0d
snow beach desert xeno
west3436 8d7caab
Merge branch 'Bleeding-Edge' of https://github.com/vgstation-coders/v…
west3436 374026f
oops
west3436 858d994
lavaland
west3436 f9ef71b
Merge branch 'Bleeding-Edge' of https://github.com/vgstation-coders/v…
west3436 025af0f
lavaland again
west3436 966ca7f
lavaland the third
west3436 2a387ed
more
west3436 5f1c880
norock
west3436 840b965
a
west3436 f31cc03
Merge branch 'Bleeding-Edge' of https://github.com/vgstation-coders/v…
west3436 8b35eeb
daynight compat
west3436 ba912a1
sectors
west3436 6d173ad
loot progress
west3436 45d5cc7
gtfo
west3436 eaa779c
grass
west3436 047f7eb
Merge branch 'Bleeding-Edge' into planetgen
west3436 ebaf7c7
Jungle + desert enhancement
west3436 3bde237
big progress
west3436 9b1783f
start on weather
west3436 039de6e
urban
west3436 04f2a87
vault spawning
west3436 e55fe03
restructure loot tables
west3436 197de5a
consistency
west3436 f2b3a19
inital loot population
west3436 9980652
Revert "inital loot population"
west3436 e253935
loot spawning
west3436 70d4b8f
more loot
west3436 c32acd7
fix + scanner init
west3436 7d1c48d
GUI
west3436 228ffef
admin panel
west3436 0e44aa3
refactor
west3436 2148a96
more refactor
west3436 3f2dfe7
complete shuttle
west3436 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
///Map generation defines | ||
#define BIOME_LOWEST_HUMIDITY "biome_lowest_humidity" | ||
#define BIOME_LOW_HUMIDITY "biome_low_humidity" | ||
#define BIOME_MEDIUM_HUMIDITY "biome_medium_humidity" | ||
#define BIOME_HIGH_HUMIDITY "biome_high_humidity" | ||
#define BIOME_HIGHEST_HUMIDITY "biome_highest_humidity" | ||
|
||
#define BIOME_COLDEST "coldest" | ||
#define BIOME_COLD "cold" | ||
#define BIOME_WARM "warm" | ||
#define BIOME_TEMPERATE "perfect" | ||
#define BIOME_HOT "hot" | ||
#define BIOME_HOTTEST "hottest" | ||
|
||
#define BIOME_COLDEST_CAVE "coldest_cave" | ||
#define BIOME_COLD_CAVE "cold_cave" | ||
#define BIOME_WARM_CAVE "warm_cave" | ||
#define BIOME_HOT_CAVE "hot_cave" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#define RUINTYPE_SPACE "Space" | ||
#define RUINTYPE_LAVA "Lava" | ||
#define RUINTYPE_SNOW "Snow" | ||
#define RUINTYPE_SAND "Sand" | ||
#define RUINTYPE_JUNGLE "Jungle" | ||
#define RUINTYPE_ROCK "Rock" | ||
#define RUINTYPE_BEACH "Beach" | ||
#define RUINTYPE_WASTE "Waste" | ||
#define RUINTYPE_YELLOW "Yellow" | ||
#define RUINTYPE_XENO "Xeno" | ||
#define RUINTYPE_DESERT "Desert" | ||
#define RUINTYPE_WATER "Water" | ||
#define RUINTYPE_BATTLEFIELD "Battlefield" | ||
|
||
/// do not actually use this for your ruin type, this is for the ruintype_to_list proc | ||
#define RUINTYPE_EVERYTHING "Everything" | ||
|
||
// HEY LISTEN! | ||
// IF YOU ADD NEW A NEW RUIN TYPE | ||
// PLEASE MAKE SURE YOU ADD IT TO THE BELOW LIST AND PROC! | ||
|
||
#define RUINTYPE_LIST_ALL list(\ | ||
RUINTYPE_SPACE,\ | ||
RUINTYPE_LAVA,\ | ||
RUINTYPE_ICE,\ | ||
RUINTYPE_SAND,\ | ||
RUINTYPE_JUNGLE,\ | ||
RUINTYPE_ROCK,\ | ||
RUINTYPE_BEACH,\ | ||
RUINTYPE_WASTE,\ | ||
RUINTYPE_YELLOW,\ | ||
RUINTYPE_EVERYTHING) | ||
|
||
/* /proc/ruintype_to_list(ruintype) | ||
if(ruintype == RUINTYPE_EVERYTHING) | ||
return SSmapping.ruins_templates | ||
else | ||
return SSmapping.ruin_types_list[ruintype] */ | ||
|
||
/* | ||
Maps described in the catalogue must be described with at least one or more of the following tags. | ||
|
||
*Loot Summary | ||
Minor Loot = Has negligable/no loot at all, only contains fluff items or just the loot found from enemy drops or structures in the ruin. | ||
Medium Loot = Has a pool of loot that is useful for the average player or ship, but not in large amounts, and does not have more than one or two boss drops. | ||
Major Loot = Contains a large pool of loot useful to the average player or ship. Or includes more boss drops or necropolis loot than there are challenges for. | ||
*/ | ||
#define RUIN_TAG_MINOR_LOOT "Minor Loot" | ||
#define RUIN_TAG_MEDIUM_LOOT "Medium Loot" | ||
#define RUIN_TAG_MAJOR_LOOT "Major Loot" | ||
|
||
/*Combat Summary | ||
No Combat = Contains no enemies or combat challenges. | ||
Minor Combat Challenge = Has only 1-2 hit melee mobs in small or moderate amounts. | ||
Medium Combat Challenge = Contains more than just simple low health melee mobs, or a moderate amount of mobs. | ||
Boss Combat Challenge = Contains either one or more bossmobs, has a large number of mobs that are either overwhelming or considerably challenging, or has a significant combat challenge overall. | ||
*/ | ||
#define RUIN_TAG_NO_COMBAT "No Combat" | ||
#define RUIN_TAG_MINOR_COMBAT "Minor Combat Challenge" | ||
#define RUIN_TAG_MEDIUM_COMBAT "Medium Combat Challenge" | ||
#define RUIN_TAG_HARD_COMBAT "Hard Combat Challenge" | ||
#define RUIN_TAG_BOSS_COMBAT "Boss Combat Challenge" | ||
|
||
|
||
/*Qualities | ||
Megafauna = Map contains one or more megafauna. | ||
Antag Gear = Map contains one or more items typically only obtainable by antag roles. | ||
Necropolis Loot = Map contains an item or chest from the necropolis loot pool. | ||
Liveable = The entirety of the map is inhabitable without protective gear, and the map is not surrounded by an inhospitable environment. | ||
Inhospitable = The majority of the map is uninhabitable without protective gear, and the map is not surrounded by a hospitable environment. | ||
Shelter = The map contains a portion that is hospitable without protective gear, with a surrounding section that is inhospitable. Or the map is an enclosed hospitable space that spawns on an inhospitable planet. | ||
Bad Shelter = The map contains a portion that is inhospitable without protective gear, with a surround section that is hospitable. Or the map is an enclosed inhospitable space that spawn on a hospitable planet. | ||
No Content = A map that contains no objects. It contains only turfs, walls, and or areas. | ||
Hazardous = Contains hazardous environment elements. Elements include but are not limited to: Mines, IEDs, Chasms appearing more than twice or more than once if one is 3x3 or more, disease spawns, beartraps. | ||
Unknown Details = Something about the map can't be checked with a map editor alone, and has not been tested for confirmation yet. | ||
Lava = Contains lava or liquid plasma tiles. | ||
Ghost Role = Contains a ghost role. | ||
*/ | ||
#define RUIN_TAG_MEGAFAUNA "Megafauna" | ||
#define RUIN_TAG_LIVEABLE "Liveable" | ||
#define RUIN_TAG_INHOSPITABLE "Inhospitable" | ||
#define RUIN_TAG_SHELTER "Shelter" | ||
#define RUIN_TAG_BAD_SHELTER "Bad Shelter" | ||
#define RUIN_TAG_NO_CONTENT "No Content" | ||
#define RUIN_TAG_HAZARDOUS "Hazardous" | ||
#define RUIN_TAG_UNKNOWN_DETAILS "Unknown Details" | ||
#define RUIN_TAG_LAVA "Lava" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// Subsystem for things such as vaults, away mission init, and procgen. | ||
|
||
var/datum/subsystem/mapping/SSmapping | ||
|
||
|
||
/datum/subsystem/mapping | ||
name = "Map" | ||
init_order = SS_INIT_MAP | ||
flags = SS_NO_FIRE | ||
|
||
///All possible biomes in assoc list as type || instance | ||
var/list/biomes = list() | ||
|
||
/datum/subsystem/mapping/New() | ||
NEW_SS_GLOBAL(SSmapping) | ||
|
||
|
||
/datum/subsystem/mapping/Initialize(timeofday) | ||
if (config.enable_roundstart_away_missions) | ||
log_startup_progress("Attempting to generate an away mission...") | ||
createRandomZlevel() | ||
|
||
var/watch | ||
if (!config.skip_fixedvault_generation) | ||
watch = start_watch() | ||
log_startup_progress("Placing fixed space structures...") | ||
generate_fixedvaults() | ||
log_startup_progress("Finished placing fixed structures in [stop_watch(watch)]s.") | ||
else | ||
log_startup_progress("Not generating fixed vaults - SKIP_VAULT_GENERATION found in config/config.txt") | ||
|
||
if (!config.skip_vault_generation) | ||
watch = start_watch() | ||
log_startup_progress("Placing random space structures...") | ||
generate_vaults() | ||
generate_asteroid_secrets() | ||
make_mining_asteroid_secrets() // loops 3 times | ||
log_startup_progress("Finished placing structures in [stop_watch(watch)]s.") | ||
else | ||
log_startup_progress("Not generating vaults - SKIP_VAULT_GENERATION found in config/config.txt") | ||
|
||
//hobo shack generation, one shack will spawn, 1/3 chance of two shacks | ||
generate_hoboshack() | ||
if (rand(1,3) == 3) | ||
west3436 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
generate_hoboshack() | ||
|
||
watch = start_watch() | ||
for(var/datum/zLevel/z in map.zLevels) | ||
var/watch_prim = start_watch() | ||
z.post_mapload() | ||
log_debug("Finished with zLevel [z.z] in [stop_watch(watch_prim)]s.", FALSE) | ||
log_debug("Finished calling post on zLevels in [stop_watch(watch)]s.", FALSE) | ||
|
||
watch = start_watch() | ||
map.map_specific_init() | ||
log_debug("Finished map-specific inits in [stop_watch(watch)]s.", FALSE) | ||
|
||
spawn_map_pickspawners() //this is down here so that it calls after allll the vaults etc are done spawning - if in the future some pickspawners don't fire, it's because this needs moving | ||
|
||
watch = start_watch() | ||
initialize_biomes() | ||
log_startup_progress("Finished initializing biomes in [stop_watch(watch)]s.") | ||
|
||
..() | ||
|
||
/proc/generate_planet()//debug | ||
return SSmapping.spawn_planetoid(/datum/planet_type/snow, /datum/map_element/mining_surprise/crashed_tradeship) | ||
|
||
///Initialize all biomes, assoc as type || instance | ||
/datum/subsystem/mapping/proc/initialize_biomes() | ||
for(var/biome_path in subtypesof(/datum/biome)) | ||
var/datum/biome/biome_instance = new biome_path() | ||
biomes[biome_path] += biome_instance | ||
|
||
/datum/subsystem/mapping/proc/spawn_planetoid(datum/planet_type/planet_datum, ruin_type) | ||
var/datum/planetGenerator/mapgen = new planet_datum.mapgen | ||
var/datum/map_element/mining_surprise/used_ruin = ispath(ruin_type) ? (new ruin_type) : ruin_type | ||
message_admins("Generating turfs") | ||
world.maxz += 1 | ||
map.addZLevel(new /datum/zLevel/away, world.maxz, TRUE, TRUE) | ||
mapgen.generate_turfs(map.zLevels.len) | ||
|
||
//DEBUG needs less hardcoding | ||
for(var/x = 1, x < 102, x++) | ||
west3436 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var/turf/T = locate(x,101,world.maxz) | ||
T.ChangeTurf(/turf/unsimulated/border) | ||
for(var/y = 1, y < 102, y++) | ||
var/turf/T = locate(101,y,world.maxz) | ||
T.ChangeTurf(/turf/unsimulated/border) | ||
|
||
|
||
var/list/ruin_turfs = list() | ||
var/list/ruin_templates = list() | ||
if(used_ruin) | ||
var/turf/ruin_turf = locate( | ||
rand( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit ugly. Why not have intermediate variables ? var/ruin_turf_x = rand(11, 100-used_ruin.width-6 - 11) // Why not -17 ?
var/ruin_turf_y = (100-used_ruin.width-6 - 11)
var/turf/ruin_turf = locate(ruin_turf_x, ruin_turf_y, world.maxz) |
||
11, | ||
100-used_ruin.width-6 - 11 | ||
), | ||
100-used_ruin.height-6 - 11, | ||
world.maxz | ||
) | ||
message_admins("Generating ruin at [ruin_turf.x], [ruin_turf.y], [world.maxz]") | ||
used_ruin.load(ruin_turf.x, ruin_turf.y, world.maxz, 0, TRUE, TRUE, 1, world.maxx-11, 11, world.maxy-11, 11, world.maxz-11) | ||
ruin_turfs[used_ruin.name] = ruin_turf | ||
ruin_templates[used_ruin.name] = used_ruin | ||
|
||
// fill in the turfs, AFTER generating the ruin. this prevents them from generating within the ruin | ||
// and ALSO prevents the ruin from being spaced when it spawns in | ||
// WITHOUT needing to fill the reservation with a bunch of dummy turfs | ||
message_admins("Populating turfs") | ||
mapgen.populate_turfs() | ||
|
||
return world.maxz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//Collection of areas used only for procgen. | ||
|
||
/area/planetoid/beach | ||
name = "Beach" | ||
requires_power = 0 | ||
dynamic_lighting = 1 | ||
flags = CAVES_ALLOWED|NO_PERSISTENCE|FLORA_ALLOWED|MOB_SPAWN_ALLOWED | ||
|
||
/area/planetoid/cave | ||
name = "Cave" | ||
requires_power = 0 | ||
dynamic_lighting = 1 | ||
flags = CAVES_ALLOWED|NO_PERSISTENCE|FLORA_ALLOWED|MOB_SPAWN_ALLOWED | ||
|
||
/area/planetoid/desert | ||
name = "Desert Planetoid" | ||
requires_power = 0 | ||
dynamic_lighting = 1 | ||
flags = CAVES_ALLOWED|NO_PERSISTENCE|FLORA_ALLOWED|MOB_SPAWN_ALLOWED | ||
|
||
/area/planetoid/snow | ||
name = "Frozen Planetoid" | ||
requires_power = 0 | ||
dynamic_lighting = 1 | ||
flags = CAVES_ALLOWED|NO_PERSISTENCE|FLORA_ALLOWED|MOB_SPAWN_ALLOWED | ||
|
||
/area/planetoid/xeno | ||
name = "Xeno Planetoid" | ||
requires_power = 0 | ||
dynamic_lighting = 1 | ||
flags = CAVES_ALLOWED|NO_PERSISTENCE|FLORA_ALLOWED|MOB_SPAWN_ALLOWED |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use a global list ? In fact I'm pretty sure it'd be a lot more efficient to have one global list (or a
static
list on a datum) shared by all procs than just instantiate a new list everytime you need it. You don't appear to even use this ?