Racing Game

Since everything piece of code I’ve touched seems to have exploded recently I was considering writing a racing game.

I’d like it to be multiplayer but started thinking about networking for racing games and it seems pretty difficult. It seems like the collision has to be close to perfect and the speed of movement has to really high. Across a network this would seem pretty difficult to achieve.

However, I note a lot of the console games that have just gone online (racing games) have quite happily become network enabled.

Anyone know of any resources or have any experience in this area?

Kev

Just a thought…

For car racing, lots of movement computation has to done even for the remote cars in any case. This is due to the fact that car motion is heavily contrained (e.g. by the road :slight_smile: ). So ‘normal’ extrapolation of 3D motion data doesn’t take you anywhere at all. You have to make sure that the car stays on the ground.

The same way you always have to do local collision detection and response. Let your cars collide locally and even perform the bounce locally and then let a smoothing of motion care for the consistency with the information from the network.

If damage data has to be handled, I’d prefer to calc that only for your own car. A collision might not even take place on each machine involved than, but if you encounter a collision on your machine, you also get the damage.

Thats pretty much how JPilot works (concerning collision with bullets).

I have another sample that could help to keep cars on track, which I thought was a nice idea but I’m not sure wether it holds for a true game: as most track consist of flat triangles or quads anyway, just work with 2D coordinates [0…1;0…1] that just describe the position on a certain triangle. So position [9.2,0.5] places your car at the beginning of the 9th quad just in the middle of the road.
You will have to use non-orthogonal coordinate systems for that. I have a small sample showing that:

http://www.hardcode.de/applets/hqDriver.html

The ‘cars’ positions are just computed as [t,sin(t)] and see how it moves…

So what actually gets sent across the network… just positions? just controls?

Kev

Whatever you need to describe motion.

The corresponding HeadQuarter subsystem ‘locations’ sends positions and optionally speed, ang. velocity, force and torque. Together with a timestamp this works together for dead-reckoning.

Forces often are very close to ‘controls’.

But this is not the point. Whatever you send, you cannot do a ‘free’ extrapolation of motion due to the contraints caused by the track and collisions.

I think that the extrapolation of motion has to take these contraints into account and to perform e.g. collision response whereever it is encountered. This way it makes you not depend so much on good latencies to achieve a believable(!) gameplay.

We did NASCAR Online at TEN.

Driving games oer the internet are fundementally extremely difficult. They are ALMOSt as bad as contact sports games and fighters, the only savign garce being that motio nis slightly more predictable.

You are talking about bumper to bumper accuracy requriements at speeds of 100mph plus. About the only way to do it is with local logic as has already been mentioend.

The problm is that local logic is highly hackable.

As long as you dont think people will have a reason to cheat or you don’t care about peopel cehating your okay. IF that isnt true however you have a real job on your hands. Abotu the only way to detect cheating is by statistical analysis of the driving patterns of the players. Ofcourse once the players figure out what you are lookign for in your analysis they can modify their cheats (typially in this case driving robots) to compensate. In the end, its a pretty expensive cold-war.

:smiley:

I always think that first you have to come so far to develop a game that has SO much exposure and public recognition that cheaters show up at all!

So I’d go for the best technical solution first to create a good game and care for cheaters second order only…

Most gaming efforts grow that far…

Right, I’ll have a go then… see what happens.

Kev

So how exactly did JPilot work?

Every now and again you recieve an update from the server that specifies say

a) Timestamp
b) Position
c) Forces

You assign these to the player thats being update and extrapolate (including collisions) until you recieve a new update?

When you recieve the new update do you just reset the players position or do try to tend towards it or something?

Kev

Simply resetting the position can be done but it results in what players call “warping”.

Look at it as a point sampling problem, much like dithering. You have an error term that you want to average back in over subsequent frames. You can do this by interpolating between the “current” and “right” values. Some games wil cheat and give you some extra speed to get back into the right position. If you do though you want to ease that in and out to avodi it beign obvious, effectively a second order derivative interpolation.

Well, I’ve played about with what Jeff has just mentioned and trivially it seems to work ok, however having just touched the tip of the iceberg where racing games are concerned (AI next) I have a feeling that its not going to be a good hobby project :frowning: Too much focused time required.

Kev

[quote]So how exactly did JPilot work?
[/quote]
??? I’ve written a long answer yesterday!!!

Where is it gone?

[quote]We did NASCAR Online at TEN.

Driving games oer the internet are fundementally extremely difficult. They are ALMOSt as bad as contact sports games and fighters, the only savign garce being that motio nis slightly more predictable.
[/quote]
Nice! Nascar online is currently one of the projects within the group that I work with. Very interesting problems that had to be solved. Some of our other interesting problems involve massive UDP based multicast (which not actually being multicast). Very interesting solutions there as well. Again kudos - I’ve seen the Nascar thing and appreciate the technical issues that would be entailed having had to solve very similar problems :slight_smile:

Thanks but I need to give credit where credit was due. That wasn’t one of my projects, Bill Lipa (our senior game networking guru) worked on it directly along with the guys from Papyrus who really did most of the heavy lifting :slight_smile: