setVoxel queuing errors?


#1

I’m having a bit of trouble where my calls to setVoxel sometimes don’t work properly and I’m wondering if anyone else is seeing similar issues. At minimum it seems that there is a queuing problem or race condition, or perhaps I’m just asking it to do something that isn’t supported.

The basic issue is that my script is rapidly issuing a pile of setVoxel commands, including interleaved getVoxelAt calls and often setVoxel on voxels that I just recently set. I’m using the voxel space as a simple memory for my script, so it is important that if I set < a,b,c > to red, it’ll be red when I look again. But: while that appears to be true, it doesn’t always render properly. Usually the problem is missing voxels (holes in my build), but interestingly sometimes I see voxels that are filled but appear to be black. In my shared snapshot https://alphas.highfidelity.io/t/random-picture-thread/244/391?u=mthome you can see a hole near the middle left of the labyrinth.

The other symptom is that my build appears really quickly when I initially run the script, and then gets re-rendered slowly as the round trip data comes back from the server side - aside from being much much slower to draw (several orders of magnitude), it is clear that the errors are being introduced during this stage: somewhere between the packets that are sent from my client (from the local voxel cache?) and the world update packets returning from the server (see https://alphas.highfidelity.io/t/random-picture-thread/244/392 - the maze looked great until it started repainting from the server - oddly with the same row of voxels getting repainted a bunch of times).

Anyway - suggestions would be welcome!


#2

Hi @mthome. The issue is sometimes when running the script in an area that has a certain concentration of voxels it can cause issues when the script is creating the new voxels at a fast rate. If you were to build in a wait trigger and slow the script (perhaps a wait function between each voxel) it would fix the issue.


#3

Hmm - I see that you @KevinMThomas don’t seem to use waits/sleeps in your genesis projects… so now I’m wondering what the critical different between my use and yours is - your scripts generate far more voxels at a time and probably at a slightly faster rate, after all. I can think of two possibilities:

  1. My use of getVoxelAt is interacting poorly with the voxel system.
  2. I’m running at the wrong time or in the wrong thread - e.g. I’m generating directly in my script, not using Script.update.connect. (update: this doesn’t seem to make any difference - same errors).

Fun fun!


#4

@mthome I never said that I did use any sort of wait/sleep functionality I was simply stating that I was running into some similar issues in the past and asked at one of the alpha meetings and that was a suggestion.