English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 28 May 2017, 17:14   #1
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
Floppy disk Dual Playfield 'Fast Bobs' example + source

Recently, I was inspired by several thread to check out the game Mega Typhoon, which used a neat way to improve blitter throughput: namely, use Dual Playfield mode and only blit to one playfield and only show background on the other playfield.

I got to thinking about this and realized the Dual Playfield mode can also be used to blit 'bobs' much faster by never clearing any data and not using cookie-cut mode.

The result of my tinkering is a small program which does just that and shows a whole bunch of bobs moving about. This method can be used for games as well, so I thought I would share it.

The program and full source code can be found on my website: http://www.powerprograms.nl/amiga/dpl-fastbobs.html

I hope it can prove useful

Here it is in action: [ Show youtube player ]
roondar is offline  
Old 29 May 2017, 09:34   #2
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 415
Thanks for the tuto. But, what is a cookie cut ?
LeCaravage is offline  
Old 29 May 2017, 10:09   #3
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,847
Quote:
Originally Posted by LeCaravage View Post
what is a cookie cut ?
http://amigadev.elowar.com/read/ADCD...1D.html#line83
StingRay is offline  
Old 29 May 2017, 10:42   #4
coder76
Registered User
 
Join Date: Dec 2016
Location: Finland
Posts: 164
A nice idea, but even if the background is independent with dualplayfield, you still usually have several objects in the second planebuffer that might overlap each other. Doing a straight A->D copy with a bit oversized area to clean off garbage from previous frame will also wipe out part of other objects that are close. A cookie-cut operation is needed the preserve other objects that are close, as it wipes out graphics only from the mask area that precisely matches the object.

One can use your technique, if objects can't come too close to each other, or some other special cases, like one large object and rest is sprites etc.
coder76 is offline  
Old 29 May 2017, 11:05   #5
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,329
Quote:
Originally Posted by coder76 View Post
A nice idea, but even if the background is independent with dualplayfield, you still usually have several objects in the second planebuffer that might overlap each other. Doing a straight A->D copy with a bit oversized area to clean off garbage from previous frame will also wipe out part of other objects that are close. A cookie-cut operation is needed the preserve other objects that are close, as it wipes out graphics only from the mask area that precisely matches the object.

One can use your technique, if objects can't come too close to each other, or some other special cases, like one large object and rest is sprites etc.
Oh, it's certainly true you can't just randomly use this, it needs some care.
But, you can have overlapping bobs. What the example program does is blit all the non-overlapping bobs first and then add the cookie-cut bobs on top. This works and allows for overlapping bobs.

To use this you do need to know ahead of time what is going to overlap and deal with it, or adjust the program so it detects overlap and deals with it for you.

Nonetheless, I feel it can be a useful technique. One use would be 'boss fights' in games, but also games where enemy movement or positions are structured (such as waves in shoot-em-ups, or patrolling enemies in platformers) should be able to use this technique. Probably not for all bobs, but likely for a sizable percentage of them anyway.
roondar is offline  
Old 29 May 2017, 11:41   #6
hukka
Wolf-bear thing
 
hukka's Avatar
 
Join Date: Jan 2014
Location: Finland
Age: 40
Posts: 56
I also used a second playfield for the moving objects (apart from the player sprite) in Solomon's Key 2. Of course, dual playfield mode limits color usage but that was not an issue in this case.
hukka is offline  
Old 29 May 2017, 15:29   #7
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 415
Quote:
Originally Posted by StingRay View Post
Thanks.
LeCaravage is offline  
Old 12 July 2017, 09:40   #8
dissident
Registered User
 
Join Date: Sep 2015
Location: Germany
Posts: 251
Quote:
Originally Posted by roondar View Post
Oh, it's certainly true you can't just randomly use this, it needs some care.
But, you can have overlapping bobs. What the example program does is blit all the non-overlapping bobs first and then add the cookie-cut bobs on top. This works and allows for overlapping bobs.

To use this you do need to know ahead of time what is going to overlap and deal with it, or adjust the program so it detects overlap and deals with it for you.

Nonetheless, I feel it can be a useful technique. One use would be 'boss fights' in games, but also games where enemy movement or positions are structured (such as waves in shoot-em-ups, or patrolling enemies in platformers) should be able to use this technique. Probably not for all bobs, but likely for a sizable percentage of them anyway.
Yes, this technique was already used for 1 or 2-pixel sine scrolltexts copied into empty bitplanes. Copying the first column of a word with a D=A blit and then doing a D=A+B special cookie cut blit for the next columns of the word.

If the first copy blit has a double height and is y-centered, the y-amplitude of the scroller is not too big, you don't have to clear the empty picture before.
dissident is offline  
Old 12 July 2017, 13:50   #9
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,448
Apologies - I know this is neither a Blitz Basic forum nor thread but there was a particular thing I wanted to check.

So, Blitz seems to always assume this channel configuration (from the manual)

A = Pointer to shape's cookie cut
B = Pointer to shape data
C = Pointer to destination
D = Pointer to destination

And it has various options which are constant int values, being

CookieMode = $FCA, a standard Blit with mask
EraseMode = $BOA, erases a section of a Bitmap corresponding to a mask
InvMode = $B5A, inverts a section of a Bitmap corresponding to a mask
SolidMode = $BFA, overwrites a section of a Bitmap corresponding to a mask

Which can be fed into the BlitMode command (I assume this sets BLTCON0), but as you can see there's no mode for blitting without a mask. What would the correct constant be for blitting without a mask? For some reason I've got $DC0 written down in my notes but I have no idea if that's correct or how I came to that conclusion.
earok is offline  
Old 12 July 2017, 14:08   #10
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,837
$9F0 is blit without mask
Galahad/FLT is online now  
Old 12 July 2017, 16:11   #11
Raislin77it
Zone Friend
 
Raislin77it's Avatar
 
Join Date: Jan 2005
Location: italy
Age: 46
Posts: 244
Quote:
Originally Posted by earok View Post
Apologies - I know this is neither a Blitz Basic forum nor thread but there was a particular thing I wanted to check.

So, Blitz seems to always assume this channel configuration (from the manual)

A = Pointer to shape's cookie cut
B = Pointer to shape data
C = Pointer to destination
D = Pointer to destination

And it has various options which are constant int values, being

CookieMode = $FCA, a standard Blit with mask
EraseMode = $BOA, erases a section of a Bitmap corresponding to a mask
InvMode = $B5A, inverts a section of a Bitmap corresponding to a mask
SolidMode = $BFA, overwrites a section of a Bitmap corresponding to a mask

Which can be fed into the BlitMode command (I assume this sets BLTCON0), but as you can see there's no mode for blitting without a mask. What would the correct constant be for blitting without a mask? For some reason I've got $DC0 written down in my notes but I have no idea if that's correct or how I came to that conclusion.
maybe this thread can help you

http://eab.abime.net/showthread.php?t=81686
Raislin77it 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
Dual Playfield Palette Assignments LuMan Coders. Blitz Basic 1 24 February 2016 15:35
Help with Dual Playfield Shatterhand Coders. Blitz Basic 15 14 December 2015 13:05
flimbo's quest dual playfield? Raislin77it Coders. General 14 01 August 2015 16:53
Dual playfield colors and AGA losso Coders. Asm / Hardware 1 03 December 2013 02:48
Dual Playfield BippyM project.Maptapper 6 03 July 2013 00:43

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 09:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Page generated in 0.12979 seconds with 13 queries