eidalac / FluffyBreeder

Fluffy breeding game
GNU General Public License v3.0
5 stars 4 forks source link

Shop slow down #4

Closed eidalac closed 3 years ago

eidalac commented 3 years ago

Describe the bug Loading the main shop screen drastically slows down based on fluffy population, and is nearly unplayable after about 200 fluffies are generated.

To Reproduce Steps to reproduce the behavior: Breed/Buy 100 or more fluffies

Expected behavior Loading the shop should take a set amount of time.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): N/A

Smartphone (please complete the following information): N/A

Additional context N/A

eidalac commented 3 years ago

Removed some double loops checking ID duplication (should not be needed).

Changed tracking to use a single global list of all fluffies and just track the IDs of fluffies in the store presently to prevent having to iterate over a large list of fluffies that are no longer in the store (dead or sold)

Put a cap on store capacity of 750, to put an upper bound on population.

TWINE has a limit on loops of 1000, so the game can not support more than 1000 fluffies in the store - which in theory can still be reached if a player has 40+ pregnant mares and a total pop of 750 - but once implemented the stress system should drive them bonkers, so shouldn't be a practical issue.

Will have to address that outlier in the future however.