Schrijver
| Free your creativity - IOMBCC
| NYYRIKKI msx master Berichten: 1463 | Geplaatst: 20 April 2005, 18:11   | Ok, now I took some time for this project... Here is first version of the road generator:
1 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),15:NEXTY,X:FORI=0TO383:VPOKE14336+I,VPEEK((IAND7)+(IAND8)*32+(IAND48)\2+(IAND448)*8):NEXT:SCREEN1
Now you need to save only car data...
Sorry, that I had no time to put it into the game and test it.
| | dvik msx master Berichten: 1262 | Geplaatst: 20 April 2005, 19:08   | Nice. I'll try to put it in. I'm a bit busy the next couple of days but I'll do it as soon as I can. I did some quick estimation and I think it will save about 50 characters more than my version which is enough to fit all features  .
| | dvik msx master Berichten: 1262 | Geplaatst: 20 April 2005, 19:22   | I went ahead and integrated your change. Its in no way optimized but it shows
that it works at least (The old sprite code is still in there for example). There are
some other optimizations I did yesterday that also should get in there for
example I changed the ending so that the finish is always on a straight road. I
also made the character pattern generation a bit more efficient. It will probably
take a day to integrate everything so I'll keep you posted. Anyways, here is a
working version with the new road generation:
1 DEFINTA-Y:V=14:S$(O1)="A18A0CA0FB07C03C01H00A80AE0AF0AFCIFFH00A80AE0AF0AF8AFCBFEAFFP00F3FF7FTFFAF0AF8AFCAFELFFE00A80AC0AE0BF0AF8AFCBFEBFFP00B01B03B07B0FB1FB3FB7FBFFB80BC0BE0BF0BF8BFCBFEBFFP00B01B03B07B0FB1FB3FB7FbFFB80BC0BE0BF0BF8BFCBFE"
2 COLOR15,5,1:X=V:S$(1)="BFFX00A01A07A0FA1FA3FB7FAFFC00A01A07A0FA3FIFFA18A30AF0BE0CC0C80J00A01A03A07B0FA1FA3FB7FBFFA0FA1FA3FA7F\FFFFCFFEDFFG00A1FA20A40A7FBCFA7FB70G00AC0A20A10AF0B98AF0B70J00A0FA10A1FA2FA1FA19K00B80A40B80L00A06A0FA09_00A03"
3 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),15:NEXTY,X:FORI=0TO383:VPOKE14336+I,VPEEK((IAND7)+(IAND8)*32+(IAND48)\2+(IAND448)*8):NEXT:SCREEN1
4 J=S-J*(J<96-S):K=J\16:FORW=0TO2:VPOKE8208+W,P(W+K):NEXT:IFTTHENRESUMENEXTELSEKEYOFF:LOCATE8,1:PRINT"PLEASE WAIT!":FORI=256TO1023:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO\2)\(2-(IAND4)\4):NEXT:SOUND3,V:
5 A=32*12: FORW=0TO1:FORO=1TO212STEP3:Q=ASC(MID$(S$(W),O,1))-65:Y=VAL("&H"+MID$(S$(W),O+1,2)):N=14336:IFNOT(W=1ANDO>114)THEN 6 ELSE FORA=ATOA+Q:VPOKEA+N,Y:NEXT
6 NEXT:PUTSPRITE8+W,(80+64*W,159),V,6+W:NEXT:ONERRORGOTO4:FORR=1TO12:FORH=0TO31:VPOKE6496+H+R*32,(R<9ORH<VORH>17)*(ASC(MID$("ABCSBRCKSBJR",R))-211)
7 P(H\4)=50-15*(H\12AND1):NEXT:NEXT:FORI=ITO1168:VPOKEI-(I=1168),(8ANDI)*255\8:VPOKE8+I,(4AND7-I)*255\4:NEXT:VPOKE8192,V:TIME=0:SOUND9,V:R=N\2:
8 FORI=1536TO1791:W=2^(IAND7):J=127\W:VPOKEI,JAND-W:VPOKEI+256,JOR-WAND255:NEXT:FORJ=0TO63:VPOKE6464+J,224+8*(JAND3)-(JAND32):NEXT
9 FORT=7TOR:R: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
10 IF: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:OR:M=(X>72)-(X<0):SOUND0,O-S*9:S=S-(S<18ANDSTRIG(0))*2+(S>0):S=S*((X-15-E\3)\15<>0ORD<73)*(M=0):E=NAND128:F=B:B:IFC<TTHENC=V+T+TMOD99:B=CMOD3-1
11 G=F*S-G*(G<R):FORW=8216TO8219:VPOKEW,86+(GAND16):VPOKE4+W,85+(GAND24)\24:G=G+8:NEXT
12 X=X+5*(M+(U=7)-(U=3))-S*B\4:LOCATE1,1:8:N=N+9-S:TO:PUTSPRITE0,(X+80,156),1,12:SOUND1,83:SOUND8,V:D=96-(NAND127):Y=D>0:D=D*D\96:U=STICK(0):*:PRINTUSING"SPEED:###kmh RANK:###";S*10;N\128-82:NEXT:Z$=SPACE$(V):S=15:Z=TIME\(6-PEEK(43)\128)
13 FORN=0TO244:D=88-3*N:U=Y*(N\6-V):Y=D>0:SOUND8,U:SOUND9,U:D/2:PUTSPRITE0,(116-(D<58)*((21-D*D\96)*B+F*10)+(X-36)*D\126,-Y*(98+D)-31),1,15+Y*D\24:LOCATE6,4:PRINTMID$(Z$+"Race Over Time ="+STR$(Z/10)+"s"+Z$,NMOD42+1,S):NEXTI:NEXT:SCREENUP
| | dvik msx master Berichten: 1262 | Geplaatst: 20 April 2005, 22:45   | I couldn't wait to finish it up  So here is the Rally-X entry with all features including scrolling mountains, faiding audio, the little line in the horizon and
everything is within the size limits. I'll test it some more later today.
Here is the final code (we've said that a couple of times now  :
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),15:NEXTY,X
2 N=14336:FORI=0TO383:VPOKEN+I,VPEEK((IAND7)+(IAND8)*32+(IAND48)\2+(IAND448)*8):NEXT:SCREEN1:S$="G00A1FA20A40A7FBCFA7FB70G00AC0A20A10AF0B98AF0B70J00A0FA10A1FA2FA1FA19K00B80A40B80L00A06A0FA09_00A03":KEYOFF:LOCATE8,1:PRINT"PLEASE WAIT!":X=V:
3 FORO=1TO98STEP3:Q=ASC(MID$(S$,O,1))-65:Y=VAL("&H"+MID$(S$,O+1,2)):FORI=ITOI+Q:VPOKEI+N,Y:NEXT:NEXT: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
| | snout
 msx legend Berichten: 4981 | Geplaatst: 20 April 2005, 22:54   | W0000T!
| | snout
 msx legend Berichten: 4981 | Geplaatst: 20 April 2005, 22:58   | I just played it and euhm.. well... this is insane! If you have one or two chars left, how about adding a hi/lo gear (Hyper Rally style) for the mega-finishing touch?
Darn.. a complete racing game in 1524 bytes (saved tokenized). Konami eat your heart out. Anyone eat your heart out, really  | | wolf_ online
 msx legend Berichten: 4441 | Geplaatst: 20 April 2005, 23:12   | pretty freaky  283.3 seconds .. I wonder what other games (except Tetris, seen in in MCCM already) can be done in such few lines at reasonable speed.. | | manuel msx guru Berichten: 3188 | Geplaatst: 20 April 2005, 23:30   | If you need more ideas: how about hills? Or day/night/snow, like in the IOCCC?
Don't get me wrong: the program is freakin' brilliant!  | | dvik msx master Berichten: 1262 | Geplaatst: 20 April 2005, 23:33   | This one has 'rank' which the ioccc one doesn't. I'm not sure it compensates for hills, snow etc though  | | NYYRIKKI msx master Berichten: 1463 | Geplaatst: 20 April 2005, 23:52   |
Nice... so, what we'll implement next... I know there are few loose bytes (like line color) in road genarator
| | wolf_ online
 msx legend Berichten: 4441 | Geplaatst: 21 April 2005, 00:24   | What about white chars behind the road, and holes in the sprite to suggest moving road-stripes? animating perhaps ^_^ .. so multiple roadsprites..
| | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 00:39   | wolf_: Thats a very good idea. It will require more code but I think it can be done
without any performance hits. Just put a solid white character behind the road
and then use multiple roadsprites. In the current version the middle part of the
base of the road is not a sprite though so that has to be changed.
But I honestly don't think it is possible to add this within the iombcc limits
though. I know I said it before, for example that I didn't think it was possible to
add opponent cars and since then we added an end demo, mountains, sound,
gas pedal, time, rank and more but now I think we're reaching the limit of
whats possible to squeeze in.
| | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 00:41   | NYYRIKKI, I won't have any time to do any updates the next coming days so
if you want to update anything, just go ahead. When we are done we need
to tweek the grass update to make it smoother. There is no point in doing
this before we are done with the rest of the code though.
| | dvik msx master Berichten: 1262 | Geplaatst: 21 April 2005, 00:44   | wolf_: actually there is a small problem doing the stripes using sprites with
holes. The problem is that it would require 5 sprites on the same line at the
base of the road (three for the road, one for the black car and one for the red).
Thats actually why I made the center part of the base of gray characters
instead of a sprite. I forgot about that.
| | wolf_ online
 msx legend Berichten: 4441 | Geplaatst: 21 April 2005, 00:57   | uh no?
You precalced the road-sprites, rite? just change the pattern, make holes in the sprites.
original sprite:
.....oooooo.....
.....oooooo.....
....oooooooo....
....oooooooo....
...oooooooooo...
...oooooooooo...
..oooooooooooo..
..oooooooooooo..
new sprite:
.....oooooo.....
.....oooooo.....
....oooooooo....
....ooo..ooo....
...oooo..oooo...
...oooo..oooo...
..oooooooooooo..
..oooooooooooo..
in that hole you see the white background chars..
Ahwell, you can as well make it not animating, and rather than broken stripes, make one long line ^_^.. just slightly different spritepatterns and white chars in the back | |
| |
| |