Jump to content
  • Advertisement
Sign in to follow this  
elfpimpdidi

Simple racing game - level format

This topic is 4849 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

I'm working on a simple racing game thang - a summer project to keep me learning a few things, and for a bit of fun. I've built up a lot of the core rendering/control gubbins, but now I'm getting bored of my test geometry and I want to start loading stuff in. Which means deciding on level and model formats. The thing that I'm struggling with is the level format. I'm tempted to go with using octrees or somesuch, since collision detection against things at the opposite end of the world is a waste of time, but I haven't really touched them as yet. Also, I obviously can't be regenerating the Octree every frame, but a lot of stuff is going to be moving, so.... I mean, I suppose I could check which sectors a body's bounding box overlaps and detect collisions within those... hmm. So, that's the first decision: to take the plunge into Octrees (or BSP, for that matter) or not? But then, either way, I figured, I'd have to write an exporter for an editor / modelling app of some kind. Which led to the decision: which one? Which is when I considered using an existing level editor, like GtkRadiant or somesuch. Which is when I considered adapting an existing level format, such as the Quake format or one of its descendents. The way I see it, my needs are simple: I have static geometry, which comprises the level, and then instances of models, which can be defined in separate model files. The models can move, obviously, and the models need to detect collisions between themselves and static geometry, or between each other. I also need some sort of triggering system (which could act similarly to a model instance but with no mesh; just collision detection and a trigger flag, or callback, or somesuch). I can see lots of ways to do it, but can't decide which is the best road to start going down. Does anybody have any advice as to where to start on this? Any thoughts would be much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
I cannot really comment on the exporter side of things - I use 3D studio max, a legal copy, for building things and a custom exporter.

When you are thinking about how to build up your level, you mentioned that there are static objects and dynamic objects. What percentage of each are you going to have? Is most of the level static with the other dynamic objects being other players? If so, I would recomment taking your loaded level, splitting it up into sectors, and only doing collision detection on the local sector, or two if you are across the boundaries. It might be easy enoughm, if your sectors are small, to do simple ray against triangle tests. You could also build a system of storing information about which sectors are visible from which other sectors to make sure you are only drawing what you can see. As for the dynamic objects, I would do collision detection with them in a different fashion. I would store your dynamic objects in the sectors, also, so you are only colliding with the objects near you, but then just do bounding tests.

I can imagine that your racing engine would need to be able to get exported data from some 3D tool that has information that lets a second tool you write cut the gameworld into the sectors. You will most likely want to split the meshes across the sectors as well, but it might not be necessary unless you have really long triangle strips. The nice thing about the sectors, and the visibility information is that you can stream in sectors as you need them. This might not be necessary for your game, but it is an interesting problem to solve.

Back to your original question, I am not sure whether octrees or BSP trees would be worth it here - I think a more specific data structure for racing might make sense. That is my opinion assuming only that you are making a racing game like nascar or need for speed, say.

None the less, best of luck with your project.

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!