• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
EarthBanana

Error handling

4 posts in this topic

I've been working on a few different projects - all of them I have handled errors in different ways. I am always unsure of myself when it comes to this - I never really know when I should let stuff fail - when I should print to log files - when I should return something indicating - when I should use error states - etc

 

I know its pretty common to let stuff that should break your code break it - so that there is a fixable crash - but I often find that when I do this I am allowing things that shouldn't break my code break it... like an assert(pointer != NULL) will result in a crash when some allowable condition is creating a NULL pointer.. Just some condition I didn't think about when I originally wrote the code

 

Anyways - you guys have any methodology to this - any things that you have found that work best for you for error handling in general? Any important remarks on logging? What level do you do the error checking and at what level do you handle it? Does anyone ever use standard exceptions?

0

Share this post


Link to post
Share on other sites
The company I work for basically makes a server that is a polling engine...so every time you allocate memory, convert something or call a function you check for success or failure. If you can continue on failure you fail over to another path if possible. When something happens (error, warning, status or information change) it is pushed to a log service. The log can be filtered for LOD and viewed in real time as well as be pushed asynchronously to file. If viewing the log through client you can reference objects it is related to (and eventually help). I would concentrate on making try catch blocks as discrete as possible and check everything before you use it. Investigate boost pointers. Structure code so if one thing fails you aren't screwed. Make your logging as rich as possible. A big thing that seperates us from competition is that you can identify problems....communications path, device and host problems with the log. Then if you have a support contract you can email it to us for help.
0

Share this post


Link to post
Share on other sites

I know its pretty common to let stuff that should break your code break it - so that there is a fixable crash - but I often find that when I do this I am allowing things that shouldn't break my code break it...

Making your code robust means, to let it run even if an error occurred. Error handling has only one important task: display an error clearly to the developer and user and gather as enough information to track it down. Obviously, one of the most clearly kinds of displaying an error is to let the code crash. And to be honest, many users will only react after a crash has occurred multiple times.

 

So, first of all try to find a way to clearly display an error:

1. Use asserts to catch development errors.

2. Catch exception and transform then into an user manageable bug message.

3. Include some auto-generated bugreports.

 

Then, try to make not fatal failure condition more robust. If you encounter an error, try to use some fallback mechanism, log the error, communicate the error to the user and continue. A typical example are missing textures. If you failed to load a texture, use a fallback texture (eg black texture), log the error, the texture glitch will be clearly visible to the user. But be careful about hidding some important failure conditions, if it is really hard to track or really important to be tracked, include a graceful crash.

Edited by Ashaman73
2

Share this post


Link to post
Share on other sites


A typical example are missing textures. If you failed to load a texture, use a fallback texture (eg black texture), log the error, the texture glitch will be clearly visible to the user. But be careful about hidding some important failure conditions, if it is really hard to track or really important to be tracked, include a graceful crash.

 

This is a good point - I actually do use a fallback texture for textures that failed to load and then log the mistake..

 

What about things like - assigning incorrect animations to some mesh - that is lets say that the animation bone structure does not match the mesh bone tree - If there is a GUI it is simple enough to alert the user "Can not assign animation to mesh because bones do not match" or something - but at the engine library level would we want to log this type of error and treat it much more seriously?

 

This is where I get most confused - where is the line of separation? When writing code that other software developers would be using should the errors have more harsh results than say.. GUIs? If I am writing a software library - should I be treating things like incorrect texture parameters, or possibly incorrectly named entities (if no two entities are allowed to have the same name) as reasons for complete failure of the function? Should assigning an animation to an incompatible mesh simply fail and have no consequence? or should it fail and log?

0

Share this post


Link to post
Share on other sites

This is where I get most confused - where is the line of separation?

There's no clear line. Here are some tips:

1. Robust code is nice, but it costs time and makes your code more complexe, so don't overdo it.

2. Make robust code for errors, which have limited effect on other parts of code. When you are unsure, that a certain error could result in more errors in other parts of the code, let it fail.

3. Make robust code where your team would suffer from work-in-progress states. E.g. missing animations, textures, game states etc.

4. Make hard, but graceful, fails, where it is important, that this part of the code should work and any error should be discovered as soon as possible.

5. Use macro controlled asserts to switch between robust- and fail-handling, robust for development time and fail handling for testing.

 

Displaying some information about errors on the gui will not be the best solution for end-users. Most, if not all, will just ignore it. If you want to detect an error, make a graceful fail + ready to send bugreport.

Edited by Ashaman73
2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0