Open Anything FPS Lag
jjc54 opened this issue ยท 4 comments
Upon opening a builder, or any chest/bag, the FPS goes from 130 into the 20's. There is also a distinct lag spike immediately when opening. I'm not sure what causes this, but I am having the issue on Agrarian Skies 2.
Forge: forge-10.13.3.1387
CompactStorage: compactstorage-1.7.10-release-2.0.0.8-universal
Agrarian Skies 2: 1.0.39
Screens: http://imgur.com/a/GrMyr
*I am using Optifine and Fastcraft, but I don't think this is the issue.
Forge 10.13.3.1387; CS 1.7.10-release-2.0.0.9-universal, AgSkies 2 1.0.39 (personally updated CS outside of the pack), Fastcraft 1.21
Same issue. Running off a Surface Pro, going from 45-ish FPS to slideshow speeds in no time flat when opening either the builder or a built chest. Haven't tried a backpack yet, I'm too poor.
However, I think I know what the issue is. You're using a ninepatch implementation to dynamically draw various sizes of chest, iterating over several hundred or so times on the x and y axes, and drawing a single pixel texture (at worst) to the screen. I'm no expert at OpenGL, but I would think that trying to render (again, at worst) tens of thousands of sprites on the screen would cripple a system.
Take a page from Vanilla's book. Draw out the maximum size of chest that you need and selectively render only what's needed. Since it seems like you don't let anyone build any larger than a 24col x 12row chest, I suggest you draw that one out, and then take parts off of that to render your chest. MINIMIZE the number of sprites you're using as much as possible!
As far as the Chest Builder goes, I don't see why you're doing the same thing. That GUI doesn't change size (unless I'm missing something dumb) so there's no need to use any ninepatch-hack stuff. Draw out your GUI ahead of time and just drop it whole into the screen.
Everyone's computers shall thank you.
Guys, if you have an issue, report it to www.github.com/tattyseal/IssueTracker