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 > Software sprites....
2006-04-24 10:16
PopMilo

Registered: Mar 2004
Posts: 146
Software sprites....

Does anybody have any expirience with software sprites?
Bobs?

In hires or char mode?

Games I susspect have something to do with software sprites:

Cybernoid for bullets...
Last ninja for masking main character (its not a software sprite, only hardware one masked, to show visibility...)
karnov
Astromarine corps
..,

What is record for these?
 
... 111 posts hidden. Click here to view all posts....
 
2007-01-04 10:42
MikeD
Account closed

Registered: Jan 2006
Posts: 19
Err....but what happens when 2 sprites cross? If you just STA, then you lose the sprite underneath?!?! I don't quite follow you - unless you're masking some other way perhaps?

Yes, the barrel shifter is a small routine that will rotate any sprite by "N" pixels. Its pretty much the same as your tables. I have 8 tables for MCM and 16 for Hires. 1 is the remainer, and 1 overflow, and then have this "n" times. Although yes, I could do a "0" special case.

All this does is rotate one column into the next and then stores the remainer in the overflow column. here it is...

              ldy  #15
RotateALL      

SrcColumn1    lax  $0101,y
BarrelShift1  lda  Table1,x
DataDest1     sta  $0101,y
BarrelShiftO1 lda  Table1+256,x
              sta  Column2+1

              ; Now do Column 2
SrcColumn2    lax  $0101,y
BarrelShift2  lda  Table1,x
Column2       ora  #$00
DataDest2     sta  $0101,y

BarrelShiftO2 lda  Table1+256,x
DataDest3     sta  $0101,y
              dey
              bpl  RotateALL


A barrel shifter is simply a function (of hardware or software) that takes the same time to rotate 1 as it does any other number. This routine does that - probably exactly the same way as yours does. More effort actually goes into caching the thing rather than rotating it!

2007-01-04 11:22
Oswald

Registered: Apr 2002
Posts: 5094
why dont you use good ol' brute force ?

lda screen,x
and #spritemask
ora #spritedaza
sta screen,x
2007-01-04 11:51
MikeD
Account closed

Registered: Jan 2006
Posts: 19
Because this isn't from a demo, its game code. And the game has 167 16x16 sprites. Demo's can afford the space for a couple of sprite shapes - games can't :)
2007-01-04 14:11
Oswald

Registered: Apr 2002
Posts: 5094
167 is a lot :)
2007-01-04 14:47
Luca

Registered: Apr 2002
Posts: 178
Boooo-hooo! :_(
Months ago, I tried myself to have a nice softprites routine too, with animated bubbles that run in vertical+sin(x). Due to the amount of the bubbles (5) I used doublebuffering, but bubbles #4 and #5 disappear before they reach the top of the screen, although I'm quite sure the dblbuffer works good! Frustrated, I paused that stuff...and I'm soooooo saaaaaad cause of that!
2007-01-04 16:34
Cruzer

Registered: Dec 2001
Posts: 1048
@Luca: Definitely sounds like it's not safe to conclude that your double buffer works. Testing all the things you're 100% sure works is the way to debug when you can't find the error.
2007-01-04 17:32
Luca

Registered: Apr 2002
Posts: 178
Quote: @Luca: Definitely sounds like it's not safe to conclude that your double buffer works. Testing all the things you're 100% sure works is the way to debug when you can't find the error.

Yes, you're right. I had a long debugging time, then I lost hopes, also because of the bad ordered code I wrote. Probably it's time to get back to it, after a period of calm.
2007-01-04 21:47
PopMilo

Registered: Mar 2004
Posts: 146
@MikeD:
Sprites do not cross :)
Its supposed to be arcade game, if you touch some object it can explode, dissapear, you picked it up, or it just blocks your movement...
Since my frontal layer is hires black there are no color clashes even if two sprites overlap (In that case I just have to use simple masking routine).
Char sprites -> hires black->masking routine
Hardware sprites -> multicolor (3 colors) -> dont have to do masking, they have priorities-just have to synchronize hardware priorities with software routine.

Offcourse I need mask definition for each frame, so it takes more memory, and more cputime, so I think Ill try to avoid overlaping.
And also chars in front (scenary) will have rectangular shapes (like chars) to make masking simple (dont draw char on screen if there is something infront, and mask hardware sprites if nececery with simple "erase 8x8 pixel block" in sprite.

And to answer JackAsser "Any previews popmilo?":

Currently Im busy with my own pc "hires over multi sprite editor" with keyboard controls (like in c128 built in sprdef)- old habbits die hard :)
So when I make at least one complete animation of my hero walking, Ill let it out :)
So far, I have only sprites flying around, and there is so much more in a game that needs a lot of thinking...
Ill take it step by step...

Ohhh... I just realized how big this post is :) Maybe I should make a blog out of this :)
2007-01-06 22:32
MikeD
Account closed

Registered: Jan 2006
Posts: 19
Err... What about baddie to baddie? Dont you get that at all? If its Hires only, do you really need a MASK?

Is it hires in MCM? I use an automask so I dont need to store one.

  lax (Temp+18),y       ; 5*
  lda (Temp+2),y        ; 5
  and MCMAutoMask,x     ; 4
  ora (Temp+18),y       ; 5*
  sta (Addr),y          ; 6
  dey                   ; 2 = 27  (with 7 sprites=14,616 cycles)


Little longer, but saves loads of memory - and rotation time.
2007-01-07 21:28
PopMilo

Registered: Mar 2004
Posts: 146
They say one picture describes more than a thousand words:

Here is two sprites decomposed to its hires-char part and its multicolor-hardware-sprite (background is black just to see those grey colors clearly):



Here are those two overlaped:



The multicolored part is simply two hardware sprites and there is no problem moving them around, one over each other.
The hires part looks like this:



These are two black hires sprites made out of dedicated characters, so if they overlap I have to use masking for them (at least for one that comes on top).
I draw the bottom one, then I draw the top one using data from the first one as the background, mask it with sprite mask, and ora it with sprite data...

Automask is a great idea, and I would use it if the multicolored sprites would be software ones (in case I use bitmap and not charmode screen, but because of speed, Im sticking to a charmode sprites for now)
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 - 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
E$G/HF ⭐ 7
fuzzybad
t0m3000/hf^boom!^ibx
Paladin/G★P
Rub_0201
Guests online: 136
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

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