Free your creativity - IOMBCC (Development Foros MSX)MSX Resource Center MRC MEGA Challenge - Win one of 3 free One Chip MSX computers!           
                       
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 125 invitados y 1 miembro en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Free your creativity - IOMBCC

Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 Siguiente página )
Autor

Free your creativity - IOMBCC

dvik
msx master
Mensajes: 1298
Publicado: Abril 21 2005, 21:52   
manuel, I removed my packing when NYYRIKKI changed the road generation.
The packing with my 6-bit version is a bit better but the code to unpack requires
more characters. So when we only need to pack the car sprite data, NYYRIKKIs
method is more efficient code space wise.

I saved another 13 characters on my lunch break . here is an update:

1 J=S-J*(J<96-S):K=J\16:FORW=0TO2:VPOKE8208+W,P(W+K):NEXT:IFTTHENRESUMENEXTELSEONERRORGOTO1:DEFINTA-Y:COLOR15,5,1:V=14:SCREEN2,3,0:FORX=0TO2:FORY=0TO31:R=16-Y\2:LINE(R-(X-1)*((SIN(Y^.8/6)-(Y<16))*6-R-2)+(X<2),X*32+Y)-STEP(Y+1,0):NEXTY,X
2 N=14336:U=255:FORI=0TO383:VPOKEN+I,VPEEK((IAND7)+(IAND8)*32+(IAND48)\2+(IAND448)*8):NEXT:SCREEN1:S$="OI1F20407FJCF7FJ70OIC02010F0J98F0J70RI0F101F2F1F19SJ8040J80TI060F09gI3":KEYOFF:LOCATE8,1:PRINT"PLEASE WAIT!":FORO=1TO71:A$=MID$(S$,O,2)
3 R=K:K=ASC(A$)-73:Y=VAL("&H"+A$):O=O-(K<0):FORW=0TO-(R>0)*R:VPOKEN+I,Y:I=I-(Y>0ORR>0):NEXTW,O:X=V:R=N\2:FORI=256TO1023:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO\2)\(2-(IAND4)\4):NEXT:FORI=ITO1279:O=IAND32:VPOKE6432+(IAND63),228+8*(IAND3)-O
4 W=2^(IAND7):J=O*127\W\32:VPOKEI+512,JAND-W:VPOKEI+768,JOR-WANDU:J=8-O\8:VPOKEI,(JANDI)*U\J:NEXT:FORK=1TO13:FORH=0TO31:VPOKE6464+H+K*32,-(K<9ORH<VORH>17)*(ASC(MID$("i=67'6&7/'6.&",K))+90):P(H\4)=50-15*(H\12AND1):NEXTH,K:VPOKE8192,V
5 SOUND3,V:FORW=8TO9:PUTSPRITEW,(80+64*W,159),V,W-2:SOUNDW,V:NEXT:VPOKE1209,U:TIME=0:FORT=7TOR:LOCATE1,1:D=96-(NAND127):Y=D>0:-:D=D*D\96:PRINTUSING"SPEED:##0kmh    RANK:###";S;N\128-82:-:F=B:IFC<TTHENC=V+T+TMOD99:B=(R-T>99)*(1-CMOD3)
6 S=S-(S<18ANDSTRIG(0))*2+(S>0):-:FORW=3TO4:PUTSPRITEW+1,(F*10+W*H,95),V,4*B+W+1:PUTSPRITE3+W,(W*H,127),V,4*F+3+W:NEXT:-:T=T+S-1:PUTSPRITE1,(115-(D<34)*((24-D)*B+F*10)+(E-64)*D\225,-Y*(98+D)-31),-6*(T<R),15-D\25:M=(X>72)-(X<0):-:O=STICK(0)
7 S=S*((X-15-E\3)\15<>0ORD<73)*(M=0):SOUND0,U-S*9:E=NAND128:X=X+5*(M+(O=7)-(O=3))-S*B\4:N=N+9-S:G=G+F*S\2:-:FORW=8216TO8219:G=G+8AND31:VPOKEW,86+(GAND16):VPOKE4+W,85+G\24:NEXT:-:PUTSPRITE0,(X+80,156),1,12:SOUND1,83:NEXT:S=15:Z$=SPACE$(V)
8 Z=TIME\(6-PEEK(43)\128):FORN=0TO244:D=88-3*N:O=(D>0)*(N\4-V):SOUND8,O:SOUND9,O:PUTSPRITE0,(116-(36-X)*D\126,68+D),-(D>0),S-D\24:LOCATE6,4:PRINTMID$(Z$+"Race Over   Time ="+STR$(Z/10)+"s"+Z$,NMOD42+1,S):-:NEXT:SCREEN0

dvik
msx master
Mensajes: 1298
Publicado: Abril 21 2005, 21:53   
I've made a little list of our variable use. Its kindof a spoiler maybe but its good
to know when we want to optimize it more:

A = FREE
B = turn
C = turn duration
D = turn offset
E = opponent car distance
F = turn
G = mountain scroll
H = Loop var in setup, used as 32 in game
I = Loop var in setup, FREE in game
J = Loop var
K = Loop var, temp var
L = FREE
M = Temp var (for car offset) in game
N = opponent car distance
O = Loop var, temp var in setup, Temp var for stick in game
P = Grass scroll color array
Q = FREE
R = Temp var in setup, track length in game
S = FREE in setup, speed in game (need to be 0 at game start)
T = Track offset
U = Constant 255
V = Constant 14
W = Loop var
X = Car position (left-right)
Y = Temp var
Z = Float variable used for time calculation at the end demo
wolf_

msx legend
Mensajes: 4555
Publicado: Abril 21 2005, 22:00   
"spoiler" ? as if I can read all that enigma-code anyway
NYYRIKKI
msx master
Mensajes: 1474
Publicado: Abril 21 2005, 22:14   

I also made a quite a cute looking 6bit decoder, that is used in "Sourcered Forces" but I also learned, that it's not very small to write.

The new thing in this packing (that is still 4bit) is, that RLE counter is optional, so there are no fixed positions, where RLE counter needs to be. The data can be either 2 byte HEX number or 1 byte RLE counter and the special thing in this data is, that sometimes that very same byte represents both HEX number and RLE counter!!!




NYYRIKKI
msx master
Mensajes: 1474
Publicado: Abril 21 2005, 23:16   

I was just thinking, that how about throwing away the "Please wait" and replace that with simple screen disable?


dvik
msx master
Mensajes: 1298
Publicado: Abril 21 2005, 23:24   
Yes that saves some characters. I'm working on an even more efficient compression of the sprite data. I think I can save another 25 characters or so.
Its quite simple actually. I just store the data in for example base 96. Then you can fit both the RLE length and value in two characters. It saves a few characters in the actual compressed array but the big save is in the decompression algorithm. I'll see if it works out as I think it will.
dvik
msx master
Mensajes: 1298
Publicado: Abril 21 2005, 23:48   
It worked and saved another 33 characters. It is not as obfuscated as NYYRIKKIs
compression algorithm though. But at least it gave some more characters to do
other fun things with.

*EDITED*

1 J=S-J*(J<96-S):K=J\16:FORW=0TO2:VPOKE8208+W,P(W+K):NEXT:IFTTHENRESUMENEXTELSEONERRORGOTO1:DEFINTA-Y:COLOR15,5,1:V=14:SCREEN2,3,0:FORX=0TO2:FORY=0TO31:R=16-Y\2:LINE(R-(X-1)*((SIN(Y^.8/6)-(Y<16))*6-R-2)+(X<2),X*32+Y)-STEP(Y+1,0):NEXTY,X
2 N=14336:U=255:FORI=0TO383:VPOKEN+I,VPEEK((IAND7)+(IAND8)*32+(IAND48)\2+(IAND448)*8):NEXT:SCREEN1:KEYOFF:FORO=0TO32:Y=0:FORR=RTOR+1:Y=Y*96+(ASC(MID$("3##B#C#c$B'r$B&s3#%##C#3%S';%S&s;##2#3#B#R#B#<=c'##c'#@C#)#2#,s##&",R))-35)
3 NEXT:FORK=KTOK+Y\256:VPOKEK+N+I,YANDU:NEXTK,O:LOCATE8,1:PRINT"PLEASE WAIT!":R=N\2:FORI=256TO1023:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO\2)\(2-(IAND4)\4):NEXT:FORI=ITO1279:O=IAND32:VPOKE6432+(IAND63),228+8*(IAND3)-O
4 W=2^(IAND7):J=O*127\W\32:VPOKEI+512,JAND-W:VPOKEI+768,JOR-WANDU:J=8-O\8:VPOKEI,(JANDI)*U\J:NEXT:FORK=1TO13:FORH=0TO31:VPOKE6464+H+K*32,-(K<9ORH<VORH>17)*(ASC(MID$("i=67'6&7/'6.&",K))+90):P(H\4)=50-15*(H\12AND1):NEXTH,K:VPOKE8192,V
5 SOUND3,V:FORW=8TO9:PUTSPRITEW,(80+64*W,159),V,W-2:SOUNDW,V:NEXT:VPOKE1209,U:TIME=0:FORT=7TOR:LOCATE1,1:D=96-(NAND127):Y=D>0:-:D=D*D\96:PRINTUSING"SPEED:##0kmh    RANK:###";S;N\128-82:-:F=B:IFC<TTHENC=V+T+TMOD99:B=(R-T>99)*(1-CMOD3)
6 S=S-(S<18ANDSTRIG(0))*2+(S>0):-:FORW=3TO4:PUTSPRITEW+1,(F*10+W*H,95),V,4*B+W+1:PUTSPRITE3+W,(W*H,127),V,4*F+3+W:NEXT:-:T=T+S-1:PUTSPRITE1,(115-(D<34)*((24-D)*B+F*10)+(E-64)*D\225,-Y*(98+D)-31),-6*(T<R),15-D\25:M=(X>72)-(X<0):-:O=STICK(0)
7 S=S*((X-15-E\3)\15<>0ORD<73)*(M=0):SOUND0,U-S*9:E=NAND128:X=X+5*(M+(O=7)-(O=3))-S*B\4:N=N+9-S:G=G+F*S\2:-:FORW=8216TO8219:G=G+8AND31:VPOKEW,86+(GAND16):VPOKE4+W,85+G\24:NEXT:-:PUTSPRITE0,(X+80,156),1,12:SOUND1,83:NEXT:S=15:Z$=SPACE$(V)
8 Z=TIME\(6-PEEK(43)\128):FORN=0TO244:D=88-3*N:O=(D>0)*(N\4-V):SOUND8,O:SOUND9,O:PUTSPRITE0,(116-(36-X)*D\126,68+D),-(D>0),S-D\24:LOCATE6,4:PRINTMID$(Z$+"Race Over   Time ="+STR$(Z/10)+"s"+Z$,NMOD42+1,S):-:NEXT:SCREEN0

snout

msx legend
Mensajes: 4991
Publicado: Abril 21 2005, 23:52   
I think the 'Please wait' notice can be removed in favor of new features as well... heck, you don't even have to enable/disable the screen as far as I'm concerned!
dvik
msx master
Mensajes: 1298
Publicado: Abril 22 2005, 00:12   
I really want to get a center line in there. We have 75 free characters now but I think it will require a little bit more.
Sonic_aka_T

msx guru
Mensajes: 2257
Publicado: Abril 22 2005, 01:24   
well, the locate/please wait crap would be like 30 chars extra...
dvik
msx master
Mensajes: 1298
Publicado: Abril 22 2005, 03:20   
Well, I did a little try on the center line. The code is not that optimized but I wanted to see what's possible to do.

The center line code slows down the game a bit and I'm not sure it is worth it.
Maybe we should try to get some other features into the game instead.

What do you think?

1 J=S-J*(J<96-S):K=J\16:FORW=0TO2:VPOKE8193+W,A(W+K):VPOKE8208+W,P(W+K):NEXT:IFTTHENRESUMENEXTELSEONERRORGOTO1:DEFINTA-Y:V=14:SCREEN2,3,0:FORX=0TO2:FORY=0TO31:R=16-Y\2:LINE(R-(X-1)*((SIN(Y^.8/6)-(Y<16))*6-R-2)+(X<2),X*32+Y)-STEP(Y+1,0)
2 NEXTY,X:COLOR15,5,1:FORY=-1TO1:FORX=0TO14:PRESET(16+Y*X\4,64+32*Y-X):NEXTX,Y:N=14336:U=255:FORI=0TO383:VPOKEN+I,VPEEK((IAND7)+(IAND8)*32+(IAND48)\2+(IAND448)*8):NEXT:SCREEN1:KEYOFF:FORO=0TO32:Y=0:FORR=RTOR+1
3 Y=Y*96+(ASC(MID$("3##B#C#c$B'r$B&s3#%##C#3%S';%S&s;##2#3#B#R#B#<=c'##c'#@C#)#2#,s##&",R))-35):NEXT:FORK=KTOK+Y\256:VPOKEK+N+I,YANDU:NEXTK,O:R=N\2:FORI=256TO1023:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO\2)\(2-(IAND4)\4):NEXT:FORI=ITO1279
4 O=IAND32:VPOKE6432+(IAND63),228+8*(IAND3)-O:W=2^(IAND7):J=O*127\W\32:VPOKEI+512,JAND-W:VPOKEI+768,JOR-WANDU:J=8-O\8:VPOKEI,(JANDI)*U\J:NEXT:FORK=1TO13:FORH=0TO31:VPOKE6464+H+K*32,-(K<9ORH<13ORH>18)*(ASC(MID$("i=67'6&7/'6.&",K))+90)
5 P(H\4)=50-15*(H\12AND1):NEXTH,K:VPOKE8192,V:FORJ=1TO3:FORI=0TO7:A(I)=238+(IAND1):VPOKE64*J+I,254:VPOKE64*J+8+I,31:VPOKE64*J+16+I,0:VPOKE64*J+24+I,0:FORK=0TO1:VPOKE6671+32*I+K,ASC(MID$("KSKSIQIQ",I+1))-65+K:NEXTK,I,J
6 SOUND3,V:FORW=8TO9:PUTSPRITEW,(80+64*W,159),V,W-2:SOUNDW,V:NEXT:VPOKE1209,U:TIME=0:FORT=7TOR:LOCATE1,1:D=96-(NAND127):Y=D>0:-:D=D*D\96:PRINTUSING"SPEED:##0kmh    RANK:###";S;N\128-82:-:F=B:IFC<TTHENC=V+T+TMOD99:B=(R-T>99)*(1-CMOD3)
7 S=S-(S<18ANDSTRIG(0))*2+(S>0):-:FORW=3TO4:PUTSPRITEW+1,(F*10+W*H,95),V,4*B+W+1:PUTSPRITE3+W,(W*H,127),V,4*F+3+W:NEXT:-:T=T+S-1:PUTSPRITE1,(115-(D<34)*((24-D)*B+F*10)+(E-64)*D\225,-Y*(98+D)-31),-6*(T<R),15-D\25:M=(X>72)-(X<0):-:O=STICK(0)
8 S=S*((X-15-E\3)\15<>0ORD<73)*(M=0):SOUND0,U-S*9:E=NAND128:X=X+5*(M+(O=7)-(O=3))-S*B\4:N=N+9-S:G=G+F*S\2:-:FORW=8216TO8219:G=G+8AND31:VPOKEW,86+(GAND16):VPOKE4+W,85+G\24:NEXT:-:PUTSPRITE0,(X+80,156),1,12:SOUND1,83:NEXT:S=15:Z$=SPACE$(V)
9 Z=TIME\(6-PEEK(43)\128):FORN=0TO244:D=88-3*N:O=(D>0)*(N\4-V):SOUND8,O:SOUND9,O:PUTSPRITE0,(116-(36-X)*D\126,68+D),-(D>0),S-D\24:LOCATE6,4:PRINTMID$(Z$+"Race Over   Time ="+STR$(Z/10)+"s"+Z$,NMOD42+1,S):-:NEXT:SCREEN0

dvik
msx master
Mensajes: 1298
Publicado: Abril 22 2005, 08:29   
It can actually be made a bit more efficient by only update the center line scroll
twice every loop (instead of everytime the grass is updated. It requires a bit
more code though. It actually looks a bit better too. The code below does this
but it does scrolls with a constant speed. It gives an idea though:

1 J=S-J*(J<96-S):K=J\16:FORW=0TO2:VPOKE8208+W,P(W+K):NEXT:IFTTHENRESUMENEXTELSEONERRORGOTO1:DEFINTA-Y:COLOR15,5,1:V=14:SCREEN2,3,0:FORX=0TO2:FORY=0TO31:R=16-Y\2:
2 LINE(R-(X-1)*((SIN(Y^.8/6)-(Y<16))*6-R-2)+(X<2),X*32+Y)-STEP(Y+1,0):NEXTY,X
3 FORY=-1TO1:FORX=0TO14:PRESET(16+Y*X\4,64+32*Y-X):NEXTX,Y
4 N=14336:U=255:FORI=0TO383:VPOKEN+I,VPEEK((IAND7)+(IAND8)*32+(IAND48)\2+(IAND448)*8):NEXT:SCREEN1:KEYOFF:FORO=0TO32:Y=0:FORR=RTOR+1:Y=Y*96+(ASC(MID$("3##B#C#c$B'r$B&s3#%##C#3%S';%S&s;##2#3#B#R#B#<=c'##c'#@C#)#2#,s##&",R))-35)
5 NEXT:FORK=KTOK+Y\256:VPOKEK+N+I,YANDU:NEXTK,O:LOCATE8,1:PRINT"PLEASE WAIT!":R=N\2:FORI=256TO1023:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO\2)\(2-(IAND4)\4):NEXT:FORI=ITO1279:O=IAND32:VPOKE6432+(IAND63),228+8*(IAND3)-O
6 W=2^(IAND7):J=O*127\W\32:VPOKEI+512,JAND-W:VPOKEI+768,JOR-WANDU:J=8-O\8:VPOKEI,(JANDI)*U\J:NEXT:FORK=1TO13:FORH=0TO31:VPOKE6464+H+K*32,-(K<9ORH<13ORH>18)*(ASC(MID$("i=67'6&7/'6.&",K))+90):P(H\4)=50-15*(H\12AND1):NEXTH,K:VPOKE8192,V
13 SOUND3,V:FORW=8TO9:PUTSPRITEW,(80+64*W,159),V,W-2:SOUNDW,V:NEXT:VPOKE1209,U:TIME=0:FORT=7TOR:LOCATE1,1:D=96-(NAND127):Y=D>0:-:D=D*D\96:PRINTUSING"SPEED:##0kmh    RANK:###";S;N\128-82:-:F=B:IFC<TTHENC=V+T+TMOD99:B=(R-T>99)*(1-CMOD3)
14 GOSUB20:S=S-(S<18ANDSTRIG(0))*2+(S>0):-:FORW=3TO4:PUTSPRITEW+1,(F*10+W*H,95),V,4*B+W+1:PUTSPRITE3+W,(W*H,127),V,4*F+3+W:NEXT:-:T=T+S-1:PUTSPRITE1,(115-(D<34)*((24-D)*B+F*10)+(E-64)*D\225,-Y*(98+D)-31),-6*(T<R),15-D\25:M=(X>72)-(X<0):-:O=STICK(0)
16 S=S*((X-15-E\3)\15<>0ORD<73)*(M=0):SOUND0,U-S*9:E=NAND128:X=X+5*(M+(O=7)-(O=3))-S*B\4:GOSUB20:N=N+9-S:G=G+F*S\2:-:FORW=8216TO8219:G=G+8AND31:VPOKEW,86+(GAND16):VPOKE4+W,85+G\24:NEXT:-:PUTSPRITE0,(X+80,156),1,12:SOUND1,83:NEXT:S=15:Z$=SPACE$(V)
17 Z=TIME\(6-PEEK(43)\128):FORN=0TO244:D=88-3*N:O=(D>0)*(N\4-V):SOUND8,O:SOUND9,O:PUTSPRITE0,(116-(36-X)*D\126,68+D),-(D>0),S-D\24:LOCATE6,4:PRINTMID$(Z$+"Race Over   Time ="+STR$(Z/10)+"s"+Z$,NMOD42+1,S):-:NEXT:SCREEN0
7 FORJ=1TO3:FORI=0TO7:VPOKE64*J+I,254:VPOKE64*J+8+I,31:VPOKE64*J+16+I,0:VPOKE64*J+24+I,0:FORK=0TO1:VPOKE6671+32*I+K,ASC(MID$("KSKSIQQI",I+1))-65+K:NEXTK,I,J
20 A=A+1:VPOKE8193+0,238+(AAND1):VPOKE8193+1,238+(A+1AND1):RETURN


Alex Ganzeveld
msx lover
Mensajes: 81
Publicado: Abril 22 2005, 08:31   
Dvik, NYYRIKKI: they should erect a statue for you guys! This is insane! And it's actually playable. This would have been a nice listing for the MSX Computer Magazine in 1986
dvik
msx master
Mensajes: 1298
Publicado: Abril 22 2005, 08:34   
Yeah we're about 20 years too late On the other hand, the car games I did
20 years ago wouldn't make it into the Computer Magazine
dvik
msx master
Mensajes: 1298
Publicado: Abril 22 2005, 09:02   
A small optimization of line 7 and 20:

7 FORI=0TOU:VPOKEI,(IAND16)*254\(8^(I\8AND1))\16:VPOKE6671+(IAND225),ASC(MID$("IQIQKSSK",I\32+1))-65+(IAND1):NEXT
20 A=A+(S+4)\6:FORW=0TO1:VPOKE8193+W,A\3+WAND1OR238:NEXT:RETURN


Now we're only about 120 characters short
 
Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 Siguiente página )
 







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