nh6574 / JokerDisplay

Simple Balatro mod that displays information such as modifiers or relevant hands, ranks or suits under Jokers.
GNU General Public License v3.0
6 stars 2 forks source link

Implement "context" logic (or similar) #35

Open nh6574 opened 1 month ago

nh6574 commented 1 month ago

I don't have the time to do this but I'm opening this issue for anyone that's passionate enough about this mod to see.

Right now the mod updates when some specific actions are performed. This is done by hijacking some functions and making them call update_joker_display after they're done. The reason for this is that the mod makes to many calculations at once, which slows down the game if done at every game update.

These methods are:

Node:stop_drag()
CardArea:emplace()
CardArea:load() -- if area is G.Jokers
CardArea:parse_highlighted()
CardArea:remove_card()
Card:calculate_joker() -- only that joker

This works fine for the most part but has some limitations:

  1. There's some wonkyness with the update timing. Some Jokers start with no information when loaded because they're loaded before they can get that information, so the player has to click on a card when restarting a run for everything to display properly (#7). Blueprint and Brainstorm are also very inconsistent with their update times (#16). Some timings are not taken into account at all (like updating odds when selling Oops! All 6s #8 or updating Jokers when Vampire is used on a stone card #5).
  2. If you have too many Jokers, this may still make too many calculations and slow down the game.

... and probably others my small brain can't comprehend.

A solution that comes to mind is implementing a system similar to Balatro's context system, where every action is sent as the update context to the mod to cut on the amount of calculations at a time. Or something like that. I don't know.

Like I said, I'm probably not doing that but if there's ever a v2.0 this is going to be the main feature.

nh6574 commented 1 month ago

With #42 this is not that big of a problem anymore for most use cases but it will still lag pretty badly with a lot of jokers (using Cryptid for example)