Slay the Spire

Slay the Spire

Optimize the Spire
45 opmerkingen
(Gk) Erasels  [auteur] 6 feb om 3:52 
New update with an optimization from cany0udance! This optimization helps with the lag some of you might experience when opening your run history screen.
glennvtx 6 jan om 18:15 
THANK YOU.
(Gk) Erasels  [auteur] 14 jun 2024 om 3:27 
Hmm, your steps for repdouction make wrong assumptions.
> 4. Add MyCustomRelic to relic array.
This would trigger the doRecieveRelic method via the RelicGetSubscriber in the main mod file. That method would change the -1 to its actual location.
s.Claw 4 jun 2024 om 16:09 
Hello, for the Relic patch, I am running into a bug where the hashmap has a stale -1 entry after relics are added to the relic array. I think that the code to check for array size difference needs to come before the first call to relicLocs.get(key).

int size = __instance.relics.size();
if (size != RelicOptimizationPatches.relicsSize) {
RelicOptimizationPatches.relicsSize = size;
RelicOptimizationPatches.relicLocs.values().removeIf(val -> (val.intValue() == -1));
}


The issue can occur like so:

1. Start with empty relics array
2. Call getRelic("MyCustomRelic")
3. Hashmap entry added for "MyCustomRelic" -> Integer(-1)
4. Add MyCustomRelic to relic array.
5. Call getRelic("MyCustomRelic")
6. Hashmap returns Integer(-1), so it enters into i != null logic.
7. relicSize check sees that relics.size() != 0, so it removes all -1
8. However since it has already found i = Interger(-1), it skips to the rIterSkipped case and returns null.
裂开logy 18 mei 2024 om 8:16 
Enable/disable this mode is the only thing I change. Could it conflict with any of "Relic filter mod", "Colored Map", "Shop Mod", "TrulyRandomMOd" or "BaseMod"?
(Gk) Erasels  [auteur] 18 mei 2024 om 6:46 
I don't see a way for this mod to cause that.
裂开logy 18 mei 2024 om 6:05 
Found a bug associated with retrieving the game after leaving in background for a few minutes. The game gets frozen and GPU hang at 100% usage for around 10 s before returning to normal.
(Gk) Erasels  [auteur] 13 jul 2023 om 0:44 
Alchyr released his great RAM Saver mod https://sp.zhabite.com/sharedfiles/filedetails/?id=3002563327
that will help with that for those struggling with missing letters in their text or RAM related crashes.
voov 29 jun 2023 om 1:10 
兼容,优化尖塔mod
bkerns2 10 apr 2023 om 15:35 
Thank you for making this.
catboy princess 4 feb 2023 om 11:43 
The decompiled code looks like this, which I believe is the issue:


public class YoumuPatch {
@SpirePatch(cls = "com.megacrit.cardcrawl.characters.AbstractPlayer", method = "hasRelic")
public static class hasRelicResurrect {
@SpireInsertPatch(rloc = 0)
public static SpireReturn Insert(AbstractPlayer p, String targetID) {
if (p.name == "Youmu" && (targetID == "Blue Candle" || targetID == "Medical Kit"))
return SpireReturn.Return(Boolean.valueOf(true));
return SpireReturn.Continue();
}
}
}
(Gk) Erasels  [auteur] 3 feb 2023 om 5:52 
I have a feeling the relic is chaning its ID so certain base game code thinks it's another relic. That would definitely be a big nono with this mod.
catboy princess 2 feb 2023 om 15:05 
in my own investigation, i think the issue is actually with the Youmu mod itself, that does something weird to enable the function of the Half Phantom relic, causing it not to play well with the new implementation of the relic list
catboy princess 2 feb 2023 om 14:32 
I have an interesting incompatibility to report:

This Youmu character mod starts with a relic (Half Phantom) that is supposed to allow curses and statuses to be played. Having the optimization mod installed will disable that aspect of the relic, greatly affecting the character mod's dynamics.

is there any chance you would like to fix this?

in case this helps, there is a localization mod to translate the Youmu mod to English https://sp.zhabite.com/sharedfiles/filedetails/?id=2777818594&searchtext=youmu
虛無_鬼王 19 jan 2023 om 12:36 
Thank you so much for everything you have done! Your mod successfully optimized my 76 mods, my game is no longer lagging!
Winter 'Eira 19 nov 2022 om 11:40 
A huge improvement great mod.
pgames-food 16 sep 2021 om 21:50 
ah yep, i like variety :)
https://sp.zhabite.com/sharedfiles/filedetails/?id=2548274926
i can send you the modlist if you like
(Gk) Erasels  [auteur] 16 sep 2021 om 2:08 
I'm very glad to hear that, 75 mods sounds like you're really giving it a stresstest.
pgames-food 15 sep 2021 om 22:22 
btw i forgot before, but i managed to get this mod working ages ago ok in the end, and even recently had a game with about 75-77 mods :)
(Gk) Erasels  [auteur] 14 sep 2021 om 23:37 
Considering I haven't had a single crash in all my playtesting, I'm gonna go with not this mod's fault unless you can show me a crashlog.

Either way, if it didn't help, that's too bad. Hope you can fix your performance problems.
L0ki 14 sep 2021 om 15:51 
I've had some crashes while using this mod that only happened while using this mod and didn't notice any performance improvements either so I've reverted to no no longer using it.
pgames-food 3 jul 2021 om 12:22 
ah ok, many thanks for looking though :)

i can always take a few out and add a few new ones in then, its ok - i must have gotten a bit greedy, trying to add all the mods i found lol :)
(Gk) Erasels  [auteur] 3 jul 2021 om 3:07 
Sadly I'm of no help in that regard, haven't really interacted with swapfiles before and a quick google search wasn't enlightening.
pgames-food 2 jul 2021 om 18:34 
do you know if there any way to get java to load more memory or use a swapfile?
i can load up 23 mods, but when i tried with a lot more, it maxed out my 8GB system ram and crashed. even if the game would take longer to load, it wouldnt be so bad but im wondering why it crashes... if it loads things as it needs them, maybe there is a way to allow java to not run out of memory, but instead to simply need to access the filesystem more often?

(Gk) Erasels  [auteur] 2 jul 2021 om 1:49 
Hmm, sorry to say, but it's unlikely. That sounds more like a RAM issue going by what you said.
drewmarc 1 jul 2021 om 19:21 
In vanilla, I've come across a bug while playing Discovery, where the cards fail to generate. The discord says it has to do with failing to load the cards for you to discover (and it apparently affects Jack of All Trades, which I haven't picked so far). Do you think this mod will fix this issue?
pgames-food 28 jun 2021 om 10:50 
hi erasels, this sounds like a good optimisation. im new to slay the spire (and mods) but will add this to save cpu cycles :)

(older versions of rimworld, used to fully scan and refresh the entire modlist, over and over, but they changed and optimised the process there too) :)
NorahC 27 jun 2021 om 20:17 
1
(Gk) Erasels  [auteur] 6 jun 2021 om 22:10 
This mod doesn't really touch anything related to resolution or settings in the slightest so I'm not sure how that could be. If you do find out what mod or combination thereof caused it, I'd be happy to know.
Queen Grimlock 6 jun 2021 om 15:12 
For some reason the mod seems to have disabled any option for borderless fullscreen other than 3360x2100, which is way bigger than my monitor's actual size. Not sure if this is a weird interaction with another one of my mods, but I felt it was worth mentioning.
Chom 28 mei 2021 om 2:46 
For someone like me who runs with so many mods this is a godsend.
scallop 16 mei 2021 om 15:01 
Thanks so much for this, dude! :HatHealth:
some (momi) 27 apr 2021 om 18:05 
fan-fucking-tastic mod
旅渚Lastcel 22 apr 2021 om 8:48 
It works, thank you
(Gk) Erasels  [auteur] 22 apr 2021 om 7:46 
It's called Optimize the Spire in the mod selection menu
旅渚Lastcel 22 apr 2021 om 6:58 
Excuse me, what's the name of this mod in the selection page? I can't find it because I have too many mods in my list
StarrySunbeams 17 apr 2021 om 14:22 
Absolutely fantastic. Thank you for this!
Asdercol 17 apr 2021 om 6:35 
God tier mod, no longer crashing every single time I abandon a run, finish a run or close the game.
(Gk) Erasels  [auteur] 13 apr 2021 om 13:44 
That sounds exactly like something within the scope of this mod, thanks for the write up, I'll take a look at it,
ojb 13 apr 2021 om 13:38 
Again, I haven't done much digging myself but I saw this mod earlier in the week and thought about it when digging in the muck of the MasterDeckViewScreen for another project. It might be worth doing a search through your game for any instances of Collections.sort() and examining if this inefficient behavior happens elsewhere.

It might be worth taking a look at and doing some profiling on if you're interested.

[3 / 3]
ojb 13 apr 2021 om 13:38 
Now, deck sizes never really get that big in most vanilla games, and are small enough that there's not much performance hit anyway. Though with modded games, games with modifiers (e.g. endless or the daily modifiers that clutter the deck), or other instances of large deck size, this may add up to some actual performance penalties on lower end machines.

The trivial solution would be to cache the results of the sort whenever the sorting button is pressed and store it somewhere instead of resorting every frame.

I haven't personally looked into things like the draw, discard, or exhaust piles, but there's a large chance that they have similar issues to the master deck screen (and they would theoretically be far worse, due to temporary status cards or other modifiers - even in just vanilla play, I've seen these piles reach close to 1000 cards under fortuitous circumstances, which is potentially on the magnitude where constant sorting might start to matter on low end machines).

[2 / 3]
ojb 13 apr 2021 om 13:38 
Hey Gk - don't know how useful this information might be for you, but I ran into something that may be in the scope of this project while working on my own mod. MasterDeckViewScreen (which is the screen that shows all your cards when you open the deck), has options to sort your deck by Obtained Order, Type, Alphabetical, etc.

Outside of the default ordering (which doesn't have this problem), if you select any other option it actually (re)performs the sort of all cards once per frame. Some quick googling indicates that Java's Collections.sort() implements the mergesort algorithm in the backend, which doesn't have any speedup when the collection is already sorted. I.e. you're paying the full n log n cost over and over for each frame.

[1 / 3]
Asdercol 12 apr 2021 om 16:15 
Yes!
GoatBoy 12 apr 2021 om 14:24 
Totally agree with Too Mellow, thank you for this!
Too Mellow 12 apr 2021 om 7:38 
regardless of how much this does or does not help. anybody trying to help improve a gamers experience is amazing person, thank you for your hard work and hope you find even more successful ways to improve the game :)