Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a game using LWJGL and Java, and was wondering if there were best practices for when to load resources.

I have seen examples that load all resources when initializing the game (XNA), ones that load the new resources needed for each level while referencing the already loaded assets again.

share|improve this question

It depends on how many resources you have and how they perform with your game. I recommend to start with a simple solution, which means loading all the assets at the beginning, so you can use them anytime. Once the game performs slowly because of the memory problems consider writing some kind of manager, which will load assets in a smarter way.

What I recommend is to ready all your assets through a "dummy" manager, which will at the beginning just load all the resources and provide them. But your code will treat it as a black box providing assets. If you need to make changes, then you just change the manager and not game code. Once the game gets slower, you can add simple tricks to your manager. For example, it can watch what assets are requested per level and pre-load them for this level and drop those that are not used, which would be the first optimization I would do in your case.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.