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/

The demo is much better but you cant move and honestly I liked the style of the old one

Its like this one. https://microstudio.dev/i/Skaruts/sk_pseudo3d_racing/

My project is a melting pot of ideas and experiments, so take it with a grain of salt. :) I was also pushing the limits of performance, and I planned to tone it down later on.

I recently added a way to add/remove lanes, but it has some major issues. Unfortunately I've never figured out how to progress and add road forks, and adjacent roads, and all that good stuff.

If you'd like to delve into these games, I'd recommend reading through Lou's Pseudo 3d Page: http://www.extentofthejam.com/pseudo/

I followed this tutorial to make my game/prototype (which has already been posted above): https://codeincomplete.com/articles/javascript-racer/

The tutorial isn't that great, imo, in that it doesn't really teach much, it just shows you what code to write, and I find it a bit hard to tweak.

Post a reply

Progress

Status

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