Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
How to avoid FPS drop while loading Texturepack? — Gideros Forum

How to avoid FPS drop while loading Texturepack?

Apollo14Apollo14 Member
edited October 2019 in General questions
Hi guys!

I've noticed that there're heavy FPS drops while creating new texturepacks:
TEST_TEXTUREPACK = TexturePack.new("images/spritesheet1.txt", "images/spritesheet1.png")
--causes significant lag, FPS drops from 60 down to 40, then restores
--spritesheet is not big, it's only 132kb, 1243x1542px
I've tried it with Core.asyncCall, still lags.
local function LOAD_SPRITESHEET()
	TEST_TEXTUREPACK = TexturePack.new("images/spritesheet1.txt", "images/spritesheet1.png")
end
Core.asyncCall(LOAD_SPRITESHEET)
It seems that 'TexturePack.new' is extremely heavy for some reason
(first thought was to pre-cache texturepacks but it still will cause lots of lags; and pre-cached texturepacks consume lots of ram: 10 pre-cached texturepacks of ~1mb size consume up to ~200mb ram)
> Newcomers roadmap: from where to start learning Gideros
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Tagged:

Comments

  • hgy29hgy29 Maintainer
    Accepted Answer
    TexturePack.new shouldn't be much heavier than a Texture.new, most of the time is consumed by the image decoder. Main issue is that gideros is single threaded and file loading APIs don't have an asynchronous form yet

    Likes: Apollo14

    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    Accepted Answer
    I load all the packs at the beginning before anything starts, you could do this for maybe the 1st level graphics then load others when a bonus screen comes on or some other kind of 'natural' delay.

    Likes: Apollo14, antix

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+2 / -0 )Share on Facebook
Sign In or Register to comment.