forked from shiptest-ss13/Shiptest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mapgen fixes and speedups (ignore the branch name. I'm dumb) (shiptes…
…t-ss13#1637) ## About The Pull Request Alters the structure of map/planet generation to squash some bugs and improve performance. Previously, planet maps were generated by placing the ruin first, and THEN generating the turfs according to the map_generator datum. This has been adjusted -- now, turfs are generated WITHOUT objects such as mobs/flora, the ruin is placed, and THEN the objects are added (turfs are "populated"). In conjunction with the addition of needed AfterChange() calls to update the atmos adjacency of the generated turfs, this ensures that planet atmos acts correctly surrounding ruins. When deleting reservations (such as the deletion of planets after undocking), all objects on the planet are rounded up in a list and qdeleted. Although this causes a small lag spike, it SHOULD prevent items from hanging out inside the edges of planets. There's a feature to change the default baseturf of a virtual level, ZTRAIT_BASETURF, that we now use. This should cut down on the instances where a ruin on a planet is blown up and there's space underneath (might still happen on asteroids, because the baseturf there is still space; I didn't want space turfs without space as their baseturf). Overmap encounter areas aren't global anymore (they no longer have the flag UNIQUE_AREA). Don't fucking add the flag UNIQUE_AREA to anything that should have weather in it, because if that area gets added anywhere else that _actually respects the flag_ you'll end up with cross-planet weather, because weather code sucks. This didn't cause bugs before, because the flag wasn't respected; it will now. The biome assoc list has been moved into the map generator datum, and all encounters now generate using a map generator that either uses a biome or replaces everything with a single turf. This prevents duplication of cave generation code and makes dynamic overmap object code slightly easier to understand. Some systems have been altered to improve performance; many of these changes are rather small, like the changes to turf population (mob placement now uses a stack of recently-created mobs to check if there are any nearby, instead of checking everything within 12 turfs; I've yet to add ruin mobs to these stacks to avoid placing mobs near ruin mobs) or lighting objects (removed a single line that changed the color of the lighting object on init). Starlight has been altered, so that small turf changes near space turfs don't need to check as many nearby turfs and so that large turf changes can be batched to prevent further recalculation. This is probably responsible for the biggest performance increase. Smoothing groups are cached before sorting instead of after, to prevent sort calls on many atom inits; /tg/station uses a unit test to avoid needing to sort at runtime ever, but I couldn't figure out how to do that without larger changes or writing a unit test that attempted to instance every atom once, which would be an undertaking of its own. Gas strings have been similarly altered, and now their interpretation defaults to copying from a cached, immutable version of the mix encoded by the string. This avoids the significant overhead caused by repeated calls to params2list(). Auxmos has a better solution to this, __auxtools_parse_gas_string(), but our current custom build of Auxmos doesn't support it. There are a few other small changes that I'm probably forgetting about and you should yell at me to read my own fucking code and tell you what else I changed. - [ ] I affirm that I have tested all of my proposed changes and that any issues found during tested have been addressed. I still need to manually check each planet type to make sure they aren't fucked up, I should probably do some proper profiling comparisons. ## Why It's Good For The Game Fewer weird bugs, things generate faster, better* code. ## Changelog :cl: fix: Ruins don't sometimes start in hard vacuum anymore; planet turfs now share atmos correctly. fix: There hopefully shouldn't be any random stray objects sitting in the edges of planets anymore. fix: Planets now (hopefully) have the correct baseturfs (more or less). When you bomb a ruin on a planet, it probably won't break through to space anymore. refactor: Planet generation has been refactored, improving performance somewhat. /:cl:
- Loading branch information
Showing
64 changed files
with
1,448 additions
and
1,354 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
#define CHANGETURF_DEFER_CHANGE 1 | ||
#define CHANGETURF_IGNORE_AIR 2 // This flag prevents changeturf from gathering air from nearby turfs to fill the new turf with an approximation of local air | ||
#define CHANGETURF_FORCEOP 4 | ||
#define CHANGETURF_SKIP 8 // A flag for PlaceOnTop to just instance the new turf instead of calling ChangeTurf. Used for uninitialized turfs NOTHING ELSE | ||
#define CHANGETURF_INHERIT_AIR 16 // Inherit air from previous turf. Implies CHANGETURF_IGNORE_AIR | ||
#define CHANGETURF_RECALC_ADJACENT 32 //Recalc adjacent or not | ||
/// Defers call of proc AfterChange in ChangeTurf. | ||
#define CHANGETURF_DEFER_CHANGE (1 << 0) | ||
/// This flag prevents changeturf from gathering air from nearby turfs to fill the new turf with an approximation of local air | ||
#define CHANGETURF_IGNORE_AIR (1 << 1) | ||
/// Prevents ChangeTurf from returning without an operation if the given path and baseturfs are identical to the pre-existing ones and the preloader is not engaged. | ||
#define CHANGETURF_FORCEOP (1 << 2) | ||
/// A flag for PlaceOnTop to just instance the new turf instead of calling ChangeTurf. Used for uninitialized turfs NOTHING ELSE | ||
#define CHANGETURF_SKIP (1 << 3) | ||
/// Inherit air from previous turf. Implies CHANGETURF_IGNORE_AIR | ||
#define CHANGETURF_INHERIT_AIR (1 << 4) | ||
/// Defers smoothing and starlight recalculation in ChangeTurf so that they may later be more performantly done in bulk. | ||
#define CHANGETURF_DEFER_BATCH (1 << 5) | ||
|
||
#define IS_OPAQUE_TURF(turf) (turf.directional_opacity == ALL_CARDINALS) |
This file contains 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 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 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 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 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 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 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
Oops, something went wrong.