So maybe try this: make resources in more resolutions and you will choose one based on resolution of window (so you don’t have unnecesarry big resources that you will scale down). And if someone has big resolution, you can except to also have more high-spec computer and more memoryBrotSagtMist wrote: ↑Fri Feb 03, 2023 8:28 pm Again, i specifically want this thing to be as big and resource eating as possible.
The problem simply is that i do not know how big it can be as there simply is no "you have now filled the ram to 50%" warning.
Managing memory for a ton of pictures
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Managing memory for a ton of pictures
Re: Managing memory for a ton of pictures
Load the image.
If ok, then load another one.
If ok, load another two.
If ok, load another four.
(Double amount of loaded images and write the amount to the file)
...
If not ok, restart the game and use last saved amount of loaded images.
Now the system is loaded more than 50%.
If ok, then load another one.
If ok, load another two.
If ok, load another four.
(Double amount of loaded images and write the amount to the file)
...
If not ok, restart the game and use last saved amount of loaded images.
Now the system is loaded more than 50%.
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Managing memory for a ton of pictures
You use external tools for that i believe, there's no built-in way to do it... i assumed your backgrounds weren't procedurally generated so i didn't think this would be an issue.
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: Managing memory for a ton of pictures
It does not matter as long as the user does not notice the loading.
You can even do it by blocking the main thread as long as there is nothing moving on the screen.
Re: Managing memory for a ton of pictures
Do you have a screenshot of a mockup of the game? Is there any chance to optimize textures by channel packing?
When games need a lot of unique texture content, they usually stream it:
https://www.gamedev.net/forums/topic/69 ... streaming/
When games need a lot of unique texture content, they usually stream it:
https://www.gamedev.net/forums/topic/69 ... streaming/
- BrotSagtMist
- Party member
- Posts: 665
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Managing memory for a ton of pictures
I am already preloading, i already have zero loading times, i got this part covered.
The problem purely lies in that i do not know HOW MUCH i can preload.
Mosts games out there lists a ram requirement, i do not want this. I want the game to match the hardware and scale as needed.
It should run on a 128mb potato. But at the same time uses a 128gb monster to its fullest.
And i do not see a way to distinguish if the game runs on a potato or a monster.
Without knowing how much ram there is to fill i can not decide how much i will fill with preloads.
It is really depressing that this testing till it fails, as darkfrei just wrote, is the only solution we can come up with.
The problem purely lies in that i do not know HOW MUCH i can preload.
Mosts games out there lists a ram requirement, i do not want this. I want the game to match the hardware and scale as needed.
It should run on a 128mb potato. But at the same time uses a 128gb monster to its fullest.
And i do not see a way to distinguish if the game runs on a potato or a monster.
Without knowing how much ram there is to fill i can not decide how much i will fill with preloads.
It is really depressing that this testing till it fails, as darkfrei just wrote, is the only solution we can come up with.
obey
Re: Managing memory for a ton of pictures
Let's think about it: the user has a monitor, and that monitor has a fixed pixel density. You don't need to load more texture content than what can be displayed 1:1 on that monitor, plus some extra for buffering (pre-loading textures that the user is likely to see in the near future, so the game doesn't stutter).BrotSagtMist wrote: ↑Sun Feb 05, 2023 1:37 am But at the same time uses a 128gb monster to its fullest.
So whatever is the zoom level on your game screen, you know what textures you need to load and at what resolution. You don't need to load everything.
Even if you can zoom out to display the entire game level, that level is not being shown 1:1 on screen, it's way minified. So the texture data that you read from disk can be downsized and only then loaded into VRAM.
In conclusion, in terms of memory budget, you probably only need the current user screen size, plus the surrounding 8 neighbor screens for buffering -- or as you said in a game of high speed, based on the player velocity and direction, pre-loading two screen steps in that direction in a background thread.
Re: Managing memory for a ton of pictures
Is it possible to use the pcall to load images safe?
Re: Managing memory for a ton of pictures
I just checked the source code, whenever there's an exception during the loading and creation of a new Image object, a Lua error is emitted.
Using pcall you can catch those, and if you don't, the default Löve error handler will do that for you.
Edit: clarified text...
Re: Managing memory for a ton of pictures
You should load as little as possible in order to keep the memory consumption low.BrotSagtMist wrote: ↑Sun Feb 05, 2023 1:37 am I am already preloading, i already have zero loading times, i got this part covered.
The problem purely lies in that i do not know HOW MUCH i can preload.
Also, do not load pictures that are larger than the user's desktop dimensions.
It is usually wasteful to scale down pictures in order to fit them on the screen.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], dusoft and 7 guests