Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 02:50 11 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : On the Road again

     Page 3 of 4    
Author Message
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 05:10am 23 Oct 2022
Copy link to clipboard 
Print this post

Hi vegipete
brilliant ...

  vegipete said  What fun!

Here's a modification to include a track.
At the very end is a data block that encodes the track. You can change it for any course you might like.

I'm not sure if I have the sky movement correct. I don't have an SD card connected, so I can't load the sky graphic to test.

sky movement is correct, the only thing is, that the framerate slows a little(but visible in the Bordercolor movement) in the  curvature comparing to the straight road...
I wouldn't like to waste cpu time with waitstates, rather one could speed up the animation of the borders in the curvature

but this is complaining at a high level.. Great Job

Mart!n


meanwhile I prepare the next sprites


Edited 2022-10-23 18:39 by Martin H.
'no comment
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 12:43pm 24 Oct 2022
Copy link to clipboard 
Print this post

Hi vegipete
i ve done some little changes in your code and added the new Protagonist.


'modyfied by vegipete
'AutoSave
Dim Col%(15),Xofs%(2,160)
Restore colors:For f%=1 To 15:Read Col%(f%):Next f%
'SH% and SW% Displayresolution
'SH%=240:SW%=320 - use MM.HRES and MM.VRES instead
dist%=0:Speed%=20
Option Break 4: On Key 3, on_break
MODE 2
FRAMEBUFFER create
FRAMEBUFFER WRITE F
read_sprites
'Precalc the Curve
For f%=0 To 159
 Xofs%(1,159-f%) = ((160*Exp(f%/50))/20)-8
 Xofs%(2,159-f%) = -Xofs%(1,159-f%)
Next
'Precalc the Bordercolors
Dim Bcol%(8,120)
For dst%=0 To 7:For f%=0 To 120
 bcol%(dst%,f%)=col%(7-3*((Sin((((120-f%)/40)^3)+dst%*.75))>0))
Next :Next :dst%=0
'
CLS COL%(1): Load image "sky.bmp"
HW%=MM.HRes/2:HH%=MM.VRes/2
'-------endless loop -----------------------
' n is degree of bend
n%=0   ' current curvature - start off straight
t%=Timer:fcnt=0
restore TrackData
Do
 Read turn%,dur%
 If dur% < 0 Then
   t%=(Timer-t%)/1000:Text 1,1,Str$(fcnt/t%,3,3) ' show framerate
   t%=Timer:fcnt=0
   Restore TrackData
   Continue Do ' restart the track
 EndIf
 If n% < turn% Then  ' adjust curvature towards left
   For i = n% To turn% Step Speed%/dur%*100
     DrawTrack i:do_car -Sgn(i):Mov_sky -Sgn(i):FRAMEBUFFER COPY F,N:Inc fcnt
   Next
   n%=turn%
 ElseIf n% > turn% Then  ' more to right
   For i = n% To turn% Step -Speed%/dur%*100
     DrawTrack i:do_car -Sgn(i):Mov_sky -Sgn(i):FRAMEBUFFER COPY F,N:Inc fcnt
   Next
   n%=turn%
 Else   ' continue along path
   For i = 1 To dur% 'Step -Speed%/dur%
     DrawTrack n%:do_car -Sgn(n%):Mov_sky -Sgn(n%):FRAMEBUFFER COPY F,N:Inc fcnt
   Next
 EndIf
Loop

'------------------------------
'b1x% left x position of the left Border
'b2x% right x position of the left Border and left x position of the street
'b3x% right x position of the street and left x position of the right Border
'b4x% right x position of the right Border
'BB% Border broad
'bc% Border Color (red or white) calculated over Sinus Function
'HH% Half Screen y-Res  HW% Half Screen x-Res
'xofs%() Pre calculated Curve over Exponetial function
'ofsx% how much has the Curve to be bended
Sub DrawTrack curv
 Box 0,hh%+2,MM.HRes,hh%-2,,COL%(2),COL%(2)
 For F%=2 To HH%
   bc%=bcol%(dst%,f%):ofs%=xofs%(2,f%)*curv/100:y%=hh%+f%:BB%=f%/4
   b1X%=HW%-F%-bb%+ofs%:b2x%=HW%-F%+ofs%
   b3x%=HW%-F%+ofs%+2*f%:b4x%=b1x%+(2*bb%+2*f%)
   Line b1x%,y%,b4x%,y%,,bcol%(dst%,f%)
   Line b2x%,y%,b3x%,y%,,0
 Next
 Inc dst%:dst%=dst% And 7
End Sub

'--- Moves the Sky while driving a curve
Sub Mov_sky dir%
Local mv1%=1,mv2%=2
If dir%=0 Then
 Exit Sub  ' driving straight so sky doesn't change
 ' need to adjust time to draw nothing
EndIf
If dir%>0 Then
 Sprite read #31,0,28,mv2%,22
 Sprite Mv2%,28,0,28,320-mv2%,22
 Sprite write #31,320-mv2%,28

 Sprite read #31,0,50,mv2%,22
 Sprite Mv1%,50,0,50,320-mv1%,22
 Sprite write #31,320-mv1%,50

 Sprite read #30,0,102,mv2%,10
 Sprite Mv2%,102,0,102,320-mv2%,10
 Sprite write #30,320-mv2%,102
Else
 Sprite read #31,320-mv2%,28,mv2%,22
 Sprite 0,28,mv2%,28,320-mv2%,22
 Sprite write #31,0,28

 Sprite read #31,320-mv2%,50,mv2%,22
 Sprite 0,50,mv1%,50,320-mv1%,22
 Sprite write #31,0-mv1%,50

 Sprite read #30,320-mv2%,102,mv2%,10
 Sprite 0,102,mv2%,102,320-mv2%,10
 Sprite write #30,0,102
EndIf
'Sprite CLOSE 31
End Sub

Sub do_car dir%
 If dir%=0 Then
   If dst% Mod 2 Then
      Sprite write #1,132,200
   Else
      Sprite write #2,132,200
   EndIf
 Else
  Sprite write #3,132,200,(dir%<0)
  EndIf
End Sub

Sub read_Sprites
 Local nr%,p%,n%,byt$,m$
 '--- Read/Create Sprites
 Restore car
   For p%=1 To 31
     Read Byt$:Byt$=expand$(Byt$)
     For n%=1 To Len(Byt$)/2
       m$=Mid$(Byt$,n%,1)
       Pixel n%-1,p%,COL%(Val("&H"+m$))
       Pixel 56-n%,p%,COL%(Val("&H"+m$))
       m$=Mid$(Byt$,Len(Byt$)-(n%-1),1)
       Pixel n%-1,32+p%,COL%(Val("&H"+m$))
       Pixel 56-n%,32+p%,COL%(Val("&H"+m$))
     Next
   Next
 Sprite read #1,0,0,56,32:Sprite read #2,0,32,56,32
'  Sprite load "Car3.spr",3
 Restore car3
   For p%=0 To 30
     Read Byt$:Byt$=expand$(Byt$)
     For n%=1 To Len(Byt$)
       m$=Mid$(Byt$,n%,1)
       Pixel n%-1,p%,COL%(Val("&H"+m$))
     Next
   Next
Sprite read #3,0,0,56,30
End Sub

Function expand$(pxl$)
 Local n%,nmb%,tmp$,co$
 For n%=1 To Len(pxl$)
   If Asc(Mid$(pxl$,n%,1))< 71 Then   ' asc("G") = 71
     tmp$=tmp$+Mid$(pxl$,n%,1)
   Else
     ' run length encoded - 1st char is pixel colour+71, 2nd is count-1
     co$=Hex$(Asc(Mid$(pxl$,n%,1))-71)
     Inc n%:nmb%=Val("&H"+Mid$(pxl$,n%,1)):tmp$=tmp$+String$(nmb%+1,co$)
   EndIf
 Next
 expand$=tmp$
End Function

Sub on_break
 Sprite CLOSE all: FRAMEBUFFER CLOSE
 MODE 1: Option Break 3
 End
End Sub

colors:
'--Colorscheme accordung to matherp
Data RGB(BLUE),RGB(GREEN),RGB(CYAN),RGB(RED)
Data RGB(MAGENTA),RGB(YELLOW),RGB(WHITE)
Data RGB(MYRTLE),RGB(COBALT),RGB(MIDGREEN),RGB(CERULEAN)
Data RGB(RUST),RGB(FUCHSIA),RGB(BROWN),RGB(LILAC)

car:
Data "GFGFGFG7","GFGFGFG7","GFG9P3GFG9","GFG8917719GFG8","G8N3GA91J319GAN3G8"
Data "G7788087G5EECF11M311FCEEG5780887G7"
Data "G678FF00800FDCFC48F11M311F84CFCDFG77G6"
Data "G67G5DD4U2C4B107M3701B4CU24DDG2FF07G6","G67G4U6C4B107M3701B4CU6G47G6"
Data "G67G3U8AB1U71BAU8G37G6","G67G2U24CU4AAU9AAU4C4U2G27G6"
Data "G6700U3KFKBU3007G6","00N5U54OFO94U5N500","07788G6EEKFKBEEG688770"
Data "078G9E4OB44OB4EGA70","0700FF0V3001KAEK3EKA1GA70"
Data "07GA14HAK3HA4100V30FF0070","07GA14019R255911K311955R291041GA70"
Data "07GA5119R2L2911K3119L2R29115G9770","07GA551R3L2911K3119L2R3155G9770"
Data "07GAL99V79L9G9770","077G9L99V79L9GA70","077G9551R3L29B8R38B9L2R3155G9770"
Data "077G9519R3L29B891198B9L2R3915G9770"
Data "07GA919BB9H259B891198B95H29BB919GA70","07GA791BBH49B8R38B9H4BB197GA70"
Data "07GA70819H49B8R38B9H491807GA70","07GA7G2H489O9H5007GA70"
Data "078G887G4H2GBH2G478G8870","0778G6877GFGB778G68770","00NAGFGDNA00"
car3:
'uncompressed by now
data "00000000000000000000000000000000000000000000000000000000"
data "00000000000000000000000000000000000000000000000000000000"
data "00000000000000000000000001111000000000000000000000000000"
data "00000000000000000000000011771100000000000000000000000000"
data "00000000000000000000000113333110000000000000000000000000"
data "0000000000000000000000011366611BBBBB00000000000000000000"
data "00000000000000000007778113666116BBB334000000000077777000"
data "0000000000000000007FF011B6666611BB3344400000000700000700"
data "000000000000000000700011B6666611B3344444E00000700FF00070"
data "0000000004440000007000EEEEEEEEEE334444EEEEE555700000B070"
data "00000000444444444444EEEEEEEEEEEE44444EEEEEEE45500000B070"
data "000000048888888888844444444444444444EEEEEEE444400000B070"
data "00777774444444444448888888888884444EEEEEEEE444400000B070"
data "07800004888888888844444444444444444E8888800008700000B070"
data "78000004444444444444E8888888888444480000000008800000B070"
data "70FFF0F4444401111144E444444444444400FFF0F000000800000070"
data "7000000044005B5B114444441111111444000000000009B000000700"
data "7000000000055B5B114444441195555B44000000000019B077777000"
data "700000000055555B114444441195555BBB000000000019B070000000"
data "700000000055555BFF4444441195555BBB000000000019B070000000"
data "700000000055555BFF44444FFF95555555000000000019B070000000"
data "70000000F055555B3FFFFFFFFF95555555000000000019B070000000"
data "70000000F0055B5B38BBBF8FFF95555BBB00000000F019B070000000"
data "700000000000111938911983F395555BBB00000000F019B070000000"
data "70000000000111113891198333951119BB00000000F019B070000000"
data "700000000001111138BBBB8333911111B9000000000009B070000000"
data "780000000081111138BBB88333911111B90000000000000070000000"
data "0780000008791110888BB88333911111178000000000000870000000"
data "00777777777000000008888888901110007800000000008700000000"
data "00000000000000000000000000000000000777777777777000000000"


TrackData:
' encoded track
' first value is amount of curve, negative = right, 100 is just off screen
' second value is duration of segment, negative = end of track, restart
Data    0,200   ' straight for a bit
Data   50,500   ' start turn to the left
Data   50, 50   ' hold turn to the left
Data    0,400   ' return to straight
Data    0, 30   ' straight for a bit
Data -100,1000  ' turn to right
Data -200,500   ' turn even sharper to right
Data -100,300   ' reduce right turn
Data  -10,500   ' reduce turn even more
Data  -10, 25   ' hold gentle right turn
Data  200,250   ' turn hard left!
Data    0,200   ' return to straight
Data    0, 50   ' straight for a bit
Data  100,150   ' turn left - chicane
Data    0,100   ' return to straight
Data    0, 10   ' straight for a bit
Data -100,100   ' turn right
Data    0,100   ' return to straight
Data    0,100   ' straight for a bit
Data   40,650   ' bend to the left
Data   40, 50   ' hold bend to the left
Data   75,250   ' more bend to the left - double apex
Data    0,400   ' return to straight
Data    0,-200  ' end of track                                      

'no comment
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1652
Posted: 06:52pm 24 Oct 2022
Copy link to clipboard 
Print this post

I like your code but it is really more suited to mmb vga not lcd.
It is 7 fps with a 32 pixel high scrolling background.
The mmb vga version is a bit too niche for me but a great hobby idea.
A touch lcd seems more relevant than a trs80 clone.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 05:57am 25 Oct 2022
Copy link to clipboard 
Print this post

  stanleyella said  I like your code but it is really more suited to mmb vga not lcd.
It is 7 fps with a 32 pixel high scrolling background.
The mmb vga version is a bit too niche for me but a great hobby idea.
A touch lcd seems more relevant than a trs80 clone.

7 FPS is really not very pleasant. On the other hand, I think it's very good that you're so interested in the code, so it would be a shame if you gave up. Some valuable insights are gained by studying foreign program-codes.
So even if you can only get it running at 7 fps, you've certainly gained a lot of experience.
btw. I just ordered a ARCELI 2.4" ILI9341 240X320 TFT LCD Display so I will have a look, how to get it to run on non VGA Picomite at the End of the week
Edited 2022-10-25 16:29 by Martin H.
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5751
Posted: 06:59am 25 Oct 2022
Copy link to clipboard 
Print this post

A SSD1963 with parallel interface would be the way to go if you want an LCD display. It's *far* faster than a SPI interface and the fact that it uses a lot of pins isn't terribly important here. There's enough for the keyboard.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 03:26pm 25 Oct 2022
Copy link to clipboard 
Print this post

compressing the Sprite Data
--- Mart!ns little Toolbox

So far I've used a text editor to search and replace repeating parts of the Sprite Data strings with the compressed form.
which is quite laborious.
Example :
find "0000000000000000" replace with "GF"
find "000000000000000"  replace with "GE"
find "00000000000000"   replace with "GD"
...
find "000" replace with "G2"
and that for all 16 colors.
You can do something like this 2-3 times, but it's boring and a real punishment. So I thought, the pico can do that much faster and with less effort so let him do the work

Function compress$(search$)
 found=0
 For f%=0 To 15
   For n%=16 To 3 Step -1
     from$=String$(n%,Hex$(f%,1))
     zu$=Chr$(71+f%)+Chr$(128+Asc(Hex$(n%-1,1)))
'addition of 128 prevents the results from
'being incorrectly counted in a further search
     Do
       search$=replace$(from$,zu$,search$)
       If found=0 Then Exit
     Loop
   Next n%
 Next f%
 compress$=""
 For f%=1 To Len(search$)
   n%=Asc(Mid$(search$,f%,1))
   n%=n%-128*(n%>128):'sub the 128 if needed
   compress$=compress$+Chr$(n%)
 Next
End Function
'
Function replace$(sr$,repl$,sear$)
Local n%,tmp$
tmp$=" "+sear$+" "
found=Instr(tmp$,sr$)
If found=0 Then replace$=sear$:Exit Function
tmp$=Left$(tmp$,found-1)+repl$+Right$(tmp$,Len(tmp$)-(found+Len(sr$))+1)
replace$=Mid$(tmp$,2,Len(tmp$)-2)
End Function



there is certainly still something to optimize, but it works.  
the following compressed output resulted from the data of the program above

  Quote  GFGFGFG7
GFGFGFG7
GFG8H3GFGA
GFG7117711GFG9
GFG611J311GFG8
GFG6113M211R4GFG3
GFG2N28113M2116R2334G9N4G2
GF007FF011BM411BB33K2G77G4700
GF007G211BM411B33K4EG4700FFG270
G8K2G57G2U933K3U4L27G4B070
G7KBUBK4U6455G4B070
G64OAKF4U6K3G4B070
00N4KBOBK3U7K3G4B070
078G34O9KF4EO4G387G4B070
78G4KCEO9K38G888G4B070
70V20FK40H444EKC00V20FG58G570
7G644005B5B11K5H6K2GA9BG5700
7G955B5B11K5119L3B44G919B0N4G2
7G8L4B11K5119L3R2G919B07G6
7G8L4BFFK5119L3R2G919B07G6
7G8L4BFFK4V29L6G919B07G6
7G6F0L4B3V89L6G919B07G6
7G6F0055B5B38R2F8V29L3R2G7F019B07G6
7GAH2938911983F39L3R2G7F019B07G6
7G9H43891198J295H29BBG7F019B07G6
7G9H438R38J29H4B9GA9B07G6
78G78H438R288J29H4B9GD7G6
078G5879H20O2BB88J29H578GB87G6
00N8G7O690H2G278G987G7
GFGFG2NBG8



These strings as data result in the following lines

car3:
data "GFGFGFG7","GFGFGFG7","GFG8H3GFGA","GFG7117711GFG9"
data "GFG611J311GFG8","GFG6113M211R4GFG3"
data "GFG2N28113M2116R2334G9N4G2","GF007FF011BM411BB33K2G77G4700"
data "GF007G211BM411B33K4EG4700FFG270","G8K2G57G2U933K3U4L27G4B070"
data "G7KBUBK4U6455G4B070","G64OAKF4U6K3G4B070"
data "00N4KBOBK3U7K3G4B070","078G34O9KF4EO4G387G4B070"
data "78G4KCEO9K38G888G4B070","70V20FK40H444EKC00V20FG58G570"
data "7G644005B5B11K5H6K2GA9BG5700","7G955B5B11K5119L3B44G919B0N4G2"
data "7G8L4B11K5119L3R2G919B07G6","7G8L4BFFK5119L3R2G919B07G6"
data "7G8L4BFFK4V29L6G919B07G6","7G6F0L4B3V89L6G919B07G6"
data "7G6F0055B5B38R2F8V29L3R2G7F019B07G6"
data "7GAH2938911983F39L3R2G7F019B07G6","7G9H43891198J295H29BBG7F019B07G6"
data "7G9H438R38J29H4B9GA9B07G6","78G78H438R288J29H4B9GD7G6"
data "078G5879H20O2BB88J29H578GB87G6","00N8G7O690H2G278G987G7","GFGFG2NBG8"

in combination with the sprite read and expand routine you can save quite a few kilobytes.
happy pixel counting  
Cheers
Mart!n
Edited 2022-10-26 01:47 by Martin H.
'no comment
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 384
Posted: 03:52pm 25 Oct 2022
Copy link to clipboard 
Print this post

This is cool! I didn't know that one can compress data this way! Much to learn from your code!

Greetings
Daniel
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1652
Posted: 07:27pm 25 Oct 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  A SSD1963 with parallel interface would be the way to go if you want an LCD display. It's *far* faster than a SPI interface and the fact that it uses a lot of pins isn't terribly important here. There's enough for the keyboard.

Not cheap considering vga displays are usually £5 if not thrown out.
  Mixtel90 said  A SSD1963 with parallel interface would be the way to go if you want an LCD display. It's *far* faster than a SPI interface and the fact that it uses a lot of pins isn't terribly important here. There's enough for the keyboard.

Not cheap though
https://www.ebay.co.uk/itm/294562294939?hash=item449547ec9b:g:D4UAAOSwWjxhl9a1&amdata=enc%3AAQAHAAAA4ElfrU9%2Bo7%2FfF2pHcZXfsm4J3wvVhqrFZZOkxv0rjv5SLvARa4e7gJGmB8Wd1IcUMYbXlaXfHi786gOwRETS80m172JXANMkXaOng9d02POI6%2BPywIrj%2Bss5cLvRgLdrJ%2FDuW33sdBfuRA4nWQ88tQTscBPZqIoBiu%2BFNn%2B7fXKXyuScly7uCm3tu67rr5ewipCdRaal2WnUfKTwOFoS%2Fo7hImTquUI%2BrESqWZ%2FgGGUY0HdiBENgIUAZk9JwV%2F%2FAF4uxTS8uw0VsyDTl3v0yCp1BeBIydx9EsWbREBOm%2BHGe%7Ctkp%3ABk9SR8ru1_-BYQ

There was one Tandy (aka radio shack) shop in Cardiff and it sold a trs80 but no one I knew had one. Maplin outlived Tandy.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5751
Posted: 08:02pm 25 Oct 2022
Copy link to clipboard 
Print this post

You pays your money, you takes your choice, I'm afraid.
If you want a fast display you can't use a SPI interface on the PicoMite.

"Ye canna change the laws of physics Jim!"
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1652
Posted: 11:32pm 25 Oct 2022
Copy link to clipboard 
Print this post

"Ye canna change the laws of physics Jim!"
Scotty always called him captain  
Nothing stopping me trying the vga version. A bit too niche hobbyist but think it is very impressive, I got loads of vga monitors and 14" tv with vga, so cheap and plenty of keyboards, it is the space for another pc/display/keyboard.
I like the way you can make an old pooter for £10.
The ili9341 and sd card and touch and graphics work better than anything else I have used.
How many people want to use a picomite to code lcd games?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5751
Posted: 06:28am 26 Oct 2022
Copy link to clipboard 
Print this post

Probably not many.
LCD display games usually means portable, so battery powered. The PicoMite doesn't have a low power mode so that, together with a backlight, tends to clobber batteries. It's a pity really.

The LCD display really comes into its own for control systems, where touch control can be really useful and save on a lot of confusing buttons and switches. Power consumption is rarely a problem.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1652
Posted: 03:34pm 26 Oct 2022
Copy link to clipboard 
Print this post

I never got into hand held games and that applies now with smart phone games.
I can see a picomite and vga as a cheap computer setup for a real world application.
Same with mmb lcd, it has real uses.
People forget for the price a rpipico is same price as an arduino nano and are good for robots, etc.
I like @Martins graphics. Plenty to learn. I looked up trs 80 emulator.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 11:26am 28 Oct 2022
Copy link to clipboard 
Print this post

A new Dimension
I updated vegipetes modyfied Version with another component,
When you Press "o" or "p" the Car stays where it is but Background moves perspectively left or right :-)

'modyfied by vegipete
'
Dim Col%(15),Xofs%(160)
Restore colors:For f%=1 To 15:Read Col%(f%):Next f%
MODE 2:SH%=MM.VRes:SW%=MM.HRes:HW%=SW%/2:HH%=SH%/2
dist%=0:Speed%=20:PPos%=0
Option Break 4: On Key 3, on_break
FRAMEBUFFER create:FRAMEBUFFER WRITE F
read_sprites
'Precalc the Curve
For f%=0 To 159:Xofs%(159-f%)=-((160*Exp(f%/50))/20)-8:Next
'Precalc the Bordercolors
Dim Bcol%(8,120)
For dst=0 To 7:For f%=0 To 120
bcol%(dst,f%)=col%(7-3*((Sin((((120-f%)/40)^3)+dst*.75))>0)):Next :Next :dst=0:spt=1
CLS COL%(1): Load image "sky.bmp"

'-------endless loop -----------------------
' n is degree of bend
n%=0   ' current curvature - start off straight
t%=Timer:fcnt=0
Restore TrackData
Do
Read turn%,dur%
If dur% < 0 Then
  t%=(Timer-t%)/1000:Text 1,1,Str$(fcnt/t%,3,3) ' show framerate
  t%=Timer:fcnt=0
  Restore TrackData
  Continue Do ' restart the track
EndIf
If n% < turn% Then  ' adjust curvature towards left
  For i = n% To turn% Step Speed%/dur%*100
    DrawTrack i:do_car -Sgn(i):Mov_sky -Sgn(i):FRAMEBUFFER COPY F,N:Inc fcnt
  Next
  n%=turn%
ElseIf n% > turn% Then  ' more to right
  For i = n% To turn% Step -Speed%/dur%*100
    DrawTrack i:do_car -Sgn(i):Mov_sky -Sgn(i):FRAMEBUFFER COPY F,N:Inc fcnt
  Next
  n%=turn%
Else   ' continue along path
  For i = 1 To dur% 'Step -Speed%/dur%
    DrawTrack n%:do_car -Sgn(n%):Mov_sky -Sgn(n%):FRAMEBUFFER COPY F,N:Inc fcnt
  Next
EndIf
Loop

'------------------------------
'b1x% left x position of the left Border
'b2x% right x position of the left Border and left x position of the street
'b3x% right x position of the street and left x position of the right Border
'b4x% right x position of the right Border
'BB% Border broad
'bc% Border Color (red or white) calculated over Sinus Function
'HH% Half Screen y-Res  HW% Half Screen x-Res
'PDist% Shift relative to Car Position PPos%
'xofs%() Pre calculated Curve over Exponetial function
'ofsx% stregth of the bend
Sub DrawTrack curv
Box 0,hh%+2,sw%,hh%-2,,COL%(2),COL%(2)
For F%=2 To HH%
  PDist%=PPos%*f%/HH%
  bc%=bcol%(dst,f%):ofs%=xofs%(f%)*curv/100:y%=hh%+f%:BB%=f%/4
  b1X%=HW%-F%-bb%+ofs%:b2x%=Pdist%+HW%-F%+ofs%
  b3x%=Pdist%+HW%-F%+ofs%+2*f%:b4x%=Pdist%+b1x%+(2*bb%+2*f%):Inc b1x%,PDist%
  Line b1x%,y%,b4x%,y%,,bcol%(dst,f%):Line b2x%,y%,b3x%,y%,,0
Next
Inc dst,spt:dst=dst And 7
End Sub

'--- Moves the Sky while driving a curve
' spt adjusts the border speed to draw nothing

Sub Mov_sky dir%
Local mv1%=1,mv2%=2
If dir%=0 Then spt=1:Exit Sub  ' driving straight so sky doesn't change
spt=1.4
If dir%>0 Then
Sprite read #31,0,28,mv2%,22:Sprite Mv2%,28,0,28,320-mv2%,22
Sprite write #31,320-mv2%,28
Sprite read #31,0,50,mv2%,22:Sprite Mv1%,50,0,50,320-mv1%,22
Sprite write #31,320-mv1%,50
Sprite read #30,0,102,mv2%,10:Sprite Mv2%,102,0,102,320-mv2%,10
Sprite write #30,320-mv2%,102
Else
Sprite read #31,320-mv2%,28,mv2%,22:Sprite 0,28,mv2%,28,320-mv2%,22
Sprite write #31,0,28
Sprite read #31,320-mv2%,50,mv2%,22:Sprite 0,50,mv1%,50,320-mv1%,22
Sprite write #31,0-mv1%,50
Sprite read #30,320-mv2%,102,mv2%,10:Sprite 0,102,mv2%,102,320-mv2%,10
Sprite write #30,0,102
EndIf
End Sub

Sub do_car dir%
If dir%=0 Then
  If dst Mod 2 Then
     Sprite write #1,132,200,4
  Else
     Sprite write #2,132,200,4
  EndIf
Else
 Sprite write #3,132,200,4+(dir%<0)
 EndIf
' move with "o" and "p"
 key$=Inkey$
 Select Case key$
   Case "o"
   Inc  PPos%,8:If PPos%>160 Then PPos%=160
   Case "p"
   Inc PPos%,-8:If PPos%<-160 Then PPos%=-160
  End Select
End Sub

Sub read_Sprites
Local nr%,p%,n%,byt$,m$
'--- Read/Create Sprites
Restore car
  For p%=1 To 31
    Read Byt$:Byt$=expand$(Byt$)
    For n%=1 To Len(Byt$)/2
      m$=Mid$(Byt$,n%,1)
      Pixel n%-1,p%,COL%(Val("&H"+m$))
      Pixel 56-n%,p%,COL%(Val("&H"+m$))
      m$=Mid$(Byt$,Len(Byt$)-(n%-1),1)
      Pixel n%-1,32+p%,COL%(Val("&H"+m$))
      Pixel 56-n%,32+p%,COL%(Val("&H"+m$))
    Next
  Next
Sprite read #1,0,0,56,32:Sprite read #2,0,32,56,32
CLS :'  Sprite load "Car3.spr",3
Restore car3
  For p%=0 To 30
    Read Byt$:Byt$=expand$(Byt$)
    For n%=1 To Len(Byt$)
      m$=Mid$(Byt$,n%,1)
      Pixel n%-1,p%,COL%(Val("&H"+m$))
    Next
  Next
Sprite read #3,0,0,56,30
End Sub

Function expand$(pxl$)
Local n%,nmb%,tmp$,co$
For n%=1 To Len(pxl$)
  If Asc(Mid$(pxl$,n%,1))< 71 Then   ' asc("G") = 71
    tmp$=tmp$+Mid$(pxl$,n%,1)
  Else
    ' run length encoded - 1st char is pixel colour+71, 2nd is count-1
    co$=Hex$(Asc(Mid$(pxl$,n%,1))-71)
    Inc n%:nmb%=Val("&H"+Mid$(pxl$,n%,1)):tmp$=tmp$+String$(nmb%+1,co$)
  EndIf
Next
expand$=tmp$
End Function

Sub on_break
Sprite CLOSE all: FRAMEBUFFER CLOSE
MODE 1: Option Break 3
End
End Sub

colors:
'--Colorscheme accordung to matherp
Data RGB(BLUE),RGB(GREEN),RGB(CYAN),RGB(RED)
Data RGB(MAGENTA),RGB(YELLOW),RGB(WHITE)
Data RGB(MYRTLE),RGB(COBALT),RGB(MIDGREEN),RGB(CERULEAN)
Data RGB(RUST),RGB(FUCHSIA),RGB(BROWN),RGB(LILAC)

car:
Data "GFGFGFG7","GFGFGFG7","GFG9P3GFG9","GFG8917719GFG8","G8N3GA91J319GAN3G8"
Data "G7788087G5EECF11M311FCEEG5780887G7"
Data "G678FF00800FDCFC48F11M311F84CFCDFG77G6"
Data "G67G5DD4U2C4B107M3701B4CU24DDG2FF07G6","G67G4U6C4B107M3701B4CU6G47G6"
Data "G67G3U8AB1U71BAU8G37G6","G67G2U24CU4AAU9AAU4C4U2G27G6"
Data "G6700U3KFKBU3007G6","00N5U54OFO94U5N500","07788G6EEKFKBEEG688770"
Data "078G9E4OB44OB4EGA70","0700FF0V3001KAEK3EKA1GA70"
Data "07GA14HAK3HA4100V30FF0070","07GA14019R255911K311955R291041GA70"
Data "07GA5119R2L2911K3119L2R29115G9770","07GA551R3L2911K3119L2R3155G9770"
Data "07GAL99V79L9G9770","077G9L99V79L9GA70","077G9551R3L29B8R38B9L2R3155G9770"
Data "077G9519R3L29B891198B9L2R3915G9770"
Data "07GA919BB9H259B891198B95H29BB919GA70","07GA791BBH49B8R38B9H4BB197GA70"
Data "07GA70819H49B8R38B9H491807GA70","07GA7G2H489O9H5007GA70"
Data "078G887G4H2GBH2G478G8870","0778G6877GFGB778G68770","00NAGFGDNA00"
car3:
Data "GFGFGFG7","GFGFGFG7","GFG8H3GFGA","GFG7117711GFG9"
Data "GFG611J311GFG8","GFG6113M211R4GFG3"
Data "GFG2N28113M2116R2334G9N4G2","GF007FF011BM411BB33K2G77G4700"
Data "GF007G211BM411B33K4EG4700FFG270","G8K2G57G2U933K3U4L27G4B070"
Data "G7KBUBK4U6455G4B070","G64OAKF4U6K3G4B070"
Data "00N4KBOBK3U7K3G4B070","078G34O9KF4EO4G387G4B070"
Data "78G4KCEO9K38G888G4B070","70V20FK40H444EKC00V20FG58G570"
Data "7G644005B5B11K5H6K2GA9BG5700","7G955B5B11K5119L3B44G919B0N4G2"
Data "7G8L4B11K5119L3R2G919B07G6","7G8L4BFFK5119L3R2G919B07G6"
Data "7G8L4BFFK4V29L6G919B07G6","7G6F0L4B3V89L6G919B07G6"
Data "7G6F0055B5B38R2F8V29L3R2G7F019B07G6"
Data "7GAH2938911983F39L3R2G7F019B07G6","7G9H43891198J295H29BBG7F019B07G6"
Data "7G9H438R38J29H4B9GA9B07G6","78G78H438R288J29H4B9GD7G6"
Data "078G5879H20O2BB88J29H578GB87G6","00N8G7O690H2G278G987G7","GFGFG2NBG8"



TrackData:
' encoded track
' first value is amount of curve, negative = right, 100 is just off screen
' second value is duration of segment, negative = end of track, restart
Data    0,200   ' straight for a bit
Data   50,500   ' start turn to the left
Data   50, 50   ' hold turn to the left
Data    0,400   ' return to straight
Data    0, 30   ' straight for a bit
Data -100,1000  ' turn to right
Data -200,500   ' turn even sharper to right
Data -100,300   ' reduce right turn
Data  -10,500   ' reduce turn even more
Data  -10, 25   ' hold gentle right turn
Data    0, 30   ' straight for a bit

Data  200,250   ' turn hard left!
Data    0,200   ' return to straight
Data    0, 50   ' straight for a bit
Data  100,150   ' turn left - chicane
Data    0,100   ' return to straight
Data    0, 10   ' straight for a bit
Data -100,100   ' turn right
Data    0,100   ' return to straight
Data    0,100   ' straight for a bit
Data   40,650   ' bend to the left
Data   40, 50   ' hold bend to the left
Data   75,250   ' more bend to the left - double apex
Data    0,400   ' return to straight
Data    0,-200  ' end of track


Link to the background Image

the Framerate is between 24.5 and 25.5 fps but the Movement is still smooth.
The subjective impression of the speed depends more from the speed of the color change of the bars than from the frame rate
Edited 2022-10-28 22:02 by Martin H.
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3565
Posted: 12:19pm 28 Oct 2022
Copy link to clipboard 
Print this post

Hi Martin,

With the increasing detail it becomes more real than ever.
May I be so blunt to point at one thing that could be improved ?

The road is either straight, or some form of an arc. But with the progress on a straight, the curve should appear in the distance, and come closer, before the road changes to an curve (arc).

Maybe this is most obvious when the straight road changes abruptly to a strong curve.

I have no clue how to turn the algorytm to make a curve come closer from the distance, but you may be able to work around it by not making abrupt changes from straight to strong curve.

By the way, did you notice that you (and vegipete) are turning a proof of concept into an actual game ??? Please continue, I like this !!!

Regards,

Volhout

P.S. what happened to the frog ? Do you want me to debug the NES controller drift on the river ?  Or is it stalled, to be picked up later ?
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 01:27pm 28 Oct 2022
Copy link to clipboard 
Print this post

At the moment, the curve is precalculated via an exponential function to and bend the straight road more or less as required. I have no idea, right now, how to do it differently, so that the transition would takes place from top to bottom.
However, if one designs the track accordingly, it is not noticeable  
Hey it is the approach of a Racing game written in Basic on a 4€ Microcontroller.
Who would have thought that such a thing would be possible?
And whoever wants to turn this PoC into a real Game, feel free to do so.

Due to the 3D MonsterMaze idea of stanleyella, I am currently trying to convert a C++ routine into MM Basic to make a raycaster Version of this old Game  
3DSage_Raycaster_v1.c
...
also my  ILI9341 display arrived yesterday which unfortunately has different names than usual on the connections. So I have to guess how to connect it.
https://m.media-amazon.com/images/I/715-XBOQh5L._AC_SX569_.jpg
Edited 2022-10-28 23:48 by Martin H.
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5751
Posted: 02:13pm 28 Oct 2022
Copy link to clipboard 
Print this post

I think those have come up before, Martin. I don't think they are MMBasic compatible. It looks like a 8-bit parallel display designed for Arduino only to me.
Edited 2022-10-29 00:14 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1652
Posted: 02:22pm 28 Oct 2022
Copy link to clipboard 
Print this post

I like this road idea. It could be shapes following the curve and more outer space "car". More like Nintendo "FireFox".
You guys show what can be done. I got to sort the vga version and hope one of my ps2 keyboards is 3.3V compatible. Why not? costs little. cheap hobby.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 02:27pm 28 Oct 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  I think those have come up before, Martin. I don't think they are MMBasic compatible. It looks like a 8-bit parallel display designed for Arduino only to me.

ok,if there is actually no way to serially drive the display, Maybee I could Update one of my 3d Printers to color display.
They are Arduino controlled and, as far as I know, there are already Marlin extensions for ILI9341
Edited 2022-10-29 00:58 by Martin H.
'no comment
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 904
Posted: 10:28am 04 Nov 2022
Copy link to clipboard 
Print this post

Optimizes the hell out of the DrawTrack Algorhythm.  
Not really readable anymore (I wouldn't understand it anymore) but, including all features, it now runs with 31.792 FPS at 378000 KHz  

'modyfied by vegipete
'
Option explicit
Dim Col%(15),Xofs%(160),Bcol%(8,120) As integer
Dim f%,n%,sh%,sw%,t%,hh%,hw%,dist%,speed%,ppos%,turn%,dur% As integer
Dim bb%,bc%,b1x%,b2x%,b3x%,b4x%,ofs%,PDist%,y% As integer
Dim dst,spt,fcnt,i As float
Dim mv1%=1,mv2%=2
Restore colors:For f%=1 To 15:Read Col%(f%):Next f%
MODE 2:SH%=MM.VRes:SW%=MM.HRes:HW%=SW%/2:HH%=SH%/2
dist%=0:Speed%=20:PPos%=0
Option Break 4: On Key 3, on_break
FRAMEBUFFER create:FRAMEBUFFER WRITE F
read_sprites
'Precalc the Curve
For f%=0 To 159:Xofs%(159-f%)=-((160*Exp(f%/50))/20)-8:Next
'Precalc the Bordercolors
For dst=0 To 7:For f%=0 To 120
bcol%(dst,f%)=col%(7-3*((Sin((((120-f%)/40)^3)+dst*.75))>0)):Next :Next :dst=0:spt=1
CLS COL%(1): Load image "sky.bmp"

'-------endless loop -----------------------
' n is degree of bend
n%=0   ' current curvature - start off straight
t%=Timer:fcnt=0
Restore TrackData
Do
Read turn%,dur%
If dur% < 0 Then
 t%=(Timer-t%)/1000:Text 1,1,Str$(fcnt/t%,3,3) ' show framerate
 t%=Timer:fcnt=0
 Restore TrackData
 Continue Do ' restart the track
EndIf
If n% < turn% Then  ' adjust curvature towards left
 For i = n% To turn% Step Speed%/dur%*100
   DrawTrack i:do_car -Sgn(i):Mov_sky -Sgn(i):FRAMEBUFFER COPY F,N:Inc fcnt
 Next
 n%=turn%
ElseIf n% > turn% Then  ' more to right
 For i = n% To turn% Step -Speed%/dur%*100
   DrawTrack i:do_car -Sgn(i):Mov_sky -Sgn(i):FRAMEBUFFER COPY F,N:Inc fcnt
 Next
 n%=turn%
Else   ' continue along path
 For i = 1 To dur% 'Step -Speed%/dur%
   DrawTrack n%:do_car -Sgn(n%):Mov_sky -Sgn(n%):FRAMEBUFFER COPY F,N:Inc fcnt
 Next
EndIf
Loop

'------------------------------
'b1x% left x position of the left Border
'b2x% right x position of the left Border and left x position of the street
'b3x% right x position of the street and left x position of the right Border
'b4x% right x position of the right Border
'BB% Border wight
'bc% Border Color (red or white) calculated over Sinus Function
'HH% Half Screen y-Res  HW% Half Screen x-Res
'PDist% Shift relative to Car Position PPos%
'xofs%() Pre calculated Curve over Exponetial function
'ofsx% stregth of the bend
'------------------------------

Sub DrawTrack curv
 Box 0,hh%+2,sw%,hh%-2,,COL%(2),COL%(2)
 For F%=2 To HH%
   PDist%=PPos%*f%/HH%:BB%=f%>>2:bc%=bcol%(dst,f%)
   ofs%=xofs%(f%)*curv/100:y%=hh%+f%
   b1x%=PDist%+HW%-F%-bb%+ofs%:b2x%=b1x%+BB%:b3x%=b2X%+(f%<<1):b4x%=b3x%+BB%
   Line b1x%,y%,b4x%,y%,,bc%:Line b2x%,y%,b3x%,y%,,0
 Next
 Inc dst,spt:dst=dst And 7
End Sub

'--- Moves the Sky while driving a curve
' spt adjusts the border speed when there is nothing to Move
'  mv1% and mv2% are the differed Speeds for the "Paralax Effect"
'
Sub Mov_sky dir%
 If dir%=0 Then spt=1:Exit Sub 'driving straight so sky doesn't change
 spt=1.4
 If dir%>0 Then
   Sprite read 31,0,28,mv2%,22:Sprite Mv2%,28,0,28,320-mv2%,22
   Sprite write 31,320-mv2%,28:Sprite read 31,0,50,mv2%,22
   Sprite Mv1%,50,0,50,320-mv1%,22:Sprite write 31,320-mv1%,50
   Sprite read 30,0,102,mv2%,10:Sprite Mv2%,102,0,102,320-mv2%,10
   Sprite write 30,320-mv2%,102
 Else
   Sprite read 31,320-mv2%,28,mv2%,22:Sprite 0,28,mv2%,28,320-mv2%,22
   Sprite write 31,0,28:Sprite read 31,320-mv2%,50,mv2%,22
   Sprite 0,50,mv1%,50,320-mv1%,22:Sprite write 31,0-mv1%,50
   Sprite read 30,320-mv2%,102,mv2%,10:Sprite 0,102,mv2%,102,320-mv2%,10
   Sprite write 30,0,102
 EndIf
End Sub

Sub do_car dir%
Local Key$
If dir%=0 Then
 If dst Mod 2 Then
    Sprite write #1,132,200,4
 Else
    Sprite write #2,132,200,4
 EndIf
Else
Sprite write #3,132,200,4+(dir%<0)
EndIf
' move with "o" and "p"
key$=Inkey$
Select Case key$
  Case "o"
  Inc  PPos%,8:If PPos%>160 Then PPos%=160
  Case "p"
  Inc PPos%,-8:If PPos%<-160 Then PPos%=-160
 End Select
End Sub
'----
Sub read_Sprites
Local nr%,p%,n%,byt$,m$
'--- Read/Create Sprites
Restore car
 For p%=1 To 31
   Read Byt$:Byt$=expand$(Byt$)
   For n%=1 To Len(Byt$)/2
     m$=Mid$(Byt$,n%,1)
     Pixel n%-1,p%,COL%(Val("&H"+m$))
     Pixel 56-n%,p%,COL%(Val("&H"+m$))
     m$=Mid$(Byt$,Len(Byt$)-(n%-1),1)
     Pixel n%-1,32+p%,COL%(Val("&H"+m$))
     Pixel 56-n%,32+p%,COL%(Val("&H"+m$))
   Next
 Next
Sprite read #1,0,0,56,32:Sprite read #2,0,32,56,32
CLS :'  Sprite load "Car3.spr",3
Restore car3
 For p%=0 To 30
   Read Byt$:Byt$=expand$(Byt$)
   For n%=1 To Len(Byt$)
     m$=Mid$(Byt$,n%,1)
     Pixel n%-1,p%,COL%(Val("&H"+m$))
   Next
 Next
Sprite read #3,0,0,56,30
End Sub

Function expand$(pxl$)
Local n%,nmb%,tmp$,co$
For n%=1 To Len(pxl$)
 If Asc(Mid$(pxl$,n%,1))< 71 Then   ' asc("G") = 71
   tmp$=tmp$+Mid$(pxl$,n%,1)
 Else
   ' run length encoded - 1st char is pixel colour+71, 2nd is count-1
   co$=Hex$(Asc(Mid$(pxl$,n%,1))-71)
   Inc n%:nmb%=Val("&H"+Mid$(pxl$,n%,1)):tmp$=tmp$+String$(nmb%+1,co$)
 EndIf
Next
expand$=tmp$
End Function

Sub on_break
Sprite CLOSE all: FRAMEBUFFER CLOSE
MODE 1: Option Break 3
End
End Sub

colors:
'--Colorscheme accordung to matherp
Data RGB(BLUE),RGB(GREEN),RGB(CYAN),RGB(RED)
Data RGB(MAGENTA),RGB(YELLOW),RGB(WHITE)
Data RGB(MYRTLE),RGB(COBALT),RGB(MIDGREEN),RGB(CERULEAN)
Data RGB(RUST),RGB(FUCHSIA),RGB(BROWN),RGB(LILAC)

car:
Data "GFGFGFG7","GFGFGFG7","GFG9P3GFG9","GFG8917719GFG8","G8N3GA91J319GAN3G8"
Data "G7788087G5EECF11M311FCEEG5780887G7"
Data "G678FF00800FDCFC48F11M311F84CFCDFG77G6"
Data "G67G5DD4U2C4B107M3701B4CU24DDG2FF07G6","G67G4U6C4B107M3701B4CU6G47G6"
Data "G67G3U8AB1U71BAU8G37G6","G67G2U24CU4AAU9AAU4C4U2G27G6"
Data "G6700U3KFKBU3007G6","00N5U54OFO94U5N500","07788G6EEKFKBEEG688770"
Data "078G9E4OB44OB4EGA70","0700FF0V3001KAEK3EKA1GA70"
Data "07GA14HAK3HA4100V30FF0070","07GA14019R255911K311955R291041GA70"
Data "07GA5119R2L2911K3119L2R29115G9770","07GA551R3L2911K3119L2R3155G9770"
Data "07GAL99V79L9G9770","077G9L99V79L9GA70","077G9551R3L29B8R38B9L2R3155G9770"
Data "077G9519R3L29B891198B9L2R3915G9770"
Data "07GA919BB9H259B891198B95H29BB919GA70","07GA791BBH49B8R38B9H4BB197GA70"
Data "07GA70819H49B8R38B9H491807GA70","07GA7G2H489O9H5007GA70"
Data "078G887G4H2GBH2G478G8870","0778G6877GFGB778G68770","00NAGFGDNA00"
car3:
Data "GFGFGFG7","GFGFGFG7","GFG8H3GFGA","GFG7117711GFG9"
Data "GFG611J311GFG8","GFG6113M211R4GFG3"
Data "GFG2N28113M2116R2334G9N4G2","GF007FF011BM411BB33K2G77G4700"
Data "GF007G211BM411B33K4EG4700FFG270","G8K2G57G2U933K3U4L27G4B070"
Data "G7KBUBK4U6455G4B070","G64OAKF4U6K3G4B070"
Data "00N4KBOBK3U7K3G4B070","078G34O9KF4EO4G387G4B070"
Data "78G4KCEO9K38G888G4B070","70V20FK40H444EKC00V20FG58G570"
Data "7G644005B5B11K5H6K2GA9BG5700","7G955B5B11K5119L3B44G919B0N4G2"
Data "7G8L4B11K5119L3R2G919B07G6","7G8L4BFFK5119L3R2G919B07G6"
Data "7G8L4BFFK4V29L6G919B07G6","7G6F0L4B3V89L6G919B07G6"
Data "7G6F0055B5B38R2F8V29L3R2G7F019B07G6"
Data "7GAH2938911983F39L3R2G7F019B07G6","7G9H43891198J295H29BBG7F019B07G6"
Data "7G9H438R38J29H4B9GA9B07G6","78G78H438R288J29H4B9GD7G6"
Data "078G5879H20O2BB88J29H578GB87G6","00N8G7O690H2G278G987G7","GFGFG2NBG8"



TrackData:
' encoded track
' first value is amount of curve, negative = right, 100 is just off screen
' second value is duration of segment, negative = end of track, restart
Data    0,200   ' straight for a bit
Data   50,500   ' start turn to the left
Data   50, 50   ' hold turn to the left
Data    0,400   ' return to straight
Data    0, 30   ' straight for a bit
Data -100,1000  ' turn to right
Data -200,500   ' turn even sharper to right
Data -100,300   ' reduce right turn
Data  -10,500   ' reduce turn even more
Data  -10, 25   ' hold gentle right turn
Data    0, 30   ' straight for a bit

Data  200,250   ' turn hard left!
Data    0,200   ' return to straight
Data    0, 50   ' straight for a bit
Data  100,150   ' turn left - chicane
Data    0,100   ' return to straight
Data    0, 10   ' straight for a bit
Data -100,100   ' turn right
Data    0,100   ' return to straight
Data    0,100   ' straight for a bit
Data   40,650   ' bend to the left
Data   40, 50   ' hold bend to the left
Data   75,250   ' more bend to the left - double apex
Data    0,400   ' return to straight
Data    0,-200  ' end of track                                        

so, if we say, min. 20FPS is acceptable (with speeded up Borders), we have 1/3 Second (that is the speed of a non overclocked Pico) Headroom for A Game Logic.

Edited 2022-11-05 00:09 by Martin H.
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3565
Posted: 02:55pm 04 Nov 2022
Copy link to clipboard 
Print this post

Wauw !

This is really super smooth....
Good work. Running it on RC8 at 252MHz.

Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 3 of 4    
Print this page
© JAQ Software 2024