Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

The Frugal Gourmet

Improving graphics load time...

This topic is 5771 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just curious if anyone has any tips on improving the load time of sprites (or coming up with a system where it''s less essential). I am loading almost all my game''s sprites up front. Now that I have 24 or so (48 frames each), there is a noticeable delay at start up while it loads everything into memory. Since I plan to add more, I could forsee this eventually becoming a problem... I earlier tried a system whereby the game would load certain graphics when it encountered them, but there was that noticeable pause every time, and I didn''t think it was working well. Any suggestions? Tips?

Share this post


Link to post
Share on other sites
Advertisement
This depends a little on the game type and gameplay. It also depends on the size in memory of the things you are loading and whether memory will become a precious resource.

I would tend to want the time spent loading stuff at the start of the game rather than in the middle when I encounter stuff. When you hit momentary ''lag'' because the game is loading graphics, it breaks the suspension of disbelief and can ruin gameplay or even cause problems for players if the actionis real-time.

On the other hand, having too many graphics and other stuff loaded into memory may cause the game to run slower so you will have to balance that issue.

If you don''t unload graphics as you leave them behind then eventually you would build up to the point where they are all loaded into memory anyway. So you either want to also look at unloading graphics as you also continuously load them throughout the game or you will want to just load them all at the start while you play a little piece of music or something. :o)

Another option may be to load things continuously in the background using a separate thread or process but I''m not very well informed on such things so all I can do is suggest you look into it, hehe.

Share this post


Link to post
Share on other sites
It''s often faster to store them in a compressed format (lzo) and then uncompress as a good decompression algorithm can be faster than reading from the hard-drive.



mat williams
Lead Programmer, Designer
Zero Sum Software
www.zero-sum.com

Share this post


Link to post
Share on other sites
Thanks!

It sounds like you''ve encountered some of the very same concerns. I also found that loading things later on gives me that annoying pause which wasn''t worth it, but the load-time up front is quickly becoming less and less tolerable now.

I thought about just loading the "essential" sprites up front, and then having a background load (a different thread) gradually load things as I''m playing the game. If I encounter something before its graphic has been loaded, it will force a load of it (and there is a slight pause), but this will only happen in the first few minutes of playing then game. I thought with this method the delay before the user can play will be less intolerable, and the pauses will just happen sometimes in the first few minutes...

But, yeah, you''ve raised another issue too. My memory requirements are getting steeper and stepper. I hate to un-load anything yet, because it all seems so useful to have in memory... *sigh*...




Share this post


Link to post
Share on other sites
If you display a logo screen, and maybe a progress bar, while these things are loading, maybe the pause won''t be as much of an annoyance (to the potential user).

Just a thought.

Share this post


Link to post
Share on other sites
Is there any sort of menu system at the beginning? Like "start game", "options" etc.? Most of the time, you''ll be waiting for user input there, and the machine will just sit there doing nothing important. You could use that time for loading graphics. Once the game is started, you check if everything has been loaded, and if not, display a progress bar or so and load the missing stuff. That should at least reduce the amount of time spent waiting.

- JQ
Full Speed Games. Period.

Share this post


Link to post
Share on other sites
How about using threads? Will they work in your case?

You can just load the minimum files you need to play at the start. Then, while the user is playing, you can execute a thread and load the other images in the background. May be multiple threads, if you are willing to manage them.

Or will that be too much of a performance hit in your game? At least it should get rid of the pause during the gameplay.

Share this post


Link to post
Share on other sites
I really like the thread idea.

If you did that, you could have a piece of code ''predict'' what''s needed before the player reaches it, and also have it unload things it doesn''t need.

In the engine I''m working on all of the tiles are actually textures that get mapped to a 3d model of a ''tile'' at runtime. By this method, there isn''t a lot to load, and the work done by the processor is pretty minimal. It also saved me from having to draw, and fits in to my plan for ''ray-traced'' lighting (which I havn''t implemented yet).

Good luck,
Will

Share this post


Link to post
Share on other sites
I''ve also found that having a ton of classes initlized in the beginning can be very slow it runs faster if you initlize them ONLY when you need them and remove them when you are not using them. Also check around to make sure you have no memory leaks and such they can slow down your games well at least I have seen this to be true.

Killer Eagle Software

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!