spritesort reduces spriteflicker

Page 6/13
1 | 2 | 3 | 4 | 5 | | 7 | 8 | 9 | 10 | 11

By hit9918

Prophet (2868)

hit9918's picture

23-03-2010, 21:37


Now, for example, using a resolution of 256x192 @60hz, with sprites on, give 2880 bytes / frame for a HMMM operation, thus 170kb /sec

2880 / (256 / 16) = 180 lines. this the raw figure. ARTRAG reported overhead problems with a tile aproach at the border.
Generally the topic "real life overheads" runs my head. What is it that slows salamander. The toughest thing I can think
of is collision detection of number of player bullets multiplied with number of enemies.

2 options, uplaser + 2 bullets + 2 missiles, and 20 critters onscreen. 3 * (1 + 2 + 2) * 20 = 300 combinations.
I wonder whether enemies check player bullets by reading nametable vram. So what if the bullets are sprites
or you got no charset mode - then drawing bulltets to a tile RAM might be a method for collision detection.

On the other hand. If one collision check takes halve a rasterline. Then 300 times means 150 rasterlines.
And there is not much left to do, all charset action is like 5 fps.

By hit9918

Prophet (2868)

hit9918's picture

11-01-2011, 01:08

A new version of spritesort is ready! Get demo and source at http://jf.peer.name/msx/spritesort.zip . Insert directory "msxfiles" into emulator.

Completely rewritten, faster, more features:

chained sprites:
make multiple sprites one piece. Look at the demo, you can't tell that things are made of multiple sprites B-)
I had issues with flickering multicolorsprites, their pieces wobble versus each other, this is now gone. Also no more layer confusion as sprites touch each other.

z-sort:
control which objects are on top of others (I did not test whether this works).
After spritesort sort the pointerarray "spsshown" to your needs (do not touch the other arrays).
You then got an engine that is both z-capable and can flicker.
Sidenote, the sort better not cut spritechains in pieces.

retro competition:
look, a red+darkred sprite, and a blue+darkbue one, and a green+darkgreen one: you dont see this on the C64.
Its colorsprites got all the same color except one individual color.
C64 of course too can overlay multiple sprites, but there is not much room for this in action games.

And by the way NES backgrounds got 4 colors within a 16x16 pixel area, and my tanks got 5 colors B-)

By LeandroCorreia

Paladin (944)

LeandroCorreia's picture

11-01-2011, 11:13

I wonder if games as Golvellius or Final Zone could be patched with these cool routines... Wink

By PingPong

Prophet (3459)

PingPong's picture

11-01-2011, 20:19

@hit9918:
i wonder how much cpu time are you using for these sprites.
have you took into consideration to implement this on msx2 machines?
(you have to take in account sprite rotation that move also color attributes and 8 sprites/scanline)

By Manuel

Ascended (15802)

Manuel's picture

11-01-2011, 23:06

That looks pretty cool indeed!

By tcruise

Master (131)

tcruise's picture

12-01-2011, 04:08

Very impressive indeed - have tried it in emulation - but also look forward to seeing it running on a physical machine, so will try that soon. Documentation in the code is very good too - you are to be commended!

By MäSäXi

Paragon (1884)

MäSäXi's picture

12-01-2011, 09:31

No vähäkö siisti!!!! (transl: How Cool!!!!!) Big smile

And smoothly scrolling Nemesis in same package!!!! Please add player ship and collision detection and make it possible for player and enemies to shoot each other and I will play this!! LOL! At last, now I saw how smoothly scrolling nemesis would look like!!!! Big smile

By Huey

Prophet (2644)

Huey's picture

12-01-2011, 11:53

Nice tech demo indeed.

No vähäkö siisti!!!! (transl: How Cool!!!!!) Big smile
At last, now I saw how smoothly scrolling nemesis would look like!!!! Big smile

Nemesis has some technical features/limitation that make it impossible/too hard to use this kind of scrolling.

But I agree with MaSaXi; I really like to see this routine in the form of a game!!!

By hit9918

Prophet (2868)

hit9918's picture

13-01-2011, 15:20

@hit9918:
i wonder how much cpu time are you using for these sprites.

@PingPong:
Spritesort takes one rasterline per sprite. I couldn't live without it. Would be nice to see it in MSXDEV games.

Unlike the demo http://jf.peer.name/msx/demo20101001.zip , this time I made a more calm demo so you can see multilayer sprites passing each other without layer confusion.


have you took into consideration to implement this on msx2 machines?
(you have to take in account sprite rotation that move also color attributes and 8 sprites/scanline)

It reminds me that you talked about turning off sprites:

Let spritesort set/clear a 5th flag in the flags byte of the sprite. The easiest way to do this, right after the calls to spritesort, simply walk "shown" and "5th" array.

And the dump to SAT then does set Y to invisible if the 5th flag is set. The dump is to be run trough a separate pointerarray which is not juggled by spritesort but simply containing the sprites in the same order as the SAT.

I think that's it. A feature of the 9918 version gets lost, the ability to go beyond 32 sprites with little consequences.
One could flicker with a second SAT (which runs its own separate spritesort). This would mean always all sprites flicker till the 32nd enemies are gone. Or maybe moved by special code as bubbles get free in first SAT.

Further the 9938 version no more can dump the 5th sprites to SAT. On 9918 I dump them to the end of the SAT, e.g. a sprite where only 1 scanline gets lost does still show 15 scanlines.
Cant do this on 9938 because of fixed SAT and turning off the 5th sprites.

By hit9918

Prophet (2868)

hit9918's picture

13-01-2011, 15:44

but also look forward to seeing it running on a physical machine

Please alert me if things do not run on a real MSX! 64k RAM needed.

My slotcode is wrong but I think it still works as long as subslot machines got 64k in same subslot as system area. And as long as expansion cartridges got no subslots. And the BASIC loader might even work thru casette port.

Page 6/13
1 | 2 | 3 | 4 | 5 | | 7 | 8 | 9 | 10 | 11