Author Topic: This array is fixed or temporarily locked.  (Read 1849 times)

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
    • Games And Electronica
This array is fixed or temporarily locked.
« 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.
The internet is corrupt and controlled by criminally minded people.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
This array is fixed or temporarily locked.
« Reply #1 on: October 17, 2006, 10:03:46 AM »
Sim Please....
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7722
    • View Profile
This array is fixed or temporarily locked.
« Reply #2 on: October 17, 2006, 11:39:36 PM »
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.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
This array is fixed or temporarily locked.
« Reply #3 on: October 18, 2006, 01:15:01 AM »
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...
Many beers....

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
This array is fixed or temporarily locked.
« Reply #4 on: October 19, 2006, 03:49:18 PM »
Quote from: Testlund
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!
Many beers....

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
    • Games And Electronica
This array is fixed or temporarily locked.
« Reply #5 on: October 20, 2006, 06:31:31 PM »
Quote from: EricL
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.
The internet is corrupt and controlled by criminally minded people.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
This array is fixed or temporarily locked.
« Reply #6 on: October 20, 2006, 06:37:53 PM »
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.
Many beers....

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
This array is fixed or temporarily locked.
« Reply #7 on: October 21, 2006, 03:39:07 PM »
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.
Many beers....