Hi !
I recently start on LÖVE (my sweet LÖVE !) and I try to done a citybuilder with isometric tile.
The display of the map is dynamic (autosize with the size of the windows).
For a fullscreen on 1920x1080, I display ~2300 images (one tile : 60x30) with 60 FPS. But with dual screen (3840x1080) I fall at 40 FPS and the main thread is overloaded.
I use love.graphics.newImage() and love.graphics.draw()
Is there a more optimized way to display images ?
You can find in attached my .love file
Thanks (sorry for mistakes, I'm French :S)
Optimize image loading / displaying
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Optimize image loading / displaying
- Attachments
-
- TestLove.love
- (126.54 KiB) Downloaded 202 times
Re: Optimize image loading / displaying
Most of the workload here is GPU draw calls. Use spite batch to reduce number of draw calls. You can try using autobatch library with no code modification, be aware however that switching to a different sprite, switching shader, switching color etc. breaks the batch and starts a new one, and you'll need a draw call per each batch.
- darkmetalic
- Prole
- Posts: 17
- Joined: Tue Feb 07, 2017 4:09 pm
- Contact:
Re: Optimize image loading / displaying
Since you are organizing numerically, enjoy it
Code: Select all
Test = {}
for i=1, 58 do
Test[i] = love.graphics.newImage("Terrain/Land1a_00"..(121+i)..".png")
end
Re: Optimize image loading / displaying
Is there a way to batch lines written using love.graphics.print?
Re: Optimize image loading / displaying
I tried but no change, because I have too many different images on my screen.raidho36 wrote: ↑Fri Feb 24, 2017 10:12 am Most of the workload here is GPU draw calls. Use spite batch to reduce number of draw calls. You can try using autobatch library with no code modification, be aware however that switching to a different sprite, switching shader, switching color etc. breaks the batch and starts a new one, and you'll need a draw call per each batch.
Yes (It's just a quick test)darkmetalic wrote: ↑Fri Feb 24, 2017 10:45 am Since you are organizing numerically, enjoy itCode: Select all
Test = {} for i=1, 58 do Test[i] = love.graphics.newImage("Terrain/Land1a_00"..(121+i)..".png") end
Re: Optimize image loading / displaying
If you use an image atlas you can definitely leverage batching more easily, since they're all on the same texture and if it never has to switch the batch is never broken.
Re: Optimize image loading / displaying
raidho36 ! I want to say you one thing : I löve you !
I already knew this way but not his name (thanks for the information) and I never used it.
You can find in attached the new .love file with a texture atlas.
Many thanks for this help !
PS : like many of my questions on english forums, it's more a lack of keywords than a real problem sorry for that :S
I already knew this way but not his name (thanks for the information) and I never used it.
You can find in attached the new .love file with a texture atlas.
Many thanks for this help !
PS : like many of my questions on english forums, it's more a lack of keywords than a real problem sorry for that :S
- Attachments
-
- TestLoveBis.love
- (87.42 KiB) Downloaded 199 times
Last edited by Mirk on Sat Feb 25, 2017 9:06 am, edited 1 time in total.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: Optimize image loading / displaying
If you are using a texture atlas then you should be using an SpriteBatch!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Who is online
Users browsing this forum: Bing [Bot], CleoCommunist and 5 guests