Skip to content
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

Implement some basic benchmarking for seed generation #4353

Merged
merged 9 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
122 changes: 122 additions & 0 deletions soh/soh/Enhancements/presets.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum RandomizerPreset {
RANDOMIZER_PRESET_SPOCK_RACE_NO_LOGIC,
RANDOMIZER_PRESET_S6,
RANDOMIZER_PRESET_HELL_MODE,
RANDOMIZER_PRESET_BENCHMARK,
};

typedef struct PresetEntry {
Expand Down Expand Up @@ -1147,6 +1148,122 @@ const std::vector<PresetEntry> hellModePresetEntries = {
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), 2),
};

const std::vector<PresetEntry> BenchmarkPresetEntries = {
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Forest"), RO_FOREST_CLOSED_DEKU),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), RO_KAK_GATE_OPEN),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), RO_DOOROFTIME_SONGONLY),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), RO_ZF_CLOSED),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_DUNGEON_REWARDS),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RewardCount"), 5),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BridgeRewardOptions"), RO_BRIDGE_GREG_REWARD),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SET_NUMBER),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrialCount"), 6),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingAge"), RO_AGE_RANDOM),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"), RO_DUNGEON_ENTRANCE_SHUFFLE_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"), RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldEntrances"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleInteriorsEntrances"), RO_INTERIOR_ENTRANCE_SHUFFLE_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGrottosEntrances"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleWarpSongs"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixedEntrances"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DecoupleEntrances"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchusInLogic"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("TriforceHunt"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MQDungeons"), RO_MQ_DUNGEONS_RANDOM_NUMBER),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MQDungeonsSelection"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), RO_DUNGEON_REWARDS_END_OF_DUNGEON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LinksPocket"), RO_LINKS_POCKET_DUNGEON_REWARD),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_ANYWHERE),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_FOUR_ITEMS),
//RANDOTODO add refactored price/scrub/merchant settings
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBeehives"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCows"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleChildWallet"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinaButtons"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSwim"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossSouls"), RO_BOSS_SOULS_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuStickBag"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuNutBag"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Fishsanity"), RO_FISHSANITY_BOTH),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_ANYWHERE),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_MEDALLIONS),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsMedallionCount"), 6),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 4),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GossipStoneHints"), RO_GOSSIP_STONES_NEED_NOTHING),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HintClarity"), RO_HINT_CLARITY_CLEAR),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HintDistribution"), RO_HINT_DIST_STRONG),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("AltarHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanondorfHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SheikLAHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SariaHint"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FrogsHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("OoTHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BiggoronHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoesHint"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ChickensHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MalonHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HBAHint"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("WarpSongText"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubText"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("10GSHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("20GSHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("30GSHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("40GSHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("50GSHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MaskShopHint"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("InfiniteUpgrades"), RO_INF_UPGRADES_PROGRESSIVE),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkeletonKey"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ItemPool"), RO_ITEM_POOL_BALANCED),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IceTraps"), RO_ICE_TRAPS_NORMAL),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), RO_STARTING_OCARINA_FAIRY),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingDekuShield"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingKokiriSword"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMasterSword"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingConsumables"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FullWallets"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingZeldasLullaby"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingEponasSong"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingSariasSong"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingSunsSong"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingSongOfTime"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingSongOfStorms"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMinuetOfForest"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingBoleroOfFire"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingSerenadeOfWater"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingRequiemOfSpirit"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingNocturneOfShadow"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingPreludeOfLight"), RO_GENERIC_OFF),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingSkulltulaToken"), 0),
PRESET_ENTRY_S32("gRandomizeStartingHearts", 2),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("AllLocationsReachable"), RO_GENERIC_ON),
PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"), RO_GENERIC_ON),
};

typedef struct PresetDefinition {
const char* label;
const char* description;
Expand Down Expand Up @@ -1220,5 +1337,10 @@ const std::map<PresetType, PresetTypeDefinition> presetTypes = {
"All settings maxed but still using glitchless logic. Expect pain.",
hellModePresetEntries
} },
{ RANDOMIZER_PRESET_BENCHMARK, {
"Benchmark",
"Used for benchmarking the logic.",
BenchmarkPresetEntries
} },
} } }
};
39 changes: 38 additions & 1 deletion soh/soh/Enhancements/randomizer/3drando/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ static void RemoveStartingItemsFromPool() {

//This function will propagate Time of Day access through the entrance
static bool UpdateToDAccess(Entrance* entrance, bool propagateTimeTravel) {
auto ctx = Rando::Context::GetInstance();
ctx->StartPerformanceTimer(PT_TOD_ACCESS);

bool ageTimePropogated = false;

Expand Down Expand Up @@ -133,6 +135,7 @@ static bool UpdateToDAccess(Entrance* entrance, bool propagateTimeTravel) {
AreaTable(RR_ROOT)->childNight = AreaTable(RR_TOT_BEYOND_DOOR_OF_TIME)->adultNight;
}

ctx->StopPerformanceTimer(PT_TOD_ACCESS);
return ageTimePropogated;
}

Expand Down Expand Up @@ -360,6 +363,7 @@ void AddToPlaythrough(LocationAccess& locPair, GetAccessableLocationsStruct& gal
// Adds the contents of a location to the current progression and optionally playthrough
bool AddCheckToLogic(LocationAccess& locPair, GetAccessableLocationsStruct& gals, RandomizerGet ignore, bool stopOnBeatable, bool addToPlaythrough=false){
auto ctx = Rando::Context::GetInstance();
ctx->StartPerformanceTimer(PT_LOCATION_LOGIC);
RandomizerCheck loc = locPair.GetLocation();
Rando::ItemLocation* location = ctx->GetItemLocation(loc);
RandomizerGet locItem = location->GetPlacedRandomizerGet();
Expand Down Expand Up @@ -399,9 +403,11 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessableLocationsStruct& gals
}
//All we care about is if the game is beatable, used to pare down playthrough
if (location->GetPlacedRandomizerGet() == RG_TRIFORCE && stopOnBeatable) {
ctx->StopPerformanceTimer(PT_LOCATION_LOGIC);
return true; //Return early for efficiency
}
}
ctx->StopPerformanceTimer(PT_LOCATION_LOGIC);
return false;
}

Expand Down Expand Up @@ -1149,6 +1155,7 @@ int Fill() {

//Temporarily add shop items to the ItemPool so that entrance randomization
//can validate the world using deku/hylian shields
ctx->StartPerformanceTimer(PT_ENTRANCE_SHUFFLE);
AddElementsToPool(ItemPool, GetMinVanillaShopItems(32)); //assume worst case shopsanity 4
if (ctx->GetOption(RSK_SHUFFLE_ENTRANCES)) {
SPDLOG_INFO("Shuffling Entrances...");
Expand All @@ -1162,9 +1169,12 @@ int Fill() {
SetAreas();
//erase temporary shop items
FilterAndEraseFromPool(ItemPool, [](const auto item) { return Rando::StaticData::RetrieveItem(item).GetItemType() == ITEMTYPE_SHOP; });
ctx->StopPerformanceTimer(PT_ENTRANCE_SHUFFLE);

//ctx->showItemProgress = true;
//Place shop items first, since a buy shield is needed to place a dungeon reward on Gohma due to access

ctx->StartPerformanceTimer(PT_SHOPSANITY);
NonShopItems = {};
if (ctx->GetOption(RSK_SHOPSANITY).Is(RO_SHOPSANITY_OFF)) {
SPDLOG_INFO("Placing Vanilla Shop Items...");
Expand Down Expand Up @@ -1211,7 +1221,9 @@ int Fill() {
//Place the shop items which will still be at shop locations
AssumedFill(shopItems, shopLocations);
}
ctx->StopPerformanceTimer(PT_SHOPSANITY);

ctx->StartPerformanceTimer(PT_OWN_DUNGEON);
//Place dungeon rewards
SPDLOG_INFO("Shuffling and Placing Dungeon Items...");
RandomizeDungeonRewards();
Expand All @@ -1220,7 +1232,9 @@ int Fill() {
for (auto dungeon : ctx->GetDungeons()->GetDungeonList()) {
RandomizeOwnDungeon(dungeon);
}
ctx->StopPerformanceTimer(PT_OWN_DUNGEON);

ctx->StartPerformanceTimer(PT_LIMITED_CHECKS);
//Then Place songs if song shuffle is set to specific locations
if (ctx->GetOption(RSK_SHUFFLE_SONGS).IsNot(RO_SONG_SHUFFLE_ANYWHERE)) {

Expand Down Expand Up @@ -1249,16 +1263,23 @@ int Fill() {

//Then place Link's Pocket Item if it has to be an advancement item
RandomizeLinksPocket();
ctx->StopPerformanceTimer(PT_LIMITED_CHECKS);


ctx->StartPerformanceTimer(PT_ADVANCEMENT_ITEMS);
SPDLOG_INFO("Shuffling Advancement Items");
//Then place the rest of the advancement items
std::vector<RandomizerGet> remainingAdvancementItems =
FilterAndEraseFromPool(ItemPool, [](const auto i) { return Rando::StaticData::RetrieveItem(i).IsAdvancement(); });
AssumedFill(remainingAdvancementItems, ctx->allLocations, true);
ctx->StopPerformanceTimer(PT_ADVANCEMENT_ITEMS);

ctx->StartPerformanceTimer(PT_REMAINING_ITEMS);
//Fast fill for the rest of the pool
SPDLOG_INFO("Shuffling Remaining Items");
std::vector<RandomizerGet> remainingPool = FilterAndEraseFromPool(ItemPool, [](const auto i) { return true; });
FastFill(remainingPool, GetAllEmptyLocations(), false);
ctx->StopPerformanceTimer(PT_REMAINING_ITEMS);

//Add default prices to scrubs
for (size_t i = 0; i < Rando::StaticData::scrubLocations.size(); i++) {
Expand All @@ -1284,19 +1305,35 @@ int Fill() {
}
}

ctx->StartPerformanceTimer(PT_PLAYTHROUGH_GENERATION);
GeneratePlaythrough();
ctx->StopPerformanceTimer(PT_PLAYTHROUGH_GENERATION);
//Successful placement, produced beatable result
if(ctx->playthroughBeatable && !placementFailure) {

SPDLOG_INFO("Calculating Playthrough...");
ctx->StartPerformanceTimer(PT_PARE_DOWN_PLAYTHROUGH);
PareDownPlaythrough();
ctx->StopPerformanceTimer(PT_PARE_DOWN_PLAYTHROUGH);

ctx->StartPerformanceTimer(PT_WOTH);
CalculateWotH();
ctx->StopPerformanceTimer(PT_WOTH);

ctx->StartPerformanceTimer(PT_FOOLISH);
CalculateBarren();
ctx->StopPerformanceTimer(PT_FOOLISH);
SPDLOG_INFO("Calculating Playthrough Done");

ctx->StartPerformanceTimer(PT_OVERRIDES);
ctx->CreateItemOverrides();
ctx->GetEntranceShuffler()->CreateEntranceOverrides();

ctx->StopPerformanceTimer(PT_OVERRIDES);

ctx->StartPerformanceTimer(PT_HINTS);
CreateAllHints();
CreateWarpSongTexts();
ctx->StopPerformanceTimer(PT_HINTS);
return 1;
}
//Unsuccessful placement
Expand Down
7 changes: 6 additions & 1 deletion soh/soh/Enhancements/randomizer/3drando/location_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ Area::Area(std::string regionName_, std::string scene_, RandomizerArea area,
Area::~Area() = default;

bool Area::UpdateEvents(bool haveTimeAccess) {
auto ctx = Rando::Context::GetInstance();
if (timePass && haveTimeAccess) {
ctx->StartPerformanceTimer(PT_TOD_ACCESS);
if (Child()) {
childDay = true;
childNight = true;
Expand All @@ -103,11 +105,13 @@ bool Area::UpdateEvents(bool haveTimeAccess) {
AreaTable(RR_ROOT)->adultDay = true;
AreaTable(RR_ROOT)->adultNight = true;
}
ctx->StopPerformanceTimer(PT_TOD_ACCESS);
}

bool eventsUpdated = false;

ctx->StartPerformanceTimer(PT_EVENT_ACCESS);
for (EventAccess& event : events) {

//If the event has already happened, there's no reason to check it
if (event.GetEvent()) {
continue;
Expand All @@ -121,6 +125,7 @@ bool Area::UpdateEvents(bool haveTimeAccess) {
eventsUpdated = true;
}
}
ctx->StopPerformanceTimer(PT_EVENT_ACCESS);
return eventsUpdated;
}

Expand Down
25 changes: 25 additions & 0 deletions soh/soh/Enhancements/randomizer/3drando/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Rando::Option* currentSetting;
bool GenerateRandomizer(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks,
std::string seedInput) {
const auto ctx = Rando::Context::GetInstance();
ctx->ResetTimers();
ctx->StartPerformanceTimer(PT_WHOLE_SEED);

srand(time(NULL));
// if a blank seed was entered, make a random one
Expand Down Expand Up @@ -65,5 +67,28 @@ bool GenerateRandomizer(std::set<RandomizerCheck> excludedLocations, std::set<Ra
}
ctx->GetOption(RSK_KEYSANITY).RestoreDelayedOption();
}

ctx->StopPerformanceTimer(PT_WHOLE_SEED);
SPDLOG_DEBUG("Full Seed Genration Time: {}ms", ctx->GetPerformanceTimer(PT_WHOLE_SEED).count());
SPDLOG_DEBUG("LogicReset time: {}ms", ctx->GetPerformanceTimer(PT_LOGIC_RESET).count());
SPDLOG_DEBUG("Area->Reset time: {}ms", ctx->GetPerformanceTimer(PT_AREA_RESET).count());
SPDLOG_DEBUG("Total Entrance Shuffle time: {}ms", ctx->GetPerformanceTimer(PT_ENTRANCE_SHUFFLE).count());
SPDLOG_DEBUG("Total Shopsanity time: {}ms", ctx->GetPerformanceTimer(PT_SHOPSANITY).count());
SPDLOG_DEBUG("Total Dungeon Specific Items time: {}ms", ctx->GetPerformanceTimer(PT_OWN_DUNGEON).count());
SPDLOG_DEBUG("Total Misc Limited Checks time: {}ms", ctx->GetPerformanceTimer(PT_LIMITED_CHECKS).count());
SPDLOG_DEBUG("Total Advancment Checks time: {}ms", ctx->GetPerformanceTimer(PT_ADVANCEMENT_ITEMS).count());
SPDLOG_DEBUG("Total Other Checks time: {}ms", ctx->GetPerformanceTimer(PT_REMAINING_ITEMS).count());
SPDLOG_DEBUG("Total Playthrough Generation time: {}ms", ctx->GetPerformanceTimer(PT_PLAYTHROUGH_GENERATION).count());
SPDLOG_DEBUG("Total PareDownPlaythrough time: {}ms", ctx->GetPerformanceTimer(PT_PARE_DOWN_PLAYTHROUGH).count());
SPDLOG_DEBUG("Total WotH generation time: {}ms", ctx->GetPerformanceTimer(PT_WOTH).count());
SPDLOG_DEBUG("Total Foolish generation time: {}ms", ctx->GetPerformanceTimer(PT_FOOLISH).count());
SPDLOG_DEBUG("Total Overrides time: {}ms", ctx->GetPerformanceTimer(PT_OVERRIDES).count());
SPDLOG_DEBUG("Total Hint Generation time: {}ms", ctx->GetPerformanceTimer(PT_HINTS).count());
SPDLOG_DEBUG("SpoilerLog writing time: {}ms", ctx->GetPerformanceTimer(PT_SPOILER_LOG).count());
SPDLOG_DEBUG("Total UpdateHelpers time: {}ms", ctx->GetPerformanceTimer(PT_UPDATE_HELPERS).count());
SPDLOG_DEBUG("Total Event Access Calculation time: {}ms", ctx->GetPerformanceTimer(PT_EVENT_ACCESS).count());
SPDLOG_DEBUG("Total ToD Access Calculation: {}ms", ctx->GetPerformanceTimer(PT_TOD_ACCESS).count());
SPDLOG_DEBUG("Total Entrance Logic Calculation time: {}ms", ctx->GetPerformanceTimer(PT_ENTRANCE_LOGIC).count());
SPDLOG_DEBUG("Total Check Logic Calculation time: {}ms", ctx->GetPerformanceTimer(PT_LOCATION_LOGIC).count());
return true;
}
Loading
Loading