How do you handle unfound resources?

Posted by concept3d on Game Development See other posts from Game Development or by concept3d
Published on 2013-11-11T07:04:43Z Indexed on 2013/11/11 16:18 UTC
Read the original article Hit count: 233

For example your game expects a certain asset to be loaded what is the best way to handle it if the resource isn't found, for example:

Texture* grassTexture = LoadTexture("Grass.png");// returns NULL as texture is not found.

Mesh* car = LoadMesh("Car.obj");// returns NULL as 3d mesh is not found

What if for some reason the resource wasn't found e.g. deleted by user, misspelling while in development ?

  • Should I use Assertions (which is only useful while in development?
  • Exit the game gracefully ?
  • or even thrown an exception and try to handle it?

On a separate question, if I used a handle system instead of pointers (which I am already working on) I don't see how this would help me recover from unfound resources, Does a handle system help in situations like this?

© Game Development or respective owner

Related posts about c++

Related posts about resources