Archive: strange behaviour in Movement


4th September 2009 19:56 UTC

strange behaviour in Movement
reference: thread in GD

See attached preset, Here's a screenshot for comparing reasons.

Someone wants to run AVS on a 50x10 LED display and wanted suggestions as for which presets to use.

For that purpouse, I made this mosaic-like filter that would create a 50x10 grid to put at the bottom of a preset. (I omitted the y-axis for testing reasons.)

What happens, is that everything between x=.12 and x=0, x=0 and 0.4, and x=-0.4 and x=-0.8 are bundeled.

Does this only happen on my machine? If not, does anyone have a suggestion? Is my code faulty?


4th September 2009 21:52 UTC

i have no idea, but i have to say i kinda like that preset. remove that white line, make it much slower and maybe some random mirrors :)


4th September 2009 22:27 UTC

All the colors are created by the Colorfade and the Water filter (basically my default testing background). I slowed it a bit down but the Colorfade isn't really tunable in the way I'd really wish. The step-size of the sliders isn't big enough for this use.

Disabling the second EL significantly boosts the FPS

Added some other crap too. Enjoy it. :)


5th September 2009 00:49 UTC

love that second version, man! the first version created an urge to play super mario kart on the snes :)


7th September 2009 13:59 UTC

Your code looks correct (if a bit silly, all those if function calls), but its easy to slip up with huge statements like these.

I'd recommend something that actually rounds all x's to the nearest 0.04 or whatever... but thats not really the best way to do a mosaic either. Something like x=floor(x*25)/25; should do the trick though.


7th September 2009 14:45 UTC

I guessed there would be a better solution, but lazy as I am I went for the straightforward option.
I tested it your method, and it works fine if you use

x=floor(x*25)*.04;
y=floor(y*5)*.2

That fixes the problem for testing presets for a LED display, but I'm still wondering what could cause the shown behaviour in the first version.

Ah, well.. there are more (important) bugs in AVS.

Thanks, J


9th September 2009 08:09 UTC

I took a fresh look at the code and managed to spot the problem:

if(above(x,.8),.10,
if(above(x,.4),.6,
if(above(x,0),.2,
if(above(x,-.4),-.2,
if(above(x,-.8),-.6,

.6 should be .06, .2 should be .02, etc...

Classic. Its always these kinds of mistakes which are hardest to debug. I scanned over that bit of code at least four times before I realised this...

If it makes you feel any better I spent three hours at work a couple of weeks ago debugging something which was just missing a "!" (not) from a boolean condition. Its not the first time thats happened to me either...

There is a lesson here though, don't write really long code where a couple of lines suffice - it increases the probability of human errors slipping in. Although I guess it doesn't help much if you don't know the rounding "trick". :)


9th September 2009 14:50 UTC

:o ... I can't count.

Thanks for finding it.
These are, indeed, the hardest to find.

The positive side here: The preset above looks like crap with a correct Movement. :)