Log In  


Cart #racerprototype-3 | 2022-06-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

A WIP "into the screen racer" prototype.
I've use bezier curves described in this post for the road: https://www.lexaloffle.com/bbs/?pid=65926
Use the controls to move the road around and move the horizon up and down.
The bezier calculations seem to be quite expensive resulting in a reduced frame rate from the target. Possibly this is worsened by my attempt to fill in the road polygon by effectively drawing the line multiple times.
Any suggestions for improving this would be most welcome.
Hopefully the ideas here might help others.

I will look to make this into more of a game by allowing movement of the car, other cars and obstacles moving towards you and variable speed. But this is a start.



1

pset is very slow, you should draw lines. Someone already made a thread experimenting with textured bezier curves which you might want to take a look at.

If you want to use a more conventional approach to this sort of game there is an excellent tutorial series on codeincomplete called How to build a racing game. I know a few people here (including myself) have used it.


Thanks @PAK9 drawing lines instead of using pset sped things up enormously. I realised I've posted this to "Released" carts so I've posted to https://www.lexaloffle.com/bbs/?tid=48063 and I'll probably take this cart down from here.


Good except the lines run the same speed from the distant road to the near road so the 3D effect is incomplete, @BenAttenborough. Nice rotation of lines though.



[Please log in to post a comment]