Game engines: online vs offline

nasanu

Newcomer
Regarding GT5 there is quite a lot of discussion about the driving physics online versus the offline model. Users are convinced there is quite a difference between them with the online model simpler.

At the moment there is another discussion going on about physics being different for the host of a game making them slower in lap time.

I am a programer but I know very little about games programing. As I see it, the game should take in movement data from other consoles, process the movements of other cars, run the frame to get user input, then send its own movement data across the network. Apart from collisions with other players I can not see why network data would effect the physics model. Also how expensive is handling multiplayer data CPU wise? Would a developer ever have to cut back on their physics calculations to accommodate online?

Can anyone here give me a deeper understanding of multiplayer game like GT5 runs under the hood? Does it seem possible that saturating a users internet connection could interfere with the internal physics calculations (seems nuts to me)?

Thanks.
 
Depends what your trying to do.
In peer 2 peer online games data about other players is always stale.
One of the issues with online and complex physics models is you want the other player cars to appear to move like cars (run the physics model), and correct inaccuracies when you get new data.
Physics models don't like discontinuities, so if you are running the model locally for the other cars you have to pass a LOT of data about the state of the model.
For this reason it's possible they run a simpler model.

What I've done is just use 1st or 2nd order prediction for the other cars rather than running the model, but it requires a good connection to look reasonable, and you still have the state issues when cars collide.
 
That's a problem of net lag, isn't it? I mean, position and orientation data to place players every frame is a few bytes tops, easily accomodated at broadband speeds, but when that data arrives fluctuates wildly. Hence the need to guess where players are between absolute positioning data.

I don't see why that'd need the local player's physics engine to be dumbed down. You'd just run a basic engine or somesuch on the other players and synchronise to absolute data every whenever. I don't see any reason to run the player's racing simulation in a simpler model as that won't affect when other player data arrives. Unless running two different simulation models is more costly than running the one and the overhead is prohibitive.
 
That's a problem of net lag, isn't it? I mean, position and orientation data to place players every frame is a few bytes tops, easily accomodated at broadband speeds, but when that data arrives fluctuates wildly. Hence the need to guess where players are between absolute positioning data.

I don't see why that'd need the local player's physics engine to be dumbed down. You'd just run a basic engine or somesuch on the other players and synchronise to absolute data every whenever. I don't see any reason to run the player's racing simulation in a simpler model as that won't affect when other player data arrives. Unless running two different simulation models is more costly than running the one and the overhead is prohibitive.

Local AI cars have to be processed offline, shouldn't this be the same online? Overhead wise online has the single advantage of not having to do driver AI also now that I think of it.

Actually come to think of it, you do see strange things online with extreme lag, like cars traveling forwards sideways. This suggests "You'd just run a basic engine or somesuch on the other players and synchronise to absolute data every whenever" right?
 
That's a problem of net lag, isn't it? I mean, position and orientation data to place players every frame is a few bytes tops, easily accomodated at broadband speeds, but when that data arrives fluctuates wildly. Hence the need to guess where players are between absolute positioning data.

I don't see why that'd need the local player's physics engine to be dumbed down. You'd just run a basic engine or somesuch on the other players and synchronise to absolute data every whenever. I don't see any reason to run the player's racing simulation in a simpler model as that won't affect when other player data arrives. Unless running two different simulation models is more costly than running the one and the overhead is prohibitive.

Right but your always projecting other player cars into the future, the question is how you project. As I said I've used simple position/orientation packets, and projected forwards.

I have no idea what GT5 does, however the trend has been to use the physics engine to approximate future positions, the problem with this is when it needs to be corrected, you can't just change the position and orientation. You need to be able to build an entirely new consistent physics state which can require a lot of data, especially if you weren't planning for network play.

It's not going to be a CPU time issue, unless the AI cars were not running the full physics model to begin with, and there is something hokey going on.
 
Hmm.. It all seems to work exactly as I thought. I am in the middle of trying to figure out a bug that is effecting online play in GT5. I was hoping to discover something that I didn't already know about the subject that might shed some light on the bug.

The problem is that some drivers are inexplicably slower than usual in online races (very serious stuff to some :) ). I'd usually put this down to imagination however it has been discovered that replays of the same race saved by different drivers have quite different timing. Those who were fast report that 1 second of replay time equates to exactly 1 second of real time. But those effected by the bug have replays sped up by 40% (I've seen it myself).

When effected by the bug they report that they physics change, they lose grip and can not lap as fast as those unaffected. Que the questions I've been asking ;) I guess it might not be possible to figure it out without knowing what exactly PD does. Judging by their first few attempts to bring GT online they don't really seem to know what they are doing in this area.
 
You need to be able to build an entirely new consistent physics state which can require a lot of data, especially if you weren't planning for network play.
In GT's case, do you think it possible that the game does run on a simpler engine requiriing less data to reconstruct?

When effected by the bug they report that they physics change, they lose grip and can not lap as fast as those unaffected. Que the questions I've been asking ;) I guess it might not be possible to figure it out without knowing what exactly PD does. Judging by their first few attempts to bring GT online they don't really seem to know what they are doing in this area.
See if you can arrange two people to record their gameplay laps and replays. Post them up for the internet to investigate and I'm sure you'll get some good discussion and maybe even broader coverage (like from digital Foundry) to help bring this to PD's attention and get them to fix it. Similar with U2's online shooting issues, ND flatly denied their existence in the face of lots of forum complaining until video evidence appeared (which showed a design choice leading to funky bullets).
 
Digital Foundry has an article on the subject. It appears that while obviously other cars will appear to behave differently, what is counted at the end is each drivers online performance. So you actually get no real competitive disadvantage.

From what I've played so far, while other cars appear to drive strangely sometimes due to lag and prediction stuff, the actual driving is identical both online and offline. I drive pretty much on the edge and would have noticed.
 
What's being described could also just be as simple as variations in the physics integrator step. Again depends on GT's implementation, if they use a complex integrator and change the time step for long/short frames, you get inconsistent results, which might be more obvious online, depending again on how it's implemented.
The alternative would be fixing the integrator time step, but you still see inconsistencies because of variations in input lag.
 
Digital Foundry has an article on the subject. It appears that while obviously other cars will appear to behave differently, what is counted at the end is each drivers online performance. So you actually get no real competitive disadvantage.

From what I've played so far, while other cars appear to drive strangely sometimes due to lag and prediction stuff, the actual driving is identical both online and offline. I drive pretty much on the edge and would have noticed.

Of course there is no competitive disadvantage when physics are different online vs. offline, but as result game feel is inconsistent. Some said diference is due weight of the fuel in online, but since we can turn on fuel depletion in offline practice, it's clearly not the case.
I do not talk about lag related stuff or how other cars appear on the track, just handling of your own car is different online vs. offline.

I can imagine that simulation of car suspension and how it reacts to road is rather complex task, is there any other game genre that requires similar complex physics in online mode?
 
I'm not convinced there is a difference. Will need more proof. Trying my best to come up with a possible cause, it would have to be something where the physics calculation is related to the framerate, but as far as I know this is not the case. At best I could see that having a really bad connection to the host causing a lot of jitter with the other cars could then slow you down in general. Another option could be that SPUs are so busy that when they need to do more work to correctly predict 15 other cars with lag calculations, but I don't quite yet see how that should be more work than having 15 AI cars instead.

But perhaps things correlate to certain types of connections and such, and my connection is just generally too good. If you find this is a common issue, invite me to drive in your online sessions sometimes, so I can see if I am affected as well.
 
Shifty Geezer said:
In GT's case, do you think it possible that the game does run on a simpler engine requiriing less data to reconstruct?
For the replicas - possibly, but I'd find it incredibly daft to do so for the player's own car - which in turn would mean there would be no difference to how everyone drives anyway.

novcze said:
I can imagine that simulation of car suspension and how it reacts to road is rather complex task
Like ERP says, it would depend on specific implementation, but in general case it's more likely to be one of the (computationally)cheapest parts of the simulation.
 
Wouldn't it make sense to simulate only your own car on the console and merely send the position you are at to the server? Or would this introduce too much lag into the system?
 
Wouldn't it make sense to simulate only your own car on the console and merely send the position you are at to the server? Or would this introduce too much lag into the system?
As mentioned, you might receive player position data late or iss some info entirely. In fact there's no might about it - you definitely will. All online games effectively simulate where players are, because they never actually know, and synchronise as best they can. This enables glitching (intentional or otherwise) where the simulated player is at a point but the actual player is somewhere else only their position data isn't reaching the other console or server, until all of a sudden there's an update to the position data and the simulation moves the player to the new known position, causing a jump.

The smoothness of an online game is mostly, as I understand it, the cleverness of the devs to predict where players would be and the way they handle key data. Until we get an internet infrastructure with LAN latencies, we're stuck with this, and that's not going to happen if we're honest for a good many decades, if ever.

In the case of GT5 though, as Faf confirms for me, there isn't obviously a reason to want to run the player's local simulation differently to the solo game. The online issues almost certainly lie elsewhere, unless PD are being extremely odd. In answer to the broader question of online versus offline engines, there's no reason to run the local game differently regards player control, although things like world physics may use a simplified model to preserve consistency and reduce communication requirements.
 
Back
Top