Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c966569
first
west3436 May 7, 2025
c8eebde
inhale shiptest
west3436 May 9, 2025
59bed96
the beach episode
west3436 May 9, 2025
49c0a0d
snow beach desert xeno
west3436 May 10, 2025
8d7caab
Merge branch 'Bleeding-Edge' of https://github.com/vgstation-coders/v…
west3436 May 27, 2025
374026f
oops
west3436 May 27, 2025
858d994
lavaland
west3436 Jun 4, 2025
f9ef71b
Merge branch 'Bleeding-Edge' of https://github.com/vgstation-coders/v…
west3436 Jun 4, 2025
025af0f
lavaland again
west3436 Jun 4, 2025
966ca7f
lavaland the third
west3436 Jun 6, 2025
2a387ed
more
west3436 Jul 7, 2025
5f1c880
norock
west3436 Jul 21, 2025
840b965
a
west3436 Jul 30, 2025
f31cc03
Merge branch 'Bleeding-Edge' of https://github.com/vgstation-coders/v…
west3436 Jul 30, 2025
8b35eeb
daynight compat
west3436 Jul 30, 2025
ba912a1
sectors
west3436 Aug 1, 2025
6d173ad
loot progress
west3436 Aug 22, 2025
45d5cc7
gtfo
west3436 Aug 22, 2025
eaa779c
grass
west3436 Aug 30, 2025
047f7eb
Merge branch 'Bleeding-Edge' into planetgen
west3436 Aug 30, 2025
ebaf7c7
Jungle + desert enhancement
west3436 Aug 30, 2025
3bde237
big progress
west3436 Aug 30, 2025
9b1783f
start on weather
west3436 Aug 31, 2025
039de6e
urban
west3436 Sep 3, 2025
04f2a87
vault spawning
west3436 Sep 3, 2025
e55fe03
restructure loot tables
west3436 Sep 4, 2025
197de5a
consistency
west3436 Sep 4, 2025
f2b3a19
inital loot population
west3436 Sep 4, 2025
9980652
Revert "inital loot population"
west3436 Sep 5, 2025
e253935
loot spawning
west3436 Sep 5, 2025
70d4b8f
more loot
west3436 Sep 5, 2025
c32acd7
fix + scanner init
west3436 Sep 7, 2025
7d1c48d
GUI
west3436 Sep 8, 2025
228ffef
admin panel
west3436 Sep 9, 2025
0e44aa3
refactor
west3436 Sep 14, 2025
2148a96
more refactor
west3436 Sep 14, 2025
3f2dfe7
complete shuttle
west3436 Sep 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions __DEFINES/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@

#define islarva(A) istype(A, /mob/living/carbon/alien/larva)

#define ishostile(A) (istype(A, /mob/living/simple_animal/hostile))

#define iszombie(A) istype(A, /mob/living/simple_animal/hostile/necro/zombie)

#define isslime(A) (istype(A, /mob/living/carbon/slime) || istype(A, /mob/living/simple_animal/slime))
Expand Down
7 changes: 7 additions & 0 deletions __DEFINES/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
#define NO_MESONS 4
#define NO_PERSISTENCE 8
#define NO_PACIFICATION 16 //no pillowbug cheese for you

//planetgen flags
#define CAVES_ALLOWED 32
/// If flora are allowed to spawn in this area randomly through tunnel generation
#define FLORA_ALLOWED 64
/// If mobs can be spawned by natural random generation
#define MOB_SPAWN_ALLOWED 128
18 changes: 18 additions & 0 deletions __DEFINES/map.dm
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"
87 changes: 87 additions & 0 deletions __DEFINES/ruins.dm
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(\
Copy link
Collaborator

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 ?

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"
4 changes: 3 additions & 1 deletion __DEFINES/setup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ var/MAX_EXPLOSION_RANGE = 32
//turf-only flags
#define NOJAUNT 1
#define NO_MINIMAP 2 //Invisible to minimaps (fuck minimaps)

#define CAN_BE_DIRTY_1 4 // If a procgen turf can be made dirty at roundstart. This is also used in areas.
#define NO_LAVA_GEN_1 8 // Blocks lava rivers being generated on the turf
#define NO_RUINS_1 16 // Blocks ruins spawning on the turf

//slots
#define slot_back 1
Expand Down
35 changes: 35 additions & 0 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,41 @@

return L[L.len]

/// Takes a weighted list (see above) and expands it into raw entries
/// This eats more memory, but saves time when actually picking from it
/proc/expand_weights(list/list_to_pick)
var/list/values = list()
for(var/item in list_to_pick)
var/value = list_to_pick[item]
if(!value)
continue
values += value

var/gcf = greatest_common_factor(values)

var/list/output = list()
for(var/item in list_to_pick)
var/value = list_to_pick[item]
if(!value)
continue
for(var/i in 1 to value / gcf)
output += item
return output

/// Takes a list of numbers as input, returns the highest value that is cleanly divides them all
/// Note: this implementation is expensive as heck for large numbers, I only use it because most of my usecase
/// Is < 10 ints
/proc/greatest_common_factor(list/values)
var/smallest = min(arglist(values))
for(var/i in smallest to 1 step -1)
var/safe = TRUE
for(var/entry in values)
if(entry % i != 0)
safe = FALSE
break
if(safe)
return i

//Pick a random element from the list and remove it from the list.
/proc/pick_n_take(list/L)
if(L.len)
Expand Down
58 changes: 0 additions & 58 deletions code/controllers/subsystem/init/map.dm

This file was deleted.

114 changes: 114 additions & 0 deletions code/controllers/subsystem/mapping.dm
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)
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++)
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(
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
2 changes: 1 addition & 1 deletion code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var/area/space_area
var/obj/effect/narration/narrator = null
var/holomap_draw_override = HOLOMAP_DRAW_NORMAL

flags = 0
flags = CAVES_ALLOWED

/area/New()
area_turfs = list()
Expand Down
31 changes: 31 additions & 0 deletions code/modules/procedural mapping/planetGenerator/area.dm
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
Loading
Loading