Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Racing Game

Years of Service
User Offline
Joined: 7th Aug 2013
Posted: 26th Aug 2013 04:56
Hi! Can you show me how to make a racing game? Such as Ai? Checkpoint? Etc.
Years of Service
User Offline
Joined: 29th Aug 2013
Posted: 29th Aug 2013 03:22
Due to the extremely vague question, this whole reply will outline the mechanics you need to consider, rather than give you a buncha code and let you have at it. So here we go!

In a racing game, each "track" or "level" should be considered to be it's own state. If you are unfamiliar with the concept of game states, you may find to be a good read. The states would share the same "base" mechanics (X amount of cars, physics, rendering, updating, loading, et cetera), and could thus be derived from a common base (Again, if you are unfamiliar with polymorphism, look it up). It would probably be a good idea to make the elements within the state derived classes as well. Cars, trucks or whatever would be derived from the "vehicle" class, Poles, mailboxes and fences would be from the "rigidbody" class, and anything that does not move would be from the "staticbody" class.

Once you have your base structure set up, you'll obviously need to get the cars running. There are several ways to do this: You could have a string of "nodes" or "checkpoints" that the vehicles try to drive through sequentially. You could have the vehicles "split" the entire track into smaller segments between checkpoints, and use a pathfinding algorithm to calculate the best route. Whichever route you choose, there will have to be some form of checkpoint or node. Keep in mind that if you intend to use some form of "powerup" items, that the change in behavior may allow the AI to take a different route than what it normally could handle. Also, if the AI targets the nodes PERFECTLY, you will never get any variation in gameplay. To circumvent this, you could randomize the nodes position around a part of the track a little bit, you could make the AI target a planar checkpoint instead of a point, or some other form of mild randomization.

Hope this helps!

Indie Programmer - DirectX 11

Login to post a reply

Server time is: 2023-09-25 04:33:08
Your offset time is: 2023-09-25 04:33:08