Page 1 of 1

Artifacts on astrofora/starfield sample

Posted: Mon Feb 18, 2019 8:21 pm
by vnsbr
I have tested astrofora/starfield_donut demo in some emulators and im getting these strange artifacts, lastest SGDK version from git.

I have to admit I never tested with older versions, but it doesnt seem right :P only the top ones seem to be updated correctly

Edit i was doing stress tests in my application, i am using bundled sprite engine and controlling frames directly. I noticed that if i have lots of stuff in the screen but i dont change frame animation fps keeps at steady 60fps. But when i change frame, say 6/second, fps can drop to as low as 30 fps( there is collision code sumed to both cases).

I noticed that this sample does things a bit different. Even though the perfomance is good i see there are these artifacts

Re: Artifacts on astrofora/starfield sample

Posted: Tue Feb 19, 2019 8:56 am
by Stef
Artefacts are expected as we reach the limit of sprites per line. Also there are different way of displaying these animated sprites on screen. If you re upload frame data for all sprites it will be very slow (but can be a good benchmark), if you pre upload all animations to VRAM then just change VRAM index for sprite it will be much faster (60 FPS easily).

Re: Artifacts on astrofora/starfield sample

Posted: Tue Feb 19, 2019 10:27 am
by vnsbr
Nevermind, i am checking spr_test.c from samples, and seeing benchmark there, thanks :D

I guess these are these methos fastest ones?

Initialization

Animation* anim = donut.animations[0];
(...)
TileSet* tileset = anim->frames->tileset;
VDP_loadTileSet(tileset, vramIndex, TRUE);

(...) After creating sprite
SPR_setAutoTileUpload(spr, FALSE);
(...)
/* Manually set VRAM index */
SPR_setVRAMTileIndex(spr, animVramIndexes[((s >> 4) + i) & 0x7]);


Main Loop

SPR_setVRAMTileIndex(spr, animVramIndexes[((s >> 4) + i) & 0x7]);


I found it strange that in the complete initialization it is not incrementing "s" like in the main loop, maybe that is a bug.