fast async load all assets?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
farzher
Prole
Posts: 42
Joined: Fri Jul 31, 2015 5:38 pm

fast async load all assets?

Post by farzher »

how can i quickly load all 1,000 of my game's assets (images, sounds)?

i'm using love-loader, so that it's not blocking the main thread. but this doesn't make it any faster.
love-loader itself is loading files 1 by 1 in a very slow, synchronous loop.

is it possible to send a request to the OS to load all 1000 files at once? this should make the harddrive load the assets a lot faster.
butts
User avatar
marclurr
Party member
Posts: 157
Joined: Fri Apr 22, 2022 9:25 am

Re: fast async load all assets?

Post by marclurr »

Reading from disk is inherently a synchronous operation. Also, many game assets (anything that will live on the GPU, such as textures) actually have to be initialised on the thread that owns the OpenGL context. The best you can do is separate reading the data from disk into one thread and initialising the GPU representation on the Opengl thread, which from what I can tell is what love-loader already does.

You might be able to speed up loading at the expense of memory consumption by using some kind of custom blob file format to hold all your assets, but maybe not. I've never really gone down that rabbit hole so my only idea is "reduce it all to a single HDD read then do the rest in memory". You'd really have to write the whole thing yourself if you were gong to try that route though.
MrFariator
Party member
Posts: 559
Joined: Wed Oct 05, 2016 11:53 am

Re: fast async load all assets?

Post by MrFariator »

You could only load the essentials (ex: code, config files), and then load the the rest when you actually need them (ex: textures, audio, video). Having everything in memory at once might help with any loading during gameplay, but it may not be a scalable solution, or asks for a decently big upfront load time.

You may also find benefits from combining assets, like combining textures to texture atlases or the like.
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: fast async load all assets?

Post by dusoft »

You can use "dead" parts of the game for loading, e.g. such as intro, logo screens, story displayed before game start etc. Also, merging multiple assets can help with speed, i.e. larger files are quicker to load than hundreds of small, individual files.

These are all tips on how to cope, not on how to load. Loading is just an operation as any other and players are used to seeing loading screens.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest