Discord
Login
Community
DARK THEME

Please comment "Racing Demo" by Gilles

Dear Gilles,

Could you please comment the code of your "Racing Demo"? I don't get the maths behind it or how the tracks are actually built. Are they stretched images or how did you do it?

It would be great if someone could make a network racer out of it and I would like to try to do that.

But I don't get the numbers at all.

microStudio is awesome, great work. :)

A lot of maths involved in that one and plenty of information available online how it's done 🙂

I don't think Gilles will have the time to comment the whole game, so here are some example link (ask Google, there are plenty more).

https://jakesgordon.com/writing/javascript-racer/

https://m.youtube.com/watch?v=JPbz-575BS4

https://www.lexaloffle.com/bbs/?tid=35767

They slightly differ how they render the final road, but the principle is the same. A good exercise in trigonometry 😉

https://www.youtube.com/watch?v=KkMZI5Jbf18

look at this project >> https://microstudio.dev/i/Skaruts/sk_pseudo3d_racing/

@Benobi I must confess that my Racing demo is completely cheated. I think the math was wrong from the beginning and I just kept tweaking it until I got something reasonably ok.

I think Skaruts' demo is much more accurate ; it takes elevation into account ; also I just replayed it and was amazed to see a lot of added features!

However, for some untold reason ><, I need to create a decent racing mini-game inspired by Outrun. So it was time for me to dive into it again and I just made a new example, which I think is much more correct than my previous one. It has elevation too. I tried to add useful comments, but I am not sure if they will be easy to understand. It's hard to figure these things out without a drawing board!

So that's the example: https://microstudio.dev/tutorials/examples/gilles/roadworks/

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community