06 March 2016, 11:36 | #1 |
Registered User
Join Date: Oct 2015
Location: France
Posts: 82
|
Sprite multiplexing on Amiga
Hi,
Is sprite multiplexing on Amiga more suitable to make backgrounds composed of sprites with repeated patterns (changing POS,DATA,DATB registers with the Copper) or can it be really used to efficiently display lot of moving objects (on x and y axis) ? I'm used to sprite multiplexers on C64, I don't find Amiga sprite structures very easy to handle lot of objects. If doing a multiplexer with a single hardware sprite: The objects graphics must already reside in the sprite structure and be y ordered. If the objects are animated, new images of the objects have to be "blitted" into the sprite. I don't see a real advantage then to use hardware sprites compared to bobs for moving objects ... Unless I missed something. |
06 March 2016, 12:19 | #2 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
bobs have to be blitted using all 3 source channels (slowest way to blit)
bobs need to be "cleared", or have the screen data put back before re-plotting at a new position (slow) bobs also need to be shifted if they are to move smoothly in the X axis (adding an extra 2 bytes to the width of the blit) Even if you have to blit some data into the sprite (to animtate it for example), it is only an A->D quick copy blit.. and of course you could use the copper or blitter interrupts, so that the blitter is doing these things "in the background", while the CPU is getting on with other things. |
06 March 2016, 12:27 | #3 |
Registered User
Join Date: Jun 2014
Location: milan / italy
Posts: 174
|
You are right mixing control and data wasn't a smart choice.
Anyway, you can use the copper to change registers on the fly as you do with the c64. |
06 March 2016, 17:10 | #4 |
Registered User
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 213
|
yes you can do either a manual sprite with the copper or semi-automatic sprite multiplexers, where you have separate "sprite structures", each one to display a single sprite.
|
06 March 2016, 18:03 | #5 |
Registered User
Join Date: Oct 2015
Location: France
Posts: 82
|
Yes, effectively sprites are far less time consuming regarding blitter operations involved compared to bobs.
But how to make an efficient "semi-automatic" multiplexer on one or several hardware sprites ? - Order the objects according to their y pos. - dispatch the ordered objects into several sprite structures (if into SpriteN a previous object has not finished to be rendered for the Y start pos of the current object, skip to the SpriteN+1..etc.). Compute the sprite words control. - blit the images of the objects into the sprites structure. - Do that each frame And voila ? |
06 March 2016, 18:41 | #6 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
yes, something like that
and if the sprite list is already in y sorted order... then once all sprites have been moved to their new positions... up a bit, left a bit.. down a bit. right a bit.... you can be pretty sure that the list is still in a reasonabley "nearly sorted" order... and can be re-sorted really quickly, without needing to run a full sort algorithm on it The other thing you can do, is if it is not possible at all to find a free slot for a sprite (because of too many on the same Y band), then you could flag that sprite for that frame, not include it... but on the next frame include that one and not include another one.. this will cause them to flicker at 50hz.. which is better than totally not showing it |
06 March 2016, 20:51 | #7 |
Registered User
Join Date: May 2013
Location: Grimstad / Norway
Posts: 854
|
If you have a hw sprite with the full stop 0 data, will it re-start if you use the copper to write to the sprite registers again after the full sprite has been displayed?
I.e. can you re-arm the DMA sequencer? |
07 March 2016, 02:47 | #8 | |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
Quote:
Toni Willlen will know for sure,,, |
|
07 March 2016, 02:49 | #9 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
I am loading my SpritePtr's at line $10, giving me enough time in the vertical blank interupt to update everything that needs updating
|
07 March 2016, 09:09 | #10 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,575
|
Quote:
Non-DMA sprite mode should be always possible. (even when DMA is active) |
|
08 March 2016, 16:04 | #11 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,438
|
So, what does happen when you reset a sprite pointer midway through the screen?
The Codetapper sprite tricks site suggests that Stardust used this + setting new sprite pos/ctl values during the tunnel sequences to multiplex sprite images. But if I understand what Toni wrote this shouldn't work unless the sprite was never 'ended' in the first place. |
08 March 2016, 17:06 | #12 | |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Quote:
The problem is of course that pairs of sprites share the same palette, but this way you can atleast avoid the overhead of copying sprite data around in memory. |
|
08 March 2016, 18:55 | #13 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,575
|
I remembered wrong, it is possible to modify sprite SPRxPOS any time to restart sprite in DMA mode that has already "ended". Of course new sprite vertical position needs to be same or larger than current vertical position.
Hardwired sprite DMA enable line is 25 (PAL) or 20 (NTSC), line when first control words are always loaded. (if sprite DMA is enabled) |
09 March 2016, 19:12 | #14 | |
Registered User
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 213
|
Quote:
|
|
10 March 2016, 10:47 | #15 |
Registered User
Join Date: Sep 2011
Location: Paris/France
Posts: 278
|
Hello
Is there some available sources that show those beautifull coding tricks ? Alain Thellier |
10 March 2016, 18:11 | #16 | |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
Quote:
Just a few minutes "tinkering" you can get something working that follows some of what was written above |
|
10 March 2016, 19:12 | #17 |
Registered User
Join Date: Aug 2006
Location: Finland
Age: 52
Posts: 244
|
hmm.. one crappy demo I did in past had sprite playfield and other stuff done using repeating sprites: http://kestra.exotica.org.uk/files/s...5000/7322c.png
Loads of copperlist stuff to poke sprite registers. The sinus scroller is on a 1 color "sprite playfied" on a top of a 16 color picture, the animated 4 color knobs are also sprites and far at the right side is (not shown now) is another 16 color sprite to hide the overscan scroll register caused whatever crap there always was by displaying part of the logo in that sprite I have no idea what I did back then anymore, though.. but can try to look for sources.. |
12 March 2016, 20:19 | #18 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,553
|
Quote:
Sprite 0 is displayed at VPOS 100 with a single line. At VPOS 101 Agnus reads SPR0POS=0 and SPR0CTL=0, which means the sprite display list has ended for this frame. Now I want to display a second sprite display list on channel 0 starting at VPOS 200. My copper list waits until a line between 101 and 200 to set the SPR0PT to the new display list. Then it writes SPR0POS and SPR0CTL to re-arm the DMA channel. Is that correct? |
|
13 March 2016, 13:54 | #19 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
If what Toni says is correct, then yes, that should work.
I need to do something similar myself, probably this week sometime, as I just don't want to be building huge sprite DMA lists, when I can easily use the copper to write new pointers, and re-arm the DMA with a quick couple of copper moves (ie. for large animated sprites that will be "plexed" vertically). I will post the results of my experimentation here |
13 March 2016, 16:38 | #20 |
Registered User
Join Date: Oct 2014
Location: Germany
Posts: 195
|
Interesting sprite bonus infos! Just one thing: I did not end my sprites with $00000000, because my sprites are bigger than the screen and sometimes I am a lazy cow.
Instead I used the copper and just disabled sprite-DMA with dc.l $00960020 ...and moved the sprites into the horizontal blank. It seems to work, but should I expect strange side effects? |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Settlers sprite | zdechlak | project.Sprites | 1 | 02 March 2019 10:55 |
Best sprite scaling/Doom style engines on Amiga? | ImmortalA1000 | Amiga scene | 95 | 23 July 2018 00:17 |
Amiga Sprite/Tile Cross-Platform Software? | diablothe2nd | Amiga scene | 16 | 12 July 2013 17:29 |
sprite overscan | jamiejamie | Coders. General | 11 | 02 February 2011 16:59 |
DIWSTART and sprite | Camionsauro | Coders. Tutorials | 3 | 22 April 2009 13:24 |
|
|