Kloot wrote:Sorry, but get off your high horse.
Well Im sorry but if this si my high horse then Im going to have to kick a lot of other people off to claim it. Tobi included.
Jeff Attwood argues my case much better though:
May 19, 2008 - Twitter: How Not To Crash Responsibly
August 2, 2007- What's Worse Than Crashing?
May 18, 2008 - Crash Responsibly
Kloot wrote:
AF wrote:
* If your AI only supports a handful of games, make sure it tells the user when it finds itself running under a non supported game.
Requires maintaining either a whitelist or a blacklist, both of which are a PITA since games evolve much more quickly than AI's do.
So your saying my ABCAI which plays TA based mods should attempt to play kernel panic despite me having no intention of supporting kernel panic? Perhaps I should let my kernel panic only AI play fibre?
When you know for definite that your AI wont work under a certain game, you shouldn't attempt to play it anyway.
This is like saying we should all use the same lead and connectors for power cords and usb and kettles and microphones because we dont know how fast microphones and kettles are advancing.
Why am I sure that this is not me talking out my arse?
Because I have done it before
Kloot wrote:
AF wrote:
* Dont crash
1. Don't kick down wide-open doors. Your point is analogous to saying "don't ever make programming errors" which we would all like, maybe you're volunteering to formally verify correctness of all AI code?
2. AI's can crash through unknown engine inconsistencies, who'ya gonna call then? (most recent example: E323AI and
http://github.com/spring/spring/commit/ ... d25d7d1ae6)
When your code crashes, I suggest the following code as a safety net:
Code: Select all
try
{
// code here
}
catch (...)
{
// print out error to log
}
When a device or algorithm fails, and that failure is detectable, isolate and disable it to prevent further damage, and tell the user that something went wrong.
Why am I sure that this is not me talking out my arse?
Because I have done it before
Kloot wrote:
AF wrote:
* Don't continue to run code once you know that a crash is inevitable, check for a boolean if its ok to continue and halt before any AI routines are executed if its not possible.
Crashes actually tend to be unpredictable, any non-trivial code will have a chance of breaking even after adding the usual NULL guards or spamming try / catch blocks everywhere (which is itself bad practice). If it could be done so systematically all AI's would be crash-free by now.
NTai was built in such a way that there was a proxy class, a divide. this class was basic, and on one side was the engine, on the other side was the AI. When the AI crashed, the exception propagated up to this class were it was caught and added to an error log. A boolean flag was set and any further calls to the AI from the engine resulted in the following 1 liner at the start of every function failing:
While this code was simple, yes it could itself have crashed, however the chances of this code crashing were astronomically small compared to the AI code that could be sitting in the other classes. I would rather than code with a tiny chance of crashing caught my exception and printed it to a log, rather than my main code crashing and generating a cryptic message.
Why am I sure that this is not me talking out my arse?
Because I have done it before
Kloot wrote:
AF wrote:
* Stop continuing execution when an exception is thrown, and catch exceptions, don't let them propagate to the engine
I'd expect an AI dev who uses exceptions to also catch them, no?
Are you sure it was the AI developer who threw the exception? Or a library? perhaps it was the STL due to an unknown bug? Would I rather catch this bug so I can fix it in the next version? Maybe, or maybe I want an obscure crash and complaining users who give no useful information?
Why am I sure that this is not me talking out my arse?
Because I have done it before
Kloot wrote:
AF wrote:
* Write out error logs
* Collect bug reports on a crash
Still depends on the user to provide said logs, which is rarity for Spring crashes even.
Nonsense!!! NTai AAI OTAI JCAI all outputted logs. We AI developers asked for these logs on a regular basis, and these logs were detailed. Since the AI you worked on mainly is rooted in KAI which had most logging code removed or never used, you do not have the same experiences we do, and any AI developer whose written a major AI here will tell you logs are not just important, they are essential.
I personally would have been unable to fix, or severely slowed down if it weren't for logging in NTai, and I know submarine and veylon would say the same thing about AAI and OTAI.
Why am I sure that this is not me talking out my arse?
Because I have done it before