Been working more on networking – now on clientside extrapolation. It means that after internet packet has arrived, and during small time until next one arrives (in my current networking model) the game will try to guess how it should run until next frame arrives.
This is actually only important for high-latency games, as it makes game much smoother (although not much more playable), for example here I recorded video at 1000 – 1200 msec latency (round-trip time). Green crosses show where players are located on client, red crosses show where players were located in last networking packet to arrive. Red lines are connecting these two points:
You can see that as long as it only involves AI pedestrians and player himself, the error is very small, and you can walk around – although once you try to shoot someone or iteract with players, it goes very wrong.
I’m thinking of adding two networking modes of a sort – one is when world update frames are sent at some low number, for example 10 times a second, and clients will use this data for checking sync state, resyncing – extrapolation takes more here. The other mode is when server sends state updates to clients every tick, and clients simply interpolate between last two received update frames.
The second way is much more precise, but it uses more traffic (and it’s more precise visually). Actually the only real difference between these two approaches is how quickly packets are sent from server – and this all relates only to client visualization. Client inputs are send to server, which calculates clients and their movement, and does all the bullet hit checking and lag corrections – therefore two modes only affect how players see it, and how enjoyable their game is.
The code difference between two modes is small, but I guess for best perfomance they would differ by this: in second mode the client adds extra interpolation between two frames, and the world state lags behind current state for about 100-200 msec (which means you need no more than 100-200 msec latency to play the game). E.g. the last received world frame is pushed by 100 msec into future.
In the first mode there is no interpolation between two received frames (because larger visual delays would be really annoying to user), but instead it entirely relies on extrapolation from last frame – because last frame is always late by more than 300 msec.
In fact, both of these modes can be interchanged in realtime, from users point of view this only requires setting a kind of net_clientrate console variable – making server send data faster or slower. Within one world frame data is compressed using delta compression, and AI pedestrians use their own way of synchronizing (full position resync frames, and AI updates, which carry changed AI states).
Hi, nice work on the networking! Can you give some hints on how to test it? I cant seem to find how to create a server, join it etc. (Guess i just cant find the console :S)
Anyway, i found a rendering bug too, not sure if you are aware of it, took some screens of it and put in the coordinates too. It renders the texture on the “wrong” side of the face, it goes invisible from the angle you would usually see it. Not sure if that made any sense but look at the pic: http://www.lachmann.nu/upload/render_bug.JPG
It’s a known bug, there’s many bugs in map renderer – not fixing them because I’m waiting for my friend to finish new renderer.
Console is brought up by pressing “~”, but currently joining to server and hosting is hardcoded, and it’s buggy (in last SVN revisions). I’m gonna do a proper demo with networking later, because this one was hardcoded for my two computers and my network.
Seems like you’re doing great progress anyways! I had to change to american keyboard layout (got a swedish keyboard) to get the console to work =)
Will the new renderer incorporate any new cool features like shadows etc?
Best regards!
The console is international – it accepts character in your current keyboard layout. Ideally it should print them, but there is bug that sometimes you have to press backspace several times before it works, and it may not render all of the characters (uses UTF-8 encoding, if character isn’t in char table, it prints rectangle).
New renderer will support many features, like shadows from sun, instead of block darkening like it was in GTA1-GTA2, stuff like that.
It was the problem with bringing up the console with the swedish layout, the “`” only appears after clicking a button, and then entering another character. Anyway, just a minor glitch. I use the rockstar fonts too, and they are messed up as you described, compared to the buka ones.
Great job so far! :D
New renderer sounds awesome! Any time-plan?
All the best!
I’ll see… the “‘” key shouldn’t actually be layout-dependant. The time plan is roughly like this:
before new year: release multiplayer demo (where you can walk around, connect to servers, chat, host servers)
after new year: start working on sprite rendering (rewrite animation, and add ability to define remaps for sprites, to change their colors)
later: start adding weapons and scripts, and sound, etc; also start adding new map rendering
… wait, cars will come after everything? I know you wanted a very complex implementation… but everybody’d love even cars as basic as GTA2′s one… :)
Cars require sprite remapping to work, so they will come after that