Hi, after experiencing some crashes with AI i have a suggestion. As far as i got it, most of the Crashes come along, because one of the Units is not giving back correct data, cant be identified or so on.
My Request: Can`t the AI forget most of its own Units & Buildings instead of Crashing and re-start again, as if the Old Things didn`t exist any more for it, just some Ally/Neutral Object to ignore ? That way a CON-Unit or the Com would still be active after the worst -
AI Crashavoid
Moderators: hoijui, Moderators
Invalid data is returned on enemy units, and it only really happens to allied units in the most obscure situations imaginable.
What you suggested as a solution is somewhat vague and I havent a clue what exactly you mean. But this should all simply be solved by checking retrieved data for error values and handling them accordingly...
What you suggested as a solution is somewhat vague and I havent a clue what exactly you mean. But this should all simply be solved by checking retrieved data for error values and handling them accordingly...
So this Crash is avoidable ? - i just had some kind of reproducable AI Crashes when i built some Units and send them to them into the Defenses. There was the Line - UnknownUnit or something like that ... so i thought it might just forgotten its own Units.
Such things happened with fighters before, who were send to left upper Corner and were forgotten there, although they could have done terrible Damage to my Base. I imagined it as some Kind of "freeze" because of that failed attempt.
My (wrong) Suggestion was, if the AI can`t find this Units in its "Memory", it should not even try to search for them anymore, and give up whatever it had done till that Moment - starting from Zero. Just imagine it building a CommanderDouble - dropping it somewhere in your Backyard and that fellow begins the same "Programm"..
But that was mainly Missunderstanding on my part! Thx AF - how do you intend to solve that invalid Enemy Units Positions/Unittypes Problem?
Such things happened with fighters before, who were send to left upper Corner and were forgotten there, although they could have done terrible Damage to my Base. I imagined it as some Kind of "freeze" because of that failed attempt.
My (wrong) Suggestion was, if the AI can`t find this Units in its "Memory", it should not even try to search for them anymore, and give up whatever it had done till that Moment - starting from Zero. Just imagine it building a CommanderDouble - dropping it somewhere in your Backyard and that fellow begins the same "Programm"..
But that was mainly Missunderstanding on my part! Thx AF - how do you intend to solve that invalid Enemy Units Positions/Unittypes Problem?
So this Crash is avoidable ? - i just had some kind of reproducable AI Crashes when i built some Units and send them to them into the Defenses. There was the Line - UnknownUnit or something like that ... so i thought it might just forgotten its own Units.
Such things happened with fighters before, who were send to left upper Corner and were forgotten there, although they could have done terrible Damage to my Base. I imagined it as some Kind of "freeze" because of that failed attempt.
My (wrong) Suggestion was, if the AI can`t find this Units in its "Memory", it should not even try to search for them anymore, and give up whatever it had done till that Moment - starting from Zero. Just imagine it building a CommanderDouble - dropping it somewhere in your Backyard and that fellow begins the same "Programm"..
But that was mainly Missunderstanding on my part! Thx AF - how do you intend to solve that invalid Enemy Units Positions/Unittypes Problem?
Such things happened with fighters before, who were send to left upper Corner and were forgotten there, although they could have done terrible Damage to my Base. I imagined it as some Kind of "freeze" because of that failed attempt.
My (wrong) Suggestion was, if the AI can`t find this Units in its "Memory", it should not even try to search for them anymore, and give up whatever it had done till that Moment - starting from Zero. Just imagine it building a CommanderDouble - dropping it somewhere in your Backyard and that fellow begins the same "Programm"..
But that was mainly Missunderstanding on my part! Thx AF - how do you intend to solve that invalid Enemy Units Positions/Unittypes Problem?
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
picasso, if the AI tries tor etrieve a untidef for a unti it shoudlnt be able to get info about ti gets passed back a null pointer. Any attempt to use that point generates an access vioaltion error which crashes spring.
the unknown unit message you speak of I dont know about, obviously the error was caught and something else causes the crash.
I assume you speak fo AAI? Or is it TSI?
The corner bug is caused by nto catchigne rror values. Spring returns 0,0,0 or 0,1,0 as error values for positions, aka the corner. In AAI/NTai when the corner bug occurs its because the AI decides where to attack based on a threat matrix, and thus it polls all the enemy units on the map, assigns them a threat value then puts it on the map, but if the engien returns an error value and it isnt caught then that value is added to the corner of the threat matrix and the AI ends up picking the corner as its target because of the high matrix value. In OTAI it would attack the nearest unit so if it got an error value it would send them to 0,0,0 hence another instance of the corner bug.
the unknown unit message you speak of I dont know about, obviously the error was caught and something else causes the crash.
I assume you speak fo AAI? Or is it TSI?
The corner bug is caused by nto catchigne rror values. Spring returns 0,0,0 or 0,1,0 as error values for positions, aka the corner. In AAI/NTai when the corner bug occurs its because the AI decides where to attack based on a threat matrix, and thus it polls all the enemy units on the map, assigns them a threat value then puts it on the map, but if the engien returns an error value and it isnt caught then that value is added to the corner of the threat matrix and the AI ends up picking the corner as its target because of the high matrix value. In OTAI it would attack the nearest unit so if it got an error value it would send them to 0,0,0 hence another instance of the corner bug.
The only real way to fix the crashes is to fix the bugs in the AIs. Writing uncrashable code in C++ isn't that hard actually, as long as you keep a few things in mind:
- always make sure pointers can not be NULL, or use them only after testing them for NULL.
- always check return value of a function that may fail (theoretically meaning basically every function, especially file operations are important.)
- just don't assume too much, e.g. don't assume config files are in a certain format: the user could have borked them, display an error, don't crash
- always make sure the divider in divisions isn't 0