• Advertisement
Sign in to follow this  

Racing Game-Please Help Me :)

This topic is 3982 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 building a racing game in c++, using OpenGL. I've already loaded a 3ds model of a car. My question is how can i create a map to my game? it doesn't have to be pretty it can even be an highway/road with no background. Please give me the easiest way to it, if anyone can give me an open source code of what i'm looking for i'll be grateful.

Share this post


Link to post
Share on other sites
Advertisement
There is a book called "Start Your Engines" by Jim Parker (ISBN:9781933097015) which covers practically everything about making racing games.

You might want to check it out at your local bookstore for ideas.


On the other hand, if you just want something your car can drive on, just render polygons for the ground and use collision detection. If the car is on a polygon, you can move it. If not, it falls off the screen.

The easiest way to create a racing track would be to model something in a 3D app and save it in obj format, then load it in your game.

Share this post


Link to post
Share on other sites
thanks man. Can anyone give me an open code example of creating and rendering a map?
I've searched a lot but haven't fount yet.

Share this post


Link to post
Share on other sites
Get a 3DS model of Daytona Race-Track here

-- link removed --

Enjoy ;-)

Limited time offer, I'm removing the link later [wink]

[Edited by - darren_mfuk on March 26, 2007 8:06:54 AM]

Share this post


Link to post
Share on other sites
Thanks for the model. :) :) :)
I took Nehe's routine for creating an OpenGL window and combined it
with a 3ds loader.
The program displayed the model but not properly.
I'm working with Visual studio 2003 .NET, I've Uploaded the program:

http://www.badongo.com/file/2573951

Please Take a look I'm sure it's something simple

Share this post


Link to post
Share on other sites
Quote:
Original post by Kuroahiru
There is a book called "Start Your Engines" by Jim Parker (ISBN:9781933097015) which covers practically everything about making racing games.


Except that it doesn't. It has one chapter (on physics) which is remotely useful for racing games, the rest of the book is, IMO, an appallingly put together waste of paper. It takes about six chapters before it even starts talking about time (when I'd have thought that time would be the second most important thing in racing games) and the first few games it puts together have no relation to cars (cars being, you'd have thought, the number one most important thing in racing games).

My advice is to avoid that godawful excuse for a book like the plague. It's just plain rubbish.

Share this post


Link to post
Share on other sites
Sorry double post.

[Edited by - SunTzu on March 26, 2007 1:09:17 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by KaKaroTo
Thanks for the model. :) :) :)
I took Nehe's routine for creating an OpenGL window and combined it
with a 3ds loader.
The program displayed the model but not properly.
I'm working with Visual studio 2003 .NET, I've Uploaded the program:

http://www.badongo.com/file/2573951

Please Take a look I'm sure it's something simple


I downloaded your program and there doesn't seem to be a problem with the display - there's just a problem with how you set the scene ;)
I had to set the far clipping plane to a value of around 30000 to see the whole model. As such, you might consider to both increase the far clipping plane distance a bit and to scale the model down a bit because a far plane distance of 30000 shouldn't be necessary for that racing track, I think...

If you add these two lines to your drawing function:
glScalef(0.01f, 0.01f, 0.01f );
glTranslatef( 0.0f, -1000.0f, 50.0f );
and change the gluPerspective call in your scene resize function to:
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,1.0f,1000.0f);

then things are already starting to look a lot better ;)


Share this post


Link to post
Share on other sites
I tried running your code...


error C2065: 'i': undeclared identifier


On line 1134 of model_3ds.cpp.

I've looked up through your code and there's 'i' getting used here there and everywhere, so I don't want to go changing things. Am I missing something to get this to compile?

Other than that, I'm just getting warnings about deprecated functions, but I'm not terribly bothered about those TBH.

Share this post


Link to post
Share on other sites
Rogierpennink you've helped me a lot. Thanks man.
I've added a camera and another 3ds model of a car.

How can i make the car drive on the track?
I've been told i got to do collision check...

Share this post


Link to post
Share on other sites
Quote:
Original post by ukdeveloper
I tried running your code...


error C2065: 'i': undeclared identifier


On line 1134 of model_3ds.cpp.

I've looked up through your code and there's 'i' getting used here there and everywhere, so I don't want to go changing things. Am I missing something to get this to compile?

Without actually checking the source, I'd wager that has to do with the "Force Conformance in for Loop Scope" option present in VS.NET. If the OP doesn't have it checked, then declaring an int (i) in one for loop will allow it to carry over to others without having to redeclare it. Naturally, that's pretty bad practice, and should be fixed. To whom it may concern (the author of "model_3ds.cpp" isn't clear): simply adding an "int" at the beginning of each loop should do the trick.

Share this post


Link to post
Share on other sites
I've loaded a 3ds model of a car and a race track.
I don't know how to make the car drive on the model?

here is my project:
http://www.badongo.com/file/2615588

The right edge of the race track is higher than the left edge so when i turn the car to the right side the car is swallowed by the map.

Share this post


Link to post
Share on other sites
If im not mistaken NeHe has a pritty good tutroaisl on collision detection
i havent programed in openGL for awhile now since i do directX however for the
most part id imagin it would be to hard have it check to see if the the car has collided with the road for the most part and i may not be correct on this part however if the road itself is a single model itself check to see if the car collideds with that and if it does then check for user input whatever the gas button would be aka is pressed. then move the car

for the most part if i were to do it id have differnt models for walls and the road and trees so on and so forth

if it hits a wall when the user trys to go say left apply the oposit direction to the car after the collsion that should stop it from being swallowed by the map.

for the most part if you a begginer and i know this from experince of trying to make games for a while now you want to make something 3d but mabye starting good and 2d might be a good idea!

as its abit easyer to handle all of the things you have to keep track of

i hope something i have sead helps :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement