![]() |
![]() |
#1 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
|
Free Form Sprite Layer example + source
Ever since reading the article on Risky Woods over at codetapper.com, I've wanted to try to create a different sprite layer. After some experimentation, I've succeeded in creating a copper list that allows for a 'Free Form' sprite background, which is to say one without any need for repeating patterns. While the DMA cost is high (the copper list is 'kinda big'
![]() I'm not sure how useful it is (considering the DMA & memory cost) - or if it was already known/used elsewhere - but I liked the effect a lot anyway so I made a YouTube video and wrote an article about it showing how it's done. I've also included the full source code for those interested, and if you like it - please use it as you see fit (note that the tiles I used are ripped from Turrican II and the startup code is by Photon of Scoopex). Hope you guys find it useful or neat. The article/source can be found here: http://powerprograms.nl/amiga/spr-layer.html Here's the video: [ Show youtube player ] |
![]() |
![]() |
#2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,246
|
Great 'racing the beam'
![]() +1 for the article, source and video. Yes, a bit expensive on DMA and memory ![]() Cheers. |
![]() |
![]() |
#3 |
Registered User
Join Date: May 2013
Location: Grimstad / Norway
Posts: 818
|
About doing it with the blitter instead; for a general masked copy (basically a cookie-cut) you nearly run out of cycles in a single frame. (Assuming only updating 2 bitplanes.)
The interesting thing would be if it is possible to do in 32 colours too? If not, what if you use a narrower display? |
![]() |
![]() |
#4 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,267
|
If you had shown this on an A500 in 1987, people might not have believed it. Very good demonstration of pushing the hardware to its limits!
|
![]() |
![]() |
#5 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,246
|
Quote:
Well, potentially you could make a totally free 3+3+3 colours 3 playfields (FG/BG/SP) game ![]() Next step for this effect: make a full screen sprites plane full animated (like Apydia one) but free form. ![]() |
|
![]() |
![]() |
#6 |
Registered User
Join Date: Jun 2014
Location: milan / italy
Posts: 169
|
Great work and article. Thanks for sharing.
|
![]() |
![]() |
#7 | |||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
|
Quote:
Quote:
![]() A 5 bitplane screenmode gets you one extra sprite drawn every 36 pixels (instead of the 4 bitplane screenmode's 24 pixels). Essentially, the maximum width you can then generate comes to 192 pixels* for a static layer or 176 pixels for a scrolling layer. So no, it's sadly not really viable at 5 bitplanes. *) 128/36 = 3 extra sprites, during which you can manage one more sprite = 128 + 4*16 = 192. Quote:
![]() |
|||
![]() |
![]() |
#8 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
|
A small, but sad, update.
Yesterday, I tried creating an AGA version of the above using 16 colour sprites. The idea being that I'd use the first 8 channels in the AGA 64 pixel wide sprite mode (attached - so covering 256 pixels) and then fill the remaining pixels using 16 pixel wide (again attached) sprites. This switch between 64/16 pixel sprites would be needed because the Copper cannot reload the data of 64 pixel sprites ![]() To do so, I dynamically set the FMODE register to 64 bit sprites for the first part of the scanline and then to 16 bit sprites for the remainder. On WinUAE, this actually works. Sadly, on my real A1200, it doesn't work ![]() It actually acts rather strangely - instead of resetting the sprites to 16 pixels, it resets them to 32 pixels instead (which is useless as 32 pixel sprites can't be reloaded using the copper either as I understand it). However, that's not all - changing the FMODE register mid-scanline causes a 16 pixel gap to appear in the middle of sprites at the point where FMODE register is changed. Considering the Copper isn't faster on AGA (and thus can't update 16 colour sprites quickly enough if they're only 16 pixels wide), this unfortunately means that a 16 colour free-form sprite background isn't possible, even using AGA. |
![]() |
![]() |
#9 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,246
|
Hi roondar, can you try without 32bit mode but only double CAS? (FMODE=B then FMODE=3).
Yes, you can cover only 128bit but it's just to help Toni to make a precise AGA emulation (seems that the fetch do not change between 32 to 16 bit..). ![]() |
![]() |
![]() |
#10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 26,080
|
Could you attach test executable? I'd like update emulation to handle this special case. (It does not matter if it is totally unusable situation!)
|
![]() |
![]() |
#11 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
|
Quote:
![]() Quote:
If you want I can also attach the source code (though that'll be quite messy - the test was a minor change based on my original OCS code with alot of stuff commented out etc). |
||
![]() |
![]() |
#12 | ||
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,616
|
Amazing stuff... Thanks, Roondar...
![]() Just a question, though: you wrote: Quote:
one? Quote:
![]() 19 32x32x5 BOBs seems to be a bit high of a BOB count here to me, even with triple buffering. I get around 14 with that method. Care to explain what you might be doing different here? ![]() Last edited by Tigerskunk; 24 September 2018 at 13:33. |
||
![]() |
![]() |
#13 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 26,080
|
Quote:
|
|
![]() |
![]() |
#14 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
|
Quote:
Quote:
![]() No problem, it's attached to this post. |
||
![]() |
![]() |
#15 | ||
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,616
|
Quote:
Why do the attached Sprites take double DMA time, though, I wonder... Isn't it the same amount of sprite-positions that I need to rewrite riding the beam? Quote:
![]() 19 sounds like a loooooot of BOBs to me in one frame. Even with triple buffering. |
||
![]() |
![]() |
#16 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
|
Quote:
Quote:
However, if you're just doing an up and down weave like my example does, it's definitely possible. As an example, I've ripped the background layer out of my example (bobs are still fully cookie-cut tripple buffered ones) and upped the number of bobs until no more would fit in a frame. Turns out it can manage 20 of them while still updating the foreground scrolling data and running at 50Hz on an A500. I'm reasonably sure you'd be able to do 21 if no tiles need to be updated. I've attached the modified program below so you can see it for yourself, always nicer than me saying stuff ![]() -- Do note that my program does use a 288x240 pixel screen (+16 pixels fetched for scrolling). A 320x256 scrolling screen will lose about two bobs in a frame. |
||
![]() |
![]() |
#17 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 26,080
|
I did some quick tests and noticed that Lisa decides sprite size when SPRxDAT gets loaded, not when FMODE is changed.
Change FMODE=0, then write to SPRxDATA (and also B if B also had non-zero data at 32-> pixels previously) with copper and sprite becomes 16-pixel wide even if in current line it was already shown as 32 or 64 wide. |
![]() |
![]() |
#18 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,246
|
Quote:
But I'm not sure I understood the part in brackets.. SPRBDATA in not mandatory anyway to write it together with A? (well, apart from the unlikely event you want to keep valid the lower 16 bits) Or I miss something? |
|
![]() |
![]() |
#19 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 26,080
|
Quote:
Again undocumented rare feature that makes emulation more complex.. Size was global setting but size is actually sprite plane specific (in hardware level it obviously simply selects which part of internal 64-bit register gets loaded and which gets cleared but in emulation it would not be optimal to emulate it all the time as 64-bit when wide sprites are rarely used) It is possible bitplanes also work identically. |
|
![]() |
![]() |
#20 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,246
|
ok
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Any way to free sprite 0 (mouse pointer)? | StingRay | Coders. System | 9 | 19 October 2017 09:43 |
Parallax scrolling layer with sprites possible? | phx | Coders. Asm / Hardware | 21 | 12 July 2015 18:15 |
UAE Scripting Layer | FrodeSolheim | support.FS-UAE | 15 | 26 January 2014 15:56 |
Opus Magellan source is free now! | OlafSch | Amiga scene | 5 | 18 December 2012 16:43 |
Opus Magellan source is free now | OlafSch | News | 0 | 18 December 2012 11:34 |
|
|