Software sprites (Development MSX Fora)MSX Resource Center            
            
English Nederlands Espa�ol Portugu�s Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 55 gasten en 2 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - Software sprites

Ga naar pagina ( 1 | 2 | 3 Volgende pagina )
Schrijver

Software sprites

dumfrog
msx novice
Berichten: 18
Geplaatst: 08 Februari 2005, 14:01   
Could someone explain what are software sprites and how does that work ?
Is it possible to use them with basic ?
Are there examples somewhere to see what it looks like ?
wolf_

msx legend
Berichten: 4777
Geplaatst: 08 Februari 2005, 14:04   
Software sprite are just pieces of screen that you copy around .. naturally before you copy a piece o' screen, you need to store the screenpixels you're gonna mess-up somewhere.. when you move the software-sprite, you restore those messed-up pixels again ... simple eh..?

+ they can have all the colors available in the screenmode
+ you can use any drawing tool to draw them
+ no max 4 or 8 sprites on a row limits
+ no 16x16 size limits .. take any size as long as your CPU can process it
- they're slow
- they're 'software', so you need to code it yourself, *including* collisions!
- they cost more vram
- forget about pattern screens and yjk screens (not sure about yjk, s11 could work for the sc5 part I think (?) )
- they become slower for sprites that aren't square
DarQ
msx professional
Berichten: 837
Geplaatst: 08 Februari 2005, 14:12   
i never used hardware sprites. i prefer(ed) copying vram around
NYYRIKKI
msx master
Berichten: 1525
Geplaatst: 08 Februari 2005, 15:29   

Here is example of software sprite on MSX2 BASIC:
10 SCREEN 8
20 FOR I=0 TO 200:LINE -(RND(1)*255,RND(1)*211),RND(1)*255:NEXT I
30 SET PAGE 0,1:CLS
40 CIRCLE (5,5),4,28
50 CIRCLE (5,5),2,255
60 COPY (X,Y)-STEP(9,9),0 TO (10,0)
70 COPY (X,Y)-STEP(9,9),0 TO (20,0)
80 COPY (0,0)-STEP(9,9) TO (20,0),,TPSET
90 COPY (20,0)-STEP(9,9) TO (X,Y),0
100 TIME=0:FOR I=0 TO 1:I=TIME:NEXTI
110 IF STRIG(1) THEN END
120 R=PAD(12):IF PAD(13)=0 AND PAD(14)=0 THEN 100
130 COPY (10,0)-STEP(9,9) TO (X,Y),0
140 X=(X+PAD(13))AND255:Y=(Y+212+PAD(14))MOD212
150 GOTO 60


enribar
msx lover
Berichten: 124
Geplaatst: 08 Februari 2005, 17:05   
Very interesting!

I've made the same question for the Turbo Pascal code, for ex:
http://nrgo.altervista.org/sprcopy.zip

and there are also some Pascal libraries made by snatcher-br:
http://www.geocities.com/llugato/pascal/index.html

But, the problem is: are there any MSX-Basic code-techniques to avoid sw-sprite flickering?
wolf_

msx legend
Berichten: 4777
Geplaatst: 08 Februari 2005, 17:07   
double buffering

Dunno how the performance in basic is tho ^_^
enribar
msx lover
Berichten: 124
Geplaatst: 08 Februari 2005, 17:17   
Hi wolf,

double buffering? Is it possibile in not-assembly languages? How?
enribar
msx lover
Berichten: 124
Geplaatst: 08 Februari 2005, 17:21   
Maybe if I print the sprite 2 or three times in the same position... could it be?
wolf_

msx legend
Berichten: 4777
Geplaatst: 08 Februari 2005, 17:35   
Double Buffering is possible in any language that enables you to switch the current drawing-page and view-page.

Can someone post an example? I'm lazy today

manuel
msx guru
Berichten: 3531
Geplaatst: 08 Februari 2005, 17:49   
just use the set page MSX2 functions.
While you're drawing on page P, show page 1-P. When you finish drawing, you say P=1-P and switch to page P (set page P,1-P). Then you start drawing on page P again. etc. etc.

I hope I didn't make a mistake in here, but I guess the idea is clear
Grauw
msx professional
Berichten: 1006
Geplaatst: 08 Februari 2005, 18:55   
Dubble buffering is: show 1 page, draw in the other, then switch them. That way you will never see the page being drawn, and only the final result.

As Manuel indeed said, placing SETPAGE P,1-P : P=1-P on a line before each frame of your drawing stuff in Basic should do the trick.

~Grauw
dumfrog
msx novice
Berichten: 18
Geplaatst: 08 Februari 2005, 20:15   
I guess it must be difficult to move a lot of software sprites together, especially when they meet, but at least, I know something new :-)
Thank you for all those answers.

Edwin
msx professional
Berichten: 626
Geplaatst: 08 Februari 2005, 21:11   
No need to worry about "a lot". Not enough speed in the VDP to handle more than a few of them. Especially in basic.
enribar
msx lover
Berichten: 124
Geplaatst: 09 Februari 2005, 12:56   
Thank you for the explanation of double buffering technique, I know it with the name "page switching".

While in screen 5 this technique is easy (there are 4 pages), it isn't in screens with only 2 pages. If a game needs full screen, it needs at least 3 pages or RAM: 2 for printing sw-sprites and 1 to store background.

In screen 8, it could be used the hidden area of each page (below the 212 y-coord) to store background, but in this case the copy will be more complex and games will not be in full screen.


-----
It could be useful to open a new section here in MRC with short MSX programs/tips&tricks in Basic or other languages!
For ex., how many techniques are there for scrolling, moving sprites, multicolor sprites, sprite collisions, moving sprites under graphics, etc.?
MSXasm site is on-line, ok, but maybe many people need more simple docs, at least for things with simple solutions...
Also, it could be useful a complete on-line MSX-Basic manual with many examples for each instruction (for ex., how to use "set scroll"...).
Grauw
msx professional
Berichten: 1006
Geplaatst: 09 Februari 2005, 13:44   
Enribar, there is the MSX Assembly Page (aka, the MAP)...

Contrary to the name, the site is *not* only for assembly programmers (although the current content is mainly aimed at assembly).

But: if someone wishes to contribute short MSX programs/tips & tricks in Basic or other languages... Please send it to us! There is definitely room for that on the MAP, and it is an area where we want to offer more content.


~Grauw
 
Ga naar pagina ( 1 | 2 | 3 Volgende pagina )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.