Hello!
I have a question, that don't deserve a own thread :-)
If you have some objects in your game, and each draws an image in your virtual world, there is always a chance that not all images are on the screen.
Like, the player is walking away from a npc and the npc is drifted out of the screen.
Actually I have to include some sort of z-sorting and stumble over the question to check first, if the object is on screen. And after this successful check, the z of the object is sorted. So I stumbled over the question if you have to check the "on-screen"-property of objects for drawing, too to improve the performance of the love.draw-function.
Do you check, if the world-position is on screen before drawing the image? Does this improve the performance?
"Questions that don't deserve their own thread" thread
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: "Questions that don't deserve their own thread" thread
If you frustum cull every individual object, with modern GPUs that results in bottlenecking the CPU and framerate drops just as well. E.g. if you use sprite batches, it's not slower to render all sprites in the scene indiscriminately compared to only rendering the specific ones in the view until amount of off-screen sprites gets absolutely ridiculous. It's a tradeoff between GPU performance and CPU performance and you need to strike the right balance, and it will hinge at its own particular point for each hardware configuration.
Having that said, modern GPUs render very fast but are starting to render slow, so if setup time is significant compared to render time (e.g. rendering 2-poly individual sprites vs. 2 million polygon batches) then minimizing amount of calls to the GPU is a sure way to improve rendering times. In most practical cases, arranging your render order so that GPU doesn't need to change current texture and current shader will improve performance miles better than camera frustum culling.
Having that said, modern GPUs render very fast but are starting to render slow, so if setup time is significant compared to render time (e.g. rendering 2-poly individual sprites vs. 2 million polygon batches) then minimizing amount of calls to the GPU is a sure way to improve rendering times. In most practical cases, arranging your render order so that GPU doesn't need to change current texture and current shader will improve performance miles better than camera frustum culling.
Re: "Questions that don't deserve their own thread" thread
Quick question. I have an image of 100x100 pixels and I want to draw it in an area of 128x128 pixels (I want to stretch it to that exact size). What would be the easier way to do it?
Re: "Questions that don't deserve their own thread" thread
[wiki]love.graphics.draw[/wiki]([wiki]Image[/wiki], x, y, 0, 128/[wiki](Image):getWidth[/wiki](), 128/[wiki](Image):getHeight[/wiki]())
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: "Questions that don't deserve their own thread" thread
you got my vote for most well-linked answer of 2016Nixola wrote:[wiki]love.graphics.draw[/wiki]([wiki]Image[/wiki], x, y, 0, 128/[wiki](Image):getWidth[/wiki](), 128/[wiki](Image):getHeight[/wiki]())
Re: "Questions that don't deserve their own thread" thread
Man, thanks. I haven't thought about using this division.Nixola wrote:[wiki]love.graphics.draw[/wiki]([wiki]Image[/wiki], x, y, 0, 128/[wiki](Image):getWidth[/wiki](), 128/[wiki](Image):getHeight[/wiki]())
He's got my vote too.s-ol wrote:you got my vote for most well-linked answer of 2016Nixola wrote:[wiki]love.graphics.draw[/wiki]([wiki]Image[/wiki], x, y, 0, 128/[wiki](Image):getWidth[/wiki](), 128/[wiki](Image):getHeight[/wiki]())
- RadioactiveGears
- Prole
- Posts: 6
- Joined: Sun Oct 23, 2016 8:16 pm
- Location: Denmark
- Contact:
Re: "Questions that don't deserve their own thread" thread
Yes it does improve performance. If you have no checks for this kind of thing then you give the GPU too many draw calls, because then it has to process EVERYTHING that is in your map at once.Dudenheit wrote:Hello!
I have a question, that don't deserve a own thread :-)
If you have some objects in your game, and each draws an image in your virtual world, there is always a chance that not all images are on the screen.
Like, the player is walking away from a npc and the npc is drifted out of the screen.
Actually I have to include some sort of z-sorting and stumble over the question to check first, if the object is on screen. And after this successful check, the z of the object is sorted. So I stumbled over the question if you have to check the "on-screen"-property of objects for drawing, too to improve the performance of the love.draw-function.
Do you check, if the world-position is on screen before drawing the image? Does this improve the performance?
I suggest you do the checks in a function that runs in love.update and have a variable like "draw = false" and use that variable in the draw function. If you do the complete check in the draw function then it is better than nothing but still slow.
I think this was what you asked at least.
- parallax7d
- Citizen
- Posts: 82
- Joined: Wed Jul 02, 2014 11:44 pm
Re: "Questions that don't deserve their own thread" thread
Are the screen, canvases and pixel shaders the only possible render destinations for love.graphics calls such as rectangle?
Re: "Questions that don't deserve their own thread" thread
Yes. For any graphics such as text, shapes, rectangles etc.parallax7d wrote:Are the screen, canvases and pixel shaders the only possible render destinations for love.graphics calls such as rectangle?
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
Re: "Questions that don't deserve their own thread" thread
I've been having trouble getting an external console to show up on windows.
I've tried modifying conf.lua as such:
conf.lua
I've also tried running the game with the latest version of love using the lovec.exe
I've also tried running the game with --console in the command line.
In case it's relevant, I do have a custom love.run function, and I'm using Windows 10.
Has anyone else had similar problems? I can provide code as necessary.
Any help would be appreciated, this has been a really annoying problem for me.
Edit
After doing more digging i'm thinking that the console output is getting sent back to Atom (Text editor I use and I launch the game from). Is there a way to force Love2d to make a console window and send the output there instead?
Edit 2
Solved it. Thanks bartbes, you sent me down the right path.
I've tried modifying conf.lua as such:
conf.lua
Code: Select all
function love.conf(t)
t.console = true
end
I've also tried running the game with --console in the command line.
In case it's relevant, I do have a custom love.run function, and I'm using Windows 10.
Has anyone else had similar problems? I can provide code as necessary.
Any help would be appreciated, this has been a really annoying problem for me.
Edit
After doing more digging i'm thinking that the console output is getting sent back to Atom (Text editor I use and I launch the game from). Is there a way to force Love2d to make a console window and send the output there instead?
Edit 2
Solved it. Thanks bartbes, you sent me down the right path.
Last edited by Remscar on Wed Nov 16, 2016 11:02 pm, edited 1 time in total.
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot], rabbitboots and 6 guests