Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Changing entity depths to non integer values gradually degrades performance #103

Open
jefvel opened this issue Jan 11, 2023 · 1 comment
Assignees

Comments

@jefvel
Copy link
Contributor

jefvel commented Jan 11, 2023

My game was getting worse performance the longer it ran, even though there were less than 40 active instances. After some troubleshooting, I noticed it had to do with the depth of instances. I changed it based on their y coordinate, going from 0 to 100.

It appears that it'll create pools for every unique depth, but then not remove them once the instance depth is changed or the instance is destroyed.

https://github.com/YoYoGames/GameMaker-HTML5/blob/develop/scripts/yyRoom.js#L3707
The pool list here kept growing every frame, to a size over 8000, at which point the game had ground to a halt.

However, if I made sure the depth was set to a rounded number instead of floating point between 0 and 100, the pool length was kept in check.

I'm not sure whether or not this is working as intended, I'm suspecting not. Either the depth should be ensured to be a rounded value, or make sure that the pool is cleaned of empty values.

@jefvel
Copy link
Contributor Author

jefvel commented Jan 12, 2023

reproduce_lag.zip
Here's a small project that reproduces the issue. Run it in a non-HTML5 target, and it'll run smoothly forever. However, HTML5 will gradually slow down.

Then, if you comment out the depth assignment in the step function test_obj, it'll keep running without problems.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants