Schrijver
| Free your creativity - IOMBCC
| wolf_ online
 msx legend Berichten: 4441 | Geplaatst: 21 April 2005, 01:05   | oh, yet better ^^;
sprites have one long opened line (see prev. page!), and rather than a full white char you use the same animation thing from the grass .. but now alternating white/grey .. et voila: instant animating road-stripes ..
only tricky bit is the far end, where the road is too narrow to hide the chars .. you could stop the opened sprite-line there..
| | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 01:09   | The road is built up by 32x32 pixel blocks:
+---+---+
| | |
| | |
+---+---+
| | |
| | |
+-+-+-+-+-+-+
| | | |
| | | |
+-+-+-+-+-+-+
The first two rows are made up by a left sprite and a right sprite but the third row
has a left sprite, a box with gray characters, and a right sprite.
It is of course possible to make the animated line in the third line with characters
instead of sprites which will give the same result. It will probably cost a little
more but not too much I think (only two VPOKEs).
Maybe this can be done for a "Rally-X 2" that doesn't need to meet the iombcc
rules. It would be pretty cool to see how much you can put into the game
and still have something that runs fairly smooth.
| | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 01:18   | The idea with the long stripe and background chars that change color will
work great with the characters on the base.
This means it would probably only require three VPOKEs to do the center line
animation
| | NYYRIKKI msx master Berichten: 1463 | Geplaatst: 21 April 2005, 16:03   | Look at the list of features added since first version of XRALLY. It's quite impressive:
- Opponent cars
- Position counter
- Opponent hit detection
- Car physics, that change depending of speed
- Gas pedal
- Motor sounds
- Custom fonts
- Speed meter
- Scrolling mountains
- End
- Text scroller
- "Drive to sunset"
- sound fadeout
- "the little line in the horizon"
- Time support for NTSC & PAL
List of possible things in future versions:
- Brake pedal
- Lo/Hi gear
- biger mountains
- Arrows pointing curves
- middle line
I'm also starting to believe, that everything can not be put in, but maybe we can select something...
| | NYYRIKKI msx master Berichten: 1463 | Geplaatst: 21 April 2005, 19:12   |
Look at the car data again  That my friend is obfuscated code!
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: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=Q:Q=ASC(A$)-73:Y=VAL("&H"+A$):O=O-(Q<0):FORD=0TO-(R>0)*R:VPOKEN+I,Y:I=I-(Y>0ORR>0):NEXTD,O:X=V:R=N\2:FORI=256TO1023:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO\2)\(2-(IAND4)\4):NEXT:FORI=ITO1279:VPOKE6464+(IAND63),224+8*(IAND3)-(IAND32):'
4 W=2^(IAND7):J=127\W:VPOKEI+512,JAND-W:VPOKEI+768,JOR-WAND255:J=8-(IAND32)\8:VPOKEI,(JANDI)*255\J:NEXT:FORK=1TO12:FORH=0TO31:VPOKE6496+H+K*32,(K<9ORH<VORH>17)*(ASC(MID$("<CBRCSBJRCKS",K))-211):P(H\4)=50-15*(H\12AND1):NEXT:NEXT:VPOKE8192,V
5 SOUND3,V:FORW=8TO9:PUTSPRITEW,(80+64*W,159),V,W-2:SOUNDW,V:NEXT:VPOKE1209,255:TIME=0:FORT=7TOR:LOCATE1,1:D=96-(NAND127):Y=D>0:NEXTI: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):-:U=STICK(0)
7 S=S*((X-15-E\3)\15<>0ORD<73)*(M=0):SOUND0,255-S*9:E=NAND128:X=X+5*(M+(U=7)-(U=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:U=(D>0)*(N\4-V):SOUND8,U:SOUND9,U: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:SCREEN BY' dvik & NYYRIKKI
| | Arjan msx addict Berichten: 437 | Geplaatst: 21 April 2005, 20:14   | awesome! there's still enough space to add extra features too!
| | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 20:28   | Very clever I must say  Now we have 42 free characters to use for another feature.
With 42 characters we can easily do any of your suggestions maybe except the middle line (but it would be really cool to get it in there).
I used 11 precious characters to make the mountains taller. It looks a bit better I think:
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: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=Q:Q=ASC(A$)-73:Y=VAL("&H"+A$):O=O-(Q<0):FORD=0TO-(R>0)*R:VPOKEN+I,Y:I=I-(Y>0ORR>0):NEXTD,O:X=V:R=N\2:FORI=256TO1023:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO\2)\(2-(IAND4)\4):NEXT:FORI=ITO1279:VPOKE6432+(IAND63),228+8*(IAND3)-(IAND32)
4 W=2^(IAND7):J=(I\32AND1)*127\W:VPOKEI+512,JAND-W:VPOKEI+768,JOR-WAND255:J=8-(IAND32)\8:VPOKEI,(JANDI)*255\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,255: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):-:U=STICK(0)
7 S=S*((X-15-E\3)\15<>0ORD<73)*(M=0):SOUND0,255-S*9:E=NAND128:X=X+5*(M+(U=7)-(U=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:U=(D>0)*(N\4-V):SOUND8,U:SOUND9,U: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
| | Arjan msx addict Berichten: 437 | Geplaatst: 21 April 2005, 20:52   | you can remove S=15 from line 7 and substite the S vars in line 8 with the number 15, which will safe another 3 characters. It would be interesting to check if you could get some var set to 128, so you can replace that value three times.
| | [D-Tail]
 msx guru Berichten: 2891 | Geplaatst: 21 April 2005, 20:54   | Arjan: are you implying that you can actually READ this stuff? You're crazy!!
BTW: The source is brilliant. Up till now, I've always thought what was possible in BASIC. I guess I was wrong  | | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 21:00   | S is actually used in the error callback to scroll the grass. It icontrols the speed
of the car. Maybe it is ok to use the speed the car had just before the end demo
and replace occurances of S with 15 on line 8.
For constants with three digits we need four occurances in order to save space
by replacing them with a variable. It may be possible to change some other
constants to 128 in order to do this optimization.
| | Arjan msx addict Berichten: 437 | Geplaatst: 21 April 2005, 21:00   | well, NYYRIKKI did a better job at decrypting the sourcecode  I'm just suggesting some micro-optimizations... | | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 21:03   | We've done quite a few micro-optimizations. If we get a couple more of them
we'll have enough space to add for example a center line  | | Arjan msx addict Berichten: 437 | Geplaatst: 21 April 2005, 21:05   | ah indeed, I missed the last - in line 8 
btw, 255 is occurring 4 times in the code | | NYYRIKKI msx master Berichten: 1463 | Geplaatst: 21 April 2005, 21:12   | Yeah, now we have pretty good packing ratio.  For example the last three letters "gI3" actually define last 31 bytes  (30*0 + 1*3)
| | manuel msx guru Berichten: 3188 | Geplaatst: 21 April 2005, 21:38   | NY: so, what's new in your packing (in words)? Why was the 6-bit-per-byte packing of dvik not used anymore, btw? Or is it now compressed 8-bit per byte packing?  | |
| |
| |