Software sprites (Development Foros MSX)MSX Resource Center            
                       
English Nederlands Espa�ol Portugu�s Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 36 invitados y 1 miembro en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Software sprites

Ir a la página ( 1 | 2 | 3 Siguiente página )
Autor

Software sprites

dumfrog
msx novice
Mensajes: 18
Publicado: Febrero 08 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
Mensajes: 4780
Publicado: Febrero 08 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
Mensajes: 839
Publicado: Febrero 08 2005, 14:12   
i never used hardware sprites. i prefer(ed) copying vram around
NYYRIKKI
msx master
Mensajes: 1528
Publicado: Febrero 08 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
Mensajes: 124
Publicado: Febrero 08 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
Mensajes: 4780
Publicado: Febrero 08 2005, 17:07   
double buffering

Dunno how the performance in basic is tho ^_^
enribar
msx lover
Mensajes: 124
Publicado: Febrero 08 2005, 17:17   
Hi wolf,

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

msx legend
Mensajes: 4780
Publicado: Febrero 08 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
Mensajes: 3545
Publicado: Febrero 08 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
Mensajes: 1006
Publicado: Febrero 08 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
Mensajes: 18
Publicado: Febrero 08 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
Mensajes: 626
Publicado: Febrero 08 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
Mensajes: 124
Publicado: Febrero 09 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
Mensajes: 1006
Publicado: Febrero 09 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
 
Ir a la página ( 1 | 2 | 3 Siguiente página )
 







(c) 1994 - 2008 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation