love.graphics.setDefaultFilter(nearest,nearest) for sure this will help memory and speed and frame rate...makes small images bigger onscreen
but in my case I want to make a spritesheet with 64x64 and 128x128 and don't want to kill the memory
I want the images to look smaller on screen I played around with filter and love.draw() but none worked
and was not able to make my 64 and 128 look like a 32x32
perhaps I missed something can someone help me ?
how to saving memory
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: how to saving memory
I'm not sure what exactly you are asking here. doesn't have much to do with memory usage. It just determines which FilterMode is used while scaling your images.
It looks like something in your code is producing a lot of garbage each frame (and I supposed this is what you are trying to reduce). Generally you should try to avoid creating tables each frame. E.g.:
can be simply rewritten as:
I'd say if you get rid of all those unpack statements you have in your code it should already greatly improve garbage usage. That's the only big issue I saw while glancing over your code.
Code: Select all
love.graphics.setDefaultFilter
It looks like something in your code is producing a lot of garbage each frame (and I supposed this is what you are trying to reduce). Generally you should try to avoid creating tables each frame. E.g.:
Code: Select all
love.graphics.setColor( unpack{ fontcolor } )
Code: Select all
love.graphics.setColor( fontcolor )
Re: how to saving memory
Oh ..thanks so much ..i don't want to over kill this ,as for the images the scale
will this work to make my 128x128 images to 32x32 and save memory as well?? or wont work?
https://love2d.org/wiki/love.graphics.scale
will this work to make my 128x128 images to 32x32 and save memory as well?? or wont work?
https://love2d.org/wiki/love.graphics.scale
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: how to saving memory
Let's say that you load a 128x128 image that uses 8 bits for 4 channels (red, green, blue, alpha). The raw data will take up 128*128*4 bytes, which is 65536 bytes, which is 64 kilobytes. Not much. 64x64 is even smaller, with 64*64*4 = 16 kilobytes.
Both disk space and memory will be around those values, maybe a bit more for headers, maybe a bit less because compression.
As for speed, it literally does not matter. The slowest thing would be loading in the file from disk to memory, but you should only do that once anyway, so it is meaningless. Drawing out a 64x64 and a 128x128 image takes about the same time.
Both love.graphics.scale and the sx, sy parameter for love.graphics.draw are the same in functionality, you could use either. For your case, you want a scale factor of 32/128 for both axes, which is 0.25. It will work in that your images will have a size of 32x32 on screen. It has nothing to do with memory usage, or speed.
Both disk space and memory will be around those values, maybe a bit more for headers, maybe a bit less because compression.
As for speed, it literally does not matter. The slowest thing would be loading in the file from disk to memory, but you should only do that once anyway, so it is meaningless. Drawing out a 64x64 and a 128x128 image takes about the same time.
Both love.graphics.scale and the sx, sy parameter for love.graphics.draw are the same in functionality, you could use either. For your case, you want a scale factor of 32/128 for both axes, which is 0.25. It will work in that your images will have a size of 32x32 on screen. It has nothing to do with memory usage, or speed.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: how to saving memory
thanks you so much for the answer.
I do see many great games with such great graphics ( computers and/or cells ) clash of clans as an example to me looks like a 2D game but the graphics are so nice ( I question my self if it is the programmer or the artist? ) for such nice result!
and that's what I want to achieve.
I do see many great games with such great graphics ( computers and/or cells ) clash of clans as an example to me looks like a 2D game but the graphics are so nice ( I question my self if it is the programmer or the artist? ) for such nice result!
and that's what I want to achieve.
Re: how to saving memory
pielago wrote:thanks you so much for the answer.
I do see many great games with such great graphics ( computers and/or cells ) clash of clans as an example to me looks like a 2D game but the graphics are so nice ( I question my self if it is the programmer or the artist? ) for such nice result!
and that's what I want to achieve.
Clash of Clans is developed by a professional studio so chances are they have more than one artist
I haven't played clash of clans, but it looks like 3d models rendered to 2d sprites. You basically can do the very same with LÖVE.
Re: how to saving memory
oh! you say its render???
now for TERRARIA its computer game...is that also render from 3D to 2D?????
now for TERRARIA its computer game...is that also render from 3D to 2D?????
Re: how to saving memory
No, sprites in Terraria are hand-drawn.pielago wrote:oh! you say its render???
now for TERRARIA its computer game...is that also render from 3D to 2D?????
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests