Darwinbots Forum
Code center => Bugs and fixes => Bug reports => Topic started by: Testlund on October 17, 2006, 06:03:43 AM
-
DB crashes for me displaying this error message quite often when I start a new sim. Also I'm wondering if the program has gone slower again. Allready with 1000 objects on screen it hardly runs at all.
-
Sim Please....
-
This is an issue with resizing either the robot or shots array. No idea what causes it, but it's something weird in the VB virtual machine (meaning I doin't think it's directly DB's fault, but there's probably a fix). It should only happen if your starting a new sim after another sim has been running.
-
Its the shots array. It's a VB runtime timing dependent problem related to rediming an array with preserve when elements of the array are referenced on the stack. I'm probably going to have to change the whole thing to a linked list or something...
-
Also I'm wondering if the program has gone slower again. Allready with 1000 objects on screen it hardly runs at all.
I've been doing a lot of profiling for the next drop. Lots of perf improvements coming. One thing though is that Planet Eaters is tremendously costly, the most costly thing in the code by far. Try turning in off and see the difference. In the sim you posted recently, turning it off sped things up for me by a factor of 5!
-
Try turning in off and see the difference. In the sim you posted recently, turning it off sped things up for me by a factor of 5!
Sorry to hear that because I want the bots to get into nice colonies. By the way, the fixed array mensioned above happens quite often when I try to start a new sim. It saves the sim as error.sim but loading that will not reproduce the error, so the error isn't saved. You could try and quit and restart DB and start a new sim with the settings I uploaded earlier.
-
It doesn't reproduce from the error.sim becuase shots arn't saved in sims and the problem is with the shots array. It's also timing dependent so I've never been able to reproduce in while running under the IDE.
I'm going to re-architect the shots array to fix it right at some point, but I'll try a couple of cheap things for the next buddy drop.
-
I managed to catch this in the IDE. I have a therory...
The error occurs when the shots array is being redimensioned in CreateShot. This happens when the array is size N and there are already N shots in the sim and the N+1th shot needs to be created. CreateShot() gets called from several places including UpdateShots when say, a new energy shot needs to be created as a result of an impact with a -1 shot or from places like MakePoff() where Poff shots get created. I'm pretty sure the locking problem has to do with something VB is doing farther up the call call stack and what I just noticed is that the calls to CreateShot() from UpdateShots() are inside a With Shots(t) statement but the calls from MakePoff are not. This could explain the itermitent nature of the bug. If the N+1th shot gets created as a result of a Pof shot, no error. BUt if as a result of one of the calls from UpdateShots(), the error occurs.
Do people who encounter this frequently run without Poffs? That could explain the increased frequency for them.
I've changed UpdateShots() to no longer use the With statement (fix is in 2.42.8c and beyond). Time will tell if this makes a difference.