Double Relic Explosion Message Bug and Holy Crap

Found a bug? Great! Post about it here!

Double Relic Explosion Message Bug and Holy Crap

Postby Ferret » Mon Oct 24, 2016 4:00 pm

Well, I finally found what causes this nonsense, and it was scarier than I thought. :P

The double message was amusing, but harmless.

What wasn't is that it actually causes crashes under relatively rare circumstances!

Fixed in the next build. Whew. Ugly bug to have had running about for so long, disguising itself as something minor.
User avatar
Ferret
 
Posts: 1785
Joined: Tue Sep 16, 2014 3:18 pm

Re: Double Relic Explosion Message Bug and Holy Crap

Postby mbj » Mon Oct 24, 2016 9:18 pm

Yay finally. What caused the problem? Were the enemies actually dying twice?
mbj
 
Posts: 116
Joined: Wed Apr 13, 2016 6:50 pm

Re: Double Relic Explosion Message Bug and Holy Crap

Postby Ferret » Mon Oct 24, 2016 9:56 pm

No, no enemy ever died twice. :D The function was run twice because it would hit an error during the first execution.

I had a bit of code something like this:

Code: Select all
while(list is not empty)
{
   list.RemoveAtIndex(0);
   list[0].DoThing();
}

Intending to do something to the top of the list, then remove it...

But the order there is very wrong. :P Not only did it mean I was never grabbing the right element, it also means list[0].DoThing(); can come up null because the list may well be empty after the removal.

When Unity encounters an issue of that sort, it stops and restarts the function again... of course, for the second run, the list is already empty (since that's what causes the code to fail) so it just never enters that code. This second execution is why the explode message prints twice.

The statements should have been (and now are) in the opposite order: do what I want with the top of the list, then remove it. :P

The only reason it wasn't a complete disaster was that this was only used for trying to figure out a new group leader for the summoner's former stable. It probably does explain why that frequently seemed to not actually work according to player accounts. :)
User avatar
Ferret
 
Posts: 1785
Joined: Tue Sep 16, 2014 3:18 pm

Re: Double Relic Explosion Message Bug and Holy Crap

Postby mbj » Mon Oct 24, 2016 10:39 pm

Does this also apply to that bug I found where the ukobach died twice from ignite? Does this also mean every group has a group leader that they follow around?
mbj
 
Posts: 116
Joined: Wed Apr 13, 2016 6:50 pm

Re: Double Relic Explosion Message Bug and Holy Crap

Postby Ferret » Tue Oct 25, 2016 12:11 am

Hmm... dying twice from Ignite... but that shouldn't be in this code, which is specific to assigning a leader when a summoner dies.

But yes, every group of enemies has a leader who manages the group's AI. The most noticeable thing is that when "wandering", it is the group leader who moves according to the wandering code, the rest are just following him. The main character is the 'leader' of the player's group, of course.

Behind the scenes, the leader also is where the group-level AI blackboard lives: when group members see something worth calling attention to their group, they more or less file a report with their leader, who shares it with any group members who ask. Obvious cases are things like "hey, I saw an enemy!": this way, it doesn't matter which member of a group sees an enemy, all are made aware of it and begin acting accordingly.

Note there are no physical constraints on this communication (i.e.: group members don't have to be in sight of each other to share information, though as a practical matter they almost always are, or at least close to it, since groups like to stick together), but I do limit it to acting on things reasonable players would see/observe. For example, the AI does not act with exact knowledge of things like status effect durations, since reasonable players do not track that sort of thing on a per status and per character for the most part.

Finally, most groups automatically assign a new leader if the current one is recruited, killed, or otherwise brought out of play. Summoners are a special case, since they have allies who are both in and out of the active world at any one time (groups cannot contain members that aren't active in the world, for various reasons.) As a result, I had to write a little code to custom-handle the scenario of a summoner dying.
User avatar
Ferret
 
Posts: 1785
Joined: Tue Sep 16, 2014 3:18 pm


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 9 guests