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

Stack display updating every time an object is added. #265

Open
GrimPixel opened this issue Apr 4, 2023 · 4 comments
Open

Stack display updating every time an object is added. #265

GrimPixel opened this issue Apr 4, 2023 · 4 comments
Labels
assets Related to assets or asset packs bug Something isn't working ui Related to the UI
Milestone

Comments

@GrimPixel
Copy link

When loading a deck in the assets menu, the deck takes much more time than in earlier versions to load. It feels like all cards in a deck is being loaded, instead of the top one only.

@drwhut
Copy link
Owner

drwhut commented Apr 4, 2023

Hmm... when loading a deck of cards, only the top and bottom cards should be loaded in. I'll have to do some testing on this on my end. Are you able to confirm which version of the game had faster loading times for decks?

@GrimPixel
Copy link
Author

I was using Beta 3 before.

@drwhut
Copy link
Owner

drwhut commented Apr 4, 2023

Just checked this on my system, there is definitely a noticeable difference in the loading times - thanks for the heads up!

@drwhut drwhut added bug Something isn't working ui Related to the UI assets Related to assets or asset packs labels Apr 4, 2023
@drwhut drwhut added this to the v0.1.0 milestone Apr 4, 2023
@drwhut
Copy link
Owner

drwhut commented Apr 5, 2023

I've found the cause of the issue: dcb084d introduced a workaround for a race condition in load by delaying the loading thread for 1ms before loading a resource. When stacks are built, the metadata of each of the pieces is added to the stack, but for each piece its corresponding scene is instanced to check what collision shape it has (to check if it matches with the stack's current shape, e.g. a BoxShape cannot stack with a CylinderShape). This is where the extra delay in loading stacks is coming from, the loading times are padded by about 52ms.

For v0.1.0, I'll attempt to patch this by caching the piece's scene and using it each time the same type of piece is added. I'll optimise the root cause of the issue in v0.2.0, since I'm rewriting most of the code then anyways.

EDIT: It's not the collision shape that's the issue, that's only loaded once when the stack is first created. Instead, it's the stack textures updating every time a piece is added. This is more deep-rooted than I initially thought, so I'm pushing back the milestone to v0.2.0, and I'll make sure when rewriting the code to separate the actions of adding a piece to the stack, and updating the stack display.

@drwhut drwhut modified the milestones: v0.1.0, v0.2.0 Apr 5, 2023
@drwhut drwhut changed the title Longer deck loading time Stack display updating every time an object is added. Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assets Related to assets or asset packs bug Something isn't working ui Related to the UI
Projects
None yet
Development

No branches or pull requests

2 participants