Sign in to follow this  
solve

How to import tracks in server?

Recommended Posts

I want to develop a game server for a 3D car racing game. To decrease the load of the server, I'm not going to do any physics in server, just broadcast the player's state instead. I also want to do some simple check in server. For example, i want to check whether the car's coordinate is on the track. Here comes the problem: how does the program know the track's area? how can i import the racing track? Any ideas? Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
How do you know whether the car is on the track on the client?
Do the same thing on the server.


Thanks!

When the client sends its coordinate to the server, if the server knows the track's area, it can know whether the car is on the track. If the car isn't on the track on the client actually and the client sends a fake coordinate, it won't affect the game result, because the result is desided by the server. And other clients will see that the car is still on the track as long as the coordiante sent to the server is on the track.

Anyway, how can the server know the track's area?

Share this post


Link to post
Share on other sites
Here's one suggestion:

In your track editor, mark the triangles that are "track" (as opposed to scenery). When you export your track geometry, also export a file that contains only the "Track" triangles, projected to a 2D flat plane. Load these triangles into a quadtree.

When you need to test "is coordinate X on the track", simply run the coordinate through the quadtree, and test the triangles that you find in the terminal nodes; if the point is inside a triangle, it's "on the track."

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
Here's one suggestion:

In your track editor, mark the triangles that are "track" (as opposed to scenery). When you export your track geometry, also export a file that contains only the "Track" triangles, projected to a 2D flat plane. Load these triangles into a quadtree.

When you need to test "is coordinate X on the track", simply run the coordinate through the quadtree, and test the triangles that you find in the terminal nodes; if the point is inside a triangle, it's "on the track."


Thanks a lot!

I don't know about graphics very well. Can u explain more about how to load triangles from the file(is it a .mesh file?), or is there any article about that?

Share this post


Link to post
Share on other sites
I have read some basic articles about graphics and i know that triangles can be imported from a .x file. Is that right?

However, i still don't know how to load them into a quadtree. Can u explain more?

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this