Page 2 of 2

Re: Port Crazee Rider?

Posted: Sat Dec 01, 2018 7:45 pm
by Dbug
Actually:


Still not perfect, the code is ugly, there are bugs, still a lot of C, etc... but at least now we don't need turbo boost on the emulator :D

Re: Port Crazee Rider?

Posted: Sat Dec 01, 2018 8:03 pm
by ibisum
That does look pretty good .. I wonder what the performance would be like with a bit more gameplay mechanics .. and I still don't understand how the lines are able to be so colourful .. but I guess I should read the code. ;). Definitely inspiring!

Re: Port Crazee Rider?

Posted: Sat Dec 01, 2018 8:12 pm
by Dbug
Well, if you look at the picture:
- I draw only half of the lines, the other ones are totally black
- The green on the side is green paper attribute
- the yellow and red is just some ink attribute change
- the road itself is just normal ink

In the current code, the entire animation takes 19303 cycles, so pretty much one full frame, but it's just a first assembler conversion pass.

Now, how would it look with more elements, hard to say, I'd say that in general on the Oric you achieve better things when you try to select things that match what you can do, instead of just porting other games.

Typically it does not have to be a game with bikes or cars, it could be some futuristic hovercrafts pods, you could display mountains or other things in the background as well, or zooming trees or billboard, etc...

I never had a clear idea when I wrote the original prototype, all I was wondering is about how roads could be drawn :D

Re: Port Crazee Rider?

Posted: Sat Dec 01, 2018 9:18 pm
by Xeron
Looks really nice 👍. I wish you had put the vid through ffmpeg before uploading, though.

Re: Port Crazee Rider?

Posted: Sun Dec 02, 2018 10:48 am
by Dbug
Xeron wrote: Sat Dec 01, 2018 9:18 pm Looks really nice 👍. I wish you had put the vid through ffmpeg before uploading, though.
Well, it's just for quick demos, does not matter if it looks bad, it's just a prototype.

For people interested in the topic, there are some interesting articles about old racing games and how roads were made:
http://www.extentofthejam.com/pseudo/

And how the Pico-8 Racer demo was made:
http://kometbomb.net/2016/04/03/how-doe ... racer-work

Re: Port Crazee Rider?

Posted: Sun Dec 02, 2018 11:16 am
by Symoon
Xeron wrote: Sat Dec 01, 2018 9:18 pm Looks really nice 👍. I wish you had put the vid through ffmpeg before uploading, though.
Hi Xeron.
The video looks quite good here! Just for my curiosity, what kind of improvement could one expect from ffmpeg?

Re: Port Crazee Rider?

Posted: Sun Dec 02, 2018 12:11 pm
by Xeron
If you upload oricutron videos direct to YouTube, they often turn into an overcompressed mess, although it seems to depend slightly on the device you use to play it back. There is a thread on here describing how to pass the video through ffmpeg first for better results.

Re: Port Crazee Rider?

Posted: Wed Dec 05, 2018 8:06 pm
by peacer
Regarding to curving, I made a simple program to calculate and draw "road pavements" by using bezier curve formulation between two points..

Its written in basic, but maybe it gives an idea how to draw a road..

What does this program do? It calculates the points between starting and ending coordinates of the road with a bezier point in between to give curling effect.

On the screen, you'll see the start, end and bezier coordinates as black spot.

The program moves the bezier point itself, randomly. Also you can change the starting and bezier coordinates by keyboard with these keys :

Q and W : X coordinate of the starting point
A and S : X coordinate of the bezier point
Z and X : Y coordinate of the bezier point

The calculation formula is like this

X=INT((1-T)*(1-T)*SX+2*(1-T)*T*BX+T*T*EX)
Y=INT((1-T)*(1-T)*SY+2*(1-T)*T*BY+T*T*EY)

While T changes from 0 to 1, the X,Y coordinates changes from starting (SX,SY) to ending (EX,EY) by curling thru bezier (BX,BY) coordinates.


The video is cheated with overclocing the Oricutron unfortunately. Normal program runs so slowly as its in basic. The formulation is too hard for me to create it in machine code but its a start :)


Code: Select all

10 CLS
20 SX=20:X1=SX:X4=SX
30 SY=1:Y1=SY:Y4=SY
40 EX=5:X2=EX:X5=EX
50 EY=24:X2=EY:Y5=EY
60 BX=13:X3=BX:X6=BX
70 BY=10:Y3=BY:Y6=BY
75 R=.01
80 Z=126:GOSUB 200
90 K$=KEY$
95 Q=0
100 IF K$="Q" THEN SX=SX-1:Q=1
110 IF K$="W" THEN SX=SX+1:Q=1
120 IF K$="A" THEN BX=BX-1:Q=1
130 IF K$="S" THEN BX=BX+1:Q=1
140 IF K$="Z" THEN BY=BY-1:Q=1
150 IF K$="X" THEN BY=BY+1:Q=1
153 IF RND(1)<RTHEN BX=BX-1:Q=1:GOTO 160 
154 IF RND(1)<RTHEN BX=BX+1:Q=1:GOTO 160   
155 IF RND(1)<RTHEN BY=BY-1:Q=1:GOTO 160  
156 IF RND(1)<RTHEN BY=BY+1:Q=1  
160 IF SX<2 OR SX>39 THEN SX=X1
162 IF BX<2 OR BY>39 THEN BX=X3  
164 IF BY<1 OR BY>24 THEN BY=Y3
170 IF Q=0 THEN GOTO 90  
175 X4=X1:Y4=Y1:X5=X2:Y5=Y2:X6=X3:Y6=Y3:Z=32:GOSUB 200 
180 X4=SX:Y4=SY:X5=EX:Y5=EY:X6=BX:Y6=BY:Z=126:GOSUB 200 
185 X1=SX:Y1=SY:X2=EX:Y2=EY:X3=BX:Y3=BY  
190 GOTO 90
200 FOR T=0 TO 1 STEP .05
210 X=INT((1-T)*(1-T)*X4+2*(1-T)*T*X6+T*T*X5)
220 Y=INT((1-T)*(1-T)*Y4+2*(1-T)*T*Y6+T*T*Y5) 
230 PLOT X,Y,Z
240 NEXT
241 IF Z=126 THEN Z=127
245 PLOT X4,Y4,Z
246 PLOT X5,Y5,Z 
247 PLOT X6,Y6,Z
250 RETURN
CURVE2.tap
(949 Bytes) Downloaded 289 times

Re: Port Crazee Rider?

Posted: Fri Dec 07, 2018 7:58 am
by NekoNoNiaow
It is an interesting take but Bezier curves are quite expensive and there are ways to make this simpler.

The sites linked by DBug and other kittens (notably "the extent of the JAM" one: http://www.extentofthejam.com/pseudo/) pretty much detail everything there is to know to draw a raster road properly perspective projected.

The computations have to be simplified since the Oric's CPU does not have neither multiplications nor divisions but the gist of it is correct and perfectly doable on 8 bit machines.