News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Skunkfish

Animating sprites on the Plus

Started by Skunkfish, 15:11, 19 January 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Skunkfish

Is it possible to animate hardware sprites on the Plus without using multiple sprites?

If it is achievable, is it possible at a decent speed?
An expanding array of hardware available at www.cpcstore.co.uk (and issue 4 of CPC Fanzine!)

roudoudou




it's possible but you will need a huge amount of memory (who cares if you make a cartridge?)


there is many optimisations like only poke the differences in your animation, use stack to push values and keep redondant values in registers


if you have many sprites to update each frame, you will also need a clever manager to avoid screen refresh artefact (if you know you need kind of 20 raster lines to upate, then you can update when you are 20 lines before the sprite, or right after it. You can either compute the value or use dma-list)
My pronouns are RASM and ACE

andycadley


There are other tricks too. Maybe you don't need to update at 50fps and can arrange for things to happen over multiple frames. Or maybe your sprite animations cycle in such a way that you can avoid two having the same frame at any one time, then dynamically assign a hw sprite to an object on a frame-by-frame basis.


JSW+ manages 25fps with updates to all 16 sprites. It's having to decompress them on the fly (128K isn't enough and RAM paging doesn't play well with the ASIC register paging), so it's partially cheating - the "walking willy" life animation only decompresses one frame then blats it across the rest and only half the nasties move on each frame. It works pretty well, I found, but I'd probably go cart for anything with lots of sprites in future as it makes life a lot easier (especially given there is no real cost to a 512K cart these days!)

Skunkfish

Thanks for tips!

And I'm assuming there's no shortcut for rotating/mirroring sprites?
An expanding array of hardware available at www.cpcstore.co.uk (and issue 4 of CPC Fanzine!)

fgbrain

sorry to bring this old thread back...

I thought of an easy routine to vertically flip a hardware spite..
Requires a copy of the sprite in RAM to work.



;  DE = sprite in ASIC ram
;  HL = sprite sprite in RAM
;
; sets sprite  upsidedown
;
ld bc,16*15:add hl,bc  ; HL = last Y line
ld a,32:   ; will use A = 32 to reset C 15 times
ld c,16:ldir ;line 0
ld c,a:sbc hl,bc:rr c:ldir ;line 1  ;  C = 32 to  move HL to previous line Y-1 and go on then   C = 16
ld c,a:sbc hl,bc:rr c:ldir ;line 2
ld c,a:sbc hl,bc:rr c:ldir ;line 3
ld c,a:sbc hl,bc:rr c:ldir ;line 4
ld c,a:sbc hl,bc:rr c:ldir ;line 5
ld c,a:sbc hl,bc:rr c:ldir ;line 6
ld c,a:sbc hl,bc:rr c:ldir ;line 7
ld c,a:sbc hl,bc:rr c:ldir ;line 8
ld c,a:sbc hl,bc:rr c:ldir ;line 9
ld c,a:sbc hl,bc:rr c:ldir ;line 10
ld c,a:sbc hl,bc:rr c:ldir ;line 11
ld c,a:sbc hl,bc:rr c:ldir ;line 12
ld c,a:sbc hl,bc:rr c:ldir ;line 13
ld c,a:sbc hl,bc:rr c:ldir ;line 14
ld c,a:sbc hl,bc:rr c:ldir ;line 15



You can of course unroll the LDIR command and use 16x LDIs instead...
_____

6128 (UK keyboard, Crtc type 0/2), 6128+ (UK keyboard), 3.5" and 5.25" drives, Reset switch and Digiblaster (selfmade), Inicron Romram box, Bryce Megaflash, SVideo & PS/2 mouse, , Magnum Lightgun, X-MEM, X4 Board, C4CPC, Multiface2 X4, RTC X4 and Gotek USB Floppy emulator.

Powered by SMFPacks Menu Editor Mod