English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 13 March 2016, 16:47   #21
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
well, disabling sprite DMA while a sprite is being displayed, gives the horrid vertically repeating sprites, but if you are moving the horizontal position into a non-displayable area, i guess it should work
DanScott is offline  
Old 14 March 2016, 09:08   #22
Lazycow
Registered User
 
Lazycow's Avatar
 
Join Date: Oct 2014
Location: Germany
Posts: 195
ok, let's hope the best. Another thing: Will it speed up the CPU when I disable sprite-DMA? I know that 5 or 6 plane bitmap DMA will slow down the CPU, but sprites?
Lazycow is offline  
Old 14 March 2016, 11:15   #23
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by Lazycow View Post
Instead I used the copper and just disabled sprite-DMA with
dc.l $00960020
...and moved the sprites into the horizontal blank.
When you disable DMA, then no more new data is fetched into SPRxDAT. But the sprite is still armed and writes its last data every line, as DanScott already mentioned.

Usually you have a similar situation when you take over the system and disable all DMA. Sloppy coders forget to disarm the mouse pointer sprite, which sometimes shows as a long vertical bar over the screen. In this case you either have to write zeros to SPRxDATA/SPRxDATB or disarm the sprite with writing 0 to SPRxCTL.

Quote:
Originally Posted by Lazycow View Post
ok, let's hope the best. Another thing: Will it speed up the CPU when I disable sprite-DMA? I know that 5 or 6 plane bitmap DMA will slow down the CPU, but sprites?
No, I don't think so. Sprite, Disk and Audio DMA slots are fixed. Nobody else can use them (ok, except the last sprite DMA slots may be overridden by bitplane DMA).
phx is offline  
Old 14 March 2016, 12:06   #24
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by phx View Post
No, I don't think so. Sprite, Disk and Audio DMA slots are fixed. Nobody else can use them (ok, except the last sprite DMA slots may be overridden by bitplane DMA).
They have fixed positions but if DMA channel is not needed for current line (even if DMA channel is enabled), it's slot(s) can be used by other lower priority channels, including CPU.
Toni Wilen is offline  
Old 14 March 2016, 17:03   #25
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Wow! I wasn't sure about that. Nice!
phx is offline  
Old 17 March 2016, 10:29   #26
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
Quote:
Originally Posted by DanScott View Post
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
I can now confirm, everything works as was anticipated
DanScott is offline  
Old 09 December 2017, 22:03   #27
dalton
tulou
 
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 88
Is it possible to update the pos/ctl/pth/ptl registers using the copper or cpu, and then have sprite dma immideately fetch pixel data at pth/ptl? Or will dma always start by fetching the two control words at pth/ptl (effectively discarding what the copper or cpu wrote)?
dalton is offline  
Old 09 December 2017, 22:56   #28
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by dalton View Post
Is it possible to update the pos/ctl/pth/ptl registers using the copper or cpu, and then have sprite dma immideately fetch pixel data at pth/ptl?
Yes. Sprite hardware does not care what is the source of write access. But note that first line that allows sprite DMA (25 if PAL, 20 if NTSC) will always do normal DMA accesses (if sprite DMA is enabled) which can cause unexpected surprises. It is best to do manual writes after line 25/20.

For example Superfrog and Project-X uses this method.
Toni Wilen is offline  
Old 25 January 2018, 17:03   #29
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
Turning off sprite DMA when it or bitplane DMA is on is the common reason for rolling sprites. The recommended method is to change sprite DMA only during vertical blank (as in: before the magic scanline, see Toni's comment).

It's untested whether setting 0 bitplanes with dc.w $0100,$0200 is a suitable replacement. Any write to BPLCON0 enables bitplane DMA and so should enable sprite DMA IIRC and not work. Maybe Toni could verify.

Hmm, I hesitate moving this and the other sprite thread in General to Asm/Hardware, because there's already one there... Maybe I should, anyway?
Photon is offline  
Old 20 November 2020, 22:22   #30
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Apologies for resurrecting an old thread but it may be useful for others.

I'm trying to multi-plex two sprites on the Y Axis and wondering what is the easiest best way to achieve what I want.

Here is a video of the task/problem at hand:

[ Show youtube player ]

The cars are all 64 width hardware sprites, when they explode I simply change the sprite pointers to the sprite data that I have in memory. What should happen in the game is that when the helicopter sprite passes over it should place the car at the Y position where the player respawns to. In the video the helicopter flies to the bottom of the screen and then it is able to place the car because the hw sprite is no longer used.

The HRM says that I can link two hardware sprites together by placing their data structures straight after one another, the problem with this is that I would have to blit the two sprites together which would give a performance hit. As the video shows I'm loading the sprite data with the copper, if I wait for a specific line in the display I could do it that way, but then if multiple cars crash it would screw up.

Is it even possible for example to set the sprite structure pointers at line $25 for Sprites 0 & 1 (the car) which in their control words have a line position of 70, then after that sprite has been displayed re-arm the sprites with a different data structure showing the helicopter?

Am I over thinking this or will I have to copy the two sprites together?

In Rygar I had set screen positions in the copper to reload the sprite data, this isn't the same because the cars can crash at any y position.

Got me scrahting my head this one - and I think i'm making hard work of it.

Cheers,
Graeme

Last edited by mcgeezer; 20 November 2020 at 22:25. Reason: typos
mcgeezer is offline  
Old 21 November 2020, 04:51   #31
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
How many colors are your sprites using individually? By setting the even and odd sprite banks to different palette offsets you can give each AGA sprite a separate 3 colors independent of one another. That way you can keep your sprites on 2 bitplanes.
Samurai_Crow is offline  
Old 21 November 2020, 10:05   #32
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by Samurai_Crow View Post
How many colors are your sprites using individually? By setting the even and odd sprite banks to different palette offsets you can give each AGA sprite a separate 3 colors independent of one another. That way you can keep your sprites on 2 bitplanes.
Sprites are attached and 16 colours. No getting away from that i’m afraid.

Re-reading the thread i’m thinking about using a copper interrupt every 8 lines down the screen, if the chopper is beyond the respawn point for the car then it will set the new sprite addresses and rearm with update to sprpos.

I’ll try it today.
mcgeezer is offline  
Old 21 November 2020, 11:53   #33
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 459
Quote:
Originally Posted by mcgeezer View Post
Is it even possible for example to set the sprite structure pointers at line $25 for Sprites 0 & 1 (the car) which in their control words have a line position of 70, then after that sprite has been displayed re-arm the sprites with a different data structure showing the helicopter?
To be honest I'm not sure to understand all because I'm tired and my english is kinda weak but if my memory serves you could use copper to rearm sprites ctrl pointers and x,y but using $140,$142 etc and you don't need to wait end of previous sprite.
If I'm off track please forgive me

Edit : So you don't need to copy datas with blitter or cpu

Edit bis : Of course, $142 needs to point directly to sprite date and not sprite ctrl.
LeCaravage is offline  
Old 22 November 2020, 13:35   #34
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Another related problem I have is hardware sprite clipping, is there an easy way to do it on the Y Axis?

My spites are 116 pixels tall for the car explosion, if the car explodes at the top of the screen I can't clip just the lower part of the hardware sprite.

I do have a solution but it isn't elegant, is there another easier way to do it?
mcgeezer is offline  
Old 22 November 2020, 15:20   #35
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
Quote:
Originally Posted by mcgeezer View Post
I do have a solution but it isn't elegant, is there another easier way to do it?
Depends on what you non-elegant method is..

I would write the control word into the sprite data at the correct place (having saved that off somewhere)... then next frame, restore the sprite data that the control word overwrote, and write the next frames control word in wherever needed.
DanScott is offline  
Old 22 November 2020, 16:44   #36
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by DanScott View Post
Depends on what you non-elegant method is..

I would write the control word into the sprite data at the correct place (having saved that off somewhere)... then next frame, restore the sprite data that the control word overwrote, and write the next frames control word in wherever needed.
Non-elegant method....

The original explosion sprites were in an IFF with a resolution of 320x580 taking up 93kb, this gave me 25 64x116 sized sprites - most of which were empty. So due to the clipping problem I ran into, I halved the sprite sheet size into 64x58 and got rid of the blank sprites as a result. The only problem was I had to duplicate some sprites, but it still resulted in a chip memory saving of around 10kb.

I might revisit it and see if I can manipulate the control words, but my original multiplexing problem still stands which I need to figure out.

See attachments for the explosion graphics and what I did with them.
Attached Thumbnails
Click image for larger version

Name:	ingame_explosion.png
Views:	184
Size:	9.3 KB
ID:	69781   Click image for larger version

Name:	ingame_explosions_full.png
Views:	171
Size:	8.6 KB
ID:	69782   Click image for larger version

Name:	ingame_explosions_lower.png
Views:	215
Size:	6.5 KB
ID:	69783  
mcgeezer is offline  
Old 27 August 2021, 15:30   #37
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
about sprite clipping, is there a way to clip sprites horizontally ?

left of screen: can the amiga use a control word with negative X so the right part of the sprite is drawn?

right of screen: my game area doesn't end exactly at the end of display (status bar on the right). ATM the way that works is to put a sprite of higher priority on the side with a black forground

but then I have palette issues and I need a super complex copperlist to dynamically change palette.

There's also dual playfield, but using DPF just for that brings other problems.

I think I'm going to create another sprite area and shift it manually. Any genius ideas?
jotd is offline  
Old 27 August 2021, 15:56   #38
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by jotd View Post
ATM the way that works is to put a sprite of higher priority on the side with a black forground
EDIT:
Ok, main idea is 'abuse' ATT bit for 16 bit sprites, see next message.

I did not understand the problem on the left, which in fact does not exist, just put an x lower than the one that makes the sprite appear at full

Last edited by ross; 27 August 2021 at 17:19.
ross is offline  
Old 27 August 2021, 17:01   #39
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
Quote:
Originally Posted by jotd View Post
left of screen: can the amiga use a control word with negative X so the right part of the sprite is drawn?
Amiga Sprite X coordinates start at raster position 0, or about 128 pixels before the actual start of a standard display (which is at position $80/128). Because of this, you can move a sprite partly off-screen to the left without any problems.

Quote:

right of screen: my game area doesn't end exactly at the end of display (status bar on the right). ATM the way that works is to put a sprite of higher priority on the side with a black forground

but then I have palette issues and I need a super complex copperlist to dynamically change palette.
Another option is to colour the right status bar background (and all other status bar elements) in a different colour than colour 0 and dynamically set the Sprite priorities to be behind the playfield using the Copper for the status bar area (switching back after).
roondar is offline  
Old 27 August 2021, 17:12   #40
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
Quote:
Originally Posted by roondar View Post
Amiga Sprite X coordinates start at raster position 0, or about 128 pixels before the actual start of a standard display (which is at position $80/128). Because of this, you can move a sprite partly off-screen to the left without any problems.


Another option is to colour the right status bar background (and all other status bar elements) in a different colour than colour 0 and dynamically set the Sprite priorities to be behind the playfield using the Copper for the status bar area (switching back after).

both are very good points. The sprite xy table I have doesn't take "negative" coords into account. I have to fix that.

And the playfield priority trick pleases me because I don't have to change palette dynamically, which is a nightmare for me.

But then I don't have enough colors to use another black color. Game uses 16 colors, and I don't want to go full 5 bitplanes just for this. But it would be very quick as it would not change a lot of stuff. In that case I could reuse one of the black colors of the sprite palette.

Damn, that problem is not that easy. but thanks.

On the other hand, not sure shifting the sprite data at each frame would be costly either on a 16x16 sprite, only for 1 or 2 sprites max.
jotd is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:26.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.17278 seconds with 14 queries