Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Lestat3D

Racing Game problem! Please Help me!

This topic is 5932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm working on a WipeOut-like game, and I've a problem... I don't know how to make the car follow the track! The question is: Is there in the world any tutorial about this? Links would be apreciated. thanks, and please help me. This is the last grand step to finish my first game. [edited by - lestat3d on September 12, 2002 1:03:51 PM]

Share this post


Link to post
Share on other sites
Advertisement
Do you mean for the player or the CPU cars/ships?

For the player, add collision detection to the walls of the track and he''ll automatically be contained. You might also want to add triggers across the track - one for the start/finish line and a couple of others to prevent the player from cheating (to stop him constantly driving over the start/finish line notching up laps without doing a full circuit).

For the CPU, look into way-point path following techniques.

- Matt

Share this post


Link to post
Share on other sites
I have made Pong and Tetris and was just thinking about starting a racing game, so I am glad that this question came up. How would you go about placing "triggers" on the track?

Share this post


Link to post
Share on other sites
It can be an invisible sphere that you collide with a large enough radius to cover the width of the track.

You could count the lap when all the markers have been collided by the player. Spheres are easy and efficient to work with. Each lap the markers are resetted. One of the marker would be identified as the end track marker. When the end is collided you check all other markers to see if they have been passed through. If so, then the user made a complete lap, otherwise he went reverse at some point (cheating?).

You might want to take the direction of the player into account, as described it it would not matter if the player made a complete lap in reverse or forward direction. The markers can be linked with each other so the this one must be passed before this one, etc. If he passes through a marker that is not expected, then he is not flagged as passed through so the lap will not count if he goes to the end of the map. You might want to support shortcuts on your map so then you'll have to build a list of all valid paths, etc.

I never really tried to add marker on a track myself. I'm about to implement this in my game editor. But this is how I will implement that.

Patrick Lafleur
http://www.creationobjet.com

[edited by - nosfy on September 12, 2002 3:17:47 PM]

Share this post


Link to post
Share on other sites
Just as mentioned before collision is the key. Just make sure the player can collide with the walls and you are set. Although, I must disagree with waypoints in modern AI situations.

I feel it is better to incorporate collision for the CPU players as well, and then build an AI library that will make them manage the track themselves (turning, accelerating, braking, etc...) this will not only make the race much more realistic, but would also make difficulty control be much easier.

-----------------------------
Valkyrias: Tears of Valkyries
Guest Anonymous Poster
What if you wanted no deviation from the track at all? lots of spheres close together? Could you make basic ai roughly by getting car to just aim at the next waypoint (then more complex by planning maybe next few ahead) without this being a rigid driving line?

Share this post


Link to post
Share on other sites
You could use a pathing algorithm based upon where the next target is. It would have to be one that takes into account the shape of the track, etc. This would allow for more complex behavior later, such as targeting other cars, power ups, etc. The decision regarding what to target could then be tied to the car''s personality. Aggressive cars could try to crash other cars. Defensive cars could target the point in the next target furthest from another car.

Share this post


Link to post
Share on other sites

http://www.red3d.com/cwr/steer/

like wow. And btw, always remember the java is a Virtual Machine... in english.. you can convert back to original SOURCE CODE. Please give credit where it is due because this is a wonderful source that I find just plain dazzeling.
Hope this helps.
-Andy

Share this post


Link to post
Share on other sites
How, does WipeOut do it?
I''ve thot in a list of boundary boxes envolving the road.
When a car collides with any of these boxes the levitation forces (vectors) must interact to nivelate the car.

Share this post


Link to post
Share on other sites
Hey that''s an incredible link you gave there.

Thanks!!
Patrick Lafleur
http://www.creationobjet.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!