Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm writing a game using LWJGL and Java, and I was just wondering if there is a rule/recommended method for when to load resources. I have seen examples that load all of the resources at the initialization of the game (XNA), ones that load the new resources needed for each level while referencing the already loaded assets again, and ex

share|improve this question
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.