Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Clipping background/sprites with open borders
2011-03-13 19:52
Paulko64

Registered: Jul 2010
Posts: 24
Clipping background/sprites with open borders

Hello,

In my current game-project I have opened the top/bottom borders to display information using (all 8) sprites in the bottom border. However, for some levels I want to move sprites smoothly vertically off screen, while being correctly clipped by the border. For another level I need to mask the top/bottom row for adding the new row during vertical scrolling.
I wondered if you guys can give me some suggestions on what the best options would be to accomplish this?

I can think of several options:
- Enable an idle background mode at the correct raster line, so that only a black background is shown. Does this also clip sprites?
- Use X-expanded sprites to cover-up the top/bottom row. However, I need those sprites immediatedly again for the status info in the bottom border. I'm not sure if this is possible timing wise. Also, I then have only 1 gamesprite left that can be clipped.
- Do not move game-sprites in the border area, but software-clip them. I.e. keep the y-position constant, but copy the sprite image upwards/downwards. I think this is the best option, since only a few sprites (max 3) will have to be clipped at the same time.

What do you think is the best option?

Thanks,

PaulKo64
 
... 2 posts hidden. Click here to view all posts....
 
2011-03-14 09:11
ready.

Registered: Feb 2003
Posts: 441
in this release I use open borders and vertical scrolling:
Bike64 Project - 0xAA Version
the black area between the bottom chars (green grass and rocks) and the "096" numbers is achived by changing $d018 at some raster line, so that it points to a new screen where empty chars are shown in the interested area and changes sprite pointers, so that empty sprites are shown. then y-sprite coords are changed for "096" sprites and $d018 is changed again. I think it was so, but I should check the code to be sure.
2011-03-14 15:50
Conrad

Registered: Nov 2006
Posts: 833
Haven't tried it, but how about setting $3fff to #$ff (if you're using the default bank, 3) and at the beginning raster line of the open border, set the sprite-char priority to #$ff as well.

Then at the beginning line of where your "scoreboard" sprites are displayed, set the sprite-char priority back to #$00.

Works wonders if you have a black background. Other coloured backgrounds require another and more advanced way.
2011-03-14 19:08
Paulko64

Registered: Jul 2010
Posts: 24
Thanks for the suggestions...

If I'm going to "clip" the sprites with either switching to a different screen-adres (with empty sprite images), or using the $3fff method with correct priority, I think I will have a problem when reaching the "status"-sprites.

F.e. if I want to be able to fully clip a sprite in the bottom border, I need up to 21 rows before the status sprites can be shown (since new sprites will not be displayed unless the old one is completely finished)! I.e. I will always have a black seperation of minimal 21 lines, which is quite big I guess... However, now that I think of it, since the sprite is not shown during the clipping, one can already set up all the parameters (Y-position, X-position, color, pointer) before switching back to the old screen (at the correct raster line). I think this is what you mean Martin?

Another advantage I see is that I do not have to take care of the other screenadres to point to sensible data, since I'm in the border anyhow. This saves me the hassle&memory of having a backup of the screendata!

Thanks,

PaulKo64
2011-03-14 20:11
S.E.S.

Registered: Apr 2010
Posts: 19
Suppose you have a game sprite that crosses the opened lower border, and you "fade it out" by changing the sprite pointer to an empty sprite data block. That looks fine. However, the now empty rest of the sprite is still "displayed" by VIC until all 21 sprite lines are "shown". You can set another Y-value before the sprite "ends", but VIC is going to start the next sprite only when the first sprite is finished. So yes, you need 20 black lines between the bottom game graphics and the start of the status line.

Maybe you could use only 6 or 7 sprites for the status line. Then you could have 2 or 1 game sprites that cross the lowed border, without negative effects to the status line.
2011-03-14 20:57
WVL

Registered: Mar 2002
Posts: 886
Imo, it's better to not move your sprites inside the lower border, exactly because of the need for a 21 pixel gap between the start of the border and your status sprites..

It's better to plot your sprites realtime, so when your sprite is 10 pixels into the lowerborder, you have a sprite-y-co so that it's fully in the screen and copy the correct data into the sprite, so it looks scrolled..

this only costs 63 bytes to write, so unrolled it would only cost you 63*10 cycles = 630 cycles = 11 rasterlines...

and no problems with the gap..
2011-03-15 08:48
HCL

Registered: Feb 2003
Posts: 716
Agree with WVL and others for the sprites.

Screen clipping depends on gfx-mode:

- for char-mode you may switch $d018 to empty char-bank, or switch $d011 to idle-mode -> will show black (perhaps you have black background).

- for bitmap-mode the $d011-trick also worx (if black bg), but you may also use software-clipping (clear 0-7 lines at the top and bottom). The latter don't require any exact timing like the others, timing that may cause some troubles because of various amounts of sprites.
2011-03-15 10:47
Skate

Registered: Jul 2003
Posts: 490
I'd use software-clipping as well. if your sprites are animated, best option is copying/shifting the datas in realtime. but for the static sprites, you can even use precalculated frames (you'd lose around $500 for each sprite). you should decide losing cycles or losing memory considering your needs on this project.
2011-03-15 11:41
S.E.S.

Registered: Apr 2010
Posts: 19
Yes, I agree with WVL, HCL and Skate.
A 21 pixel gap would be really ugly.
2011-03-15 12:32
Martin Piper

Registered: Nov 2007
Posts: 634
Quoting Paulko64
I think this is what you mean Martin?


Yes, that is pretty much it.
2011-03-15 13:31
Oswald

Registered: Apr 2002
Posts: 5017
Quote: Agree with WVL and others for the sprites.

Screen clipping depends on gfx-mode:

- for char-mode you may switch $d018 to empty char-bank, or switch $d011 to idle-mode -> will show black (perhaps you have black background).

- for bitmap-mode the $d011-trick also worx (if black bg), but you may also use software-clipping (clear 0-7 lines at the top and bottom). The latter don't require any exact timing like the others, timing that may cause some troubles because of various amounts of sprites.


" or switch $d011 to idle-mode "

A bit nitpicking: The VIC is not idling in the illegal modes, only all pixels are black. Bad lines and some kind of gfx is still displayed, it can be checked with a 1 pixel sprite, and hardware sprite-background collision detection.
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Dymo/G★P
bOOZElEE
CA$H/TRiAD
mutetus/Ald ^ Ons
Knight Rider/TREX
acrouzet/G★P
bepp/ΤRIΛD
zscs
csabanw
Krill/Plush
Guests online: 131
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Original Suppliers
1 Black Beard  (9.5)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Irata  (8.5)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.046 sec.