Tue 24 Jan 2012, 17:41 by bencelot
I'm in the process of making some big updates to Subvein's netcode. Hit detection in particular. I'm going to implement a similar model to what most commercial FPS games use, which will make things a lot more fair and enjoyable for players with higher pings. It's a bit more advanced than what is happening at the moment but the benefits will be worth it. For tech minded people you can read about how it's coded in the source engine here (go to the Lag Compensation section): https://developer.valvesoftware.com/wik ... Networking
What I'm going to do is make it so laggy players are actually able to reliably hit bad guys. I will do this by creating bullets BACK IN TIME on the server when a player shoots. The system we have now is pretty good but it feels a bit sluggish and provides an undeniable advantage towards low ping players. This new system will make the game a lot fairer and more enjoyable when playing with a higher ping, 200ms for example. Having a lower ping will still have an advantage, but it will not as as extreme as it used to be and should provide for a fairer game all round. It will also make the game FEEL a lot smoother for high ping players (which most players are considering how few servers we have) which will be very important when we're trying to attract and keep newbies after v0.7 comes out.
Before I explain the old vs new system, just know that there will be a drawback to this new approach. There has to be. It is physically impossible to overcome the speed of light and thus unless we're all playing on a LAN something MUST be sacrificed in order to make the netcode work. The way it worked before the laggy player took all of the disadvantages and the low ping player had all of the advantages. I originally designed it this way because I figured low ping players shouldn't be punished because other players had a high ping. I've now changed my mind on this and think it's best to try and make the game as fair for everyone as possible. As I said before, high ping players will always be at an advantage, but at least now hopefully if a player with 200 ping is against a player with 20 ping it'll actually be a fair fight.
Time to explain some stuff! Suppose player A has a ping of 200. Due to the lag when player A clicks his mouse to shoot, there is no way that the server can actually know this yet. It will take at least 100ms until the server knows that player A has shot (only 100 because a ping of 200ms is the time it takes to go from the client to the server and then back to the client). Now if player A is using a Railgun or something, he might see on his screen that he's hit player B before the server even knows that player A fired his gun! Now ideally the game should be coded in such a way that if you see someone get hit on your screen, then they actually DO get hit. Not only does this make the game feel more responsive but it actually affects how we aim. Players shouldn't be required to aim extra far in front of their targets just to compensate for their ping. If you hit, you hit.
So the problem is this. By the time the server knows that player A has fired his gun, player B may have already moved positions from where player A was aiming. So how is the server going to hit player B when he's not even in line with the bullets trajectory any more? If you just create the bullet on the server and fire it as normal it's just going to miss. Even if you speed that bullet up heaps on the server to compensate for the time lost due to lag it still won't matter because player B has simply move away from where you were aiming. So what do we do? Well there are a few ways to deal with it.
The way we currently deal with the issue is to make player A's bullets APPEAR to travel slower on his screen. Because his bullets seem to travel slower player A will naturally aim further infront of player B as he runs along to try and hit him. His bullets go slower so he naturally aims further forwards and then sees his bullets hit player B. Meanwhile the packet of information is sent to the server who fires his bullet at NORMAL speed but because player A is now aiming in a different direction (due to his bullets appearing slower) it all lines up just perfectly and player A's bullet actually hits on the server! Hopefully that made sense :p The PROBLEM with this approach is that 1) it looks very weird and sluggish for your bullets to be travelling at half the speed that they should be, and 2) it's just a downright disadvantage in combat. Even though the game slows your bullets for you allowing you to use them as a visual guide to lead your target, it is simply far harder to hit a moving target with slow moving bullets than with fast bullets. This is why Energize is useful, fast bullets make for easy aiming. The system of hit detection technically works, but it does so at great expense to both the enjoyment and competiveness of the laggy player.
So what can we do instead? Well it's about time I update the net code to use the same approach professional games like CS and BF3 use. What these games do is instead of slowing down the appearance of player A's bullets, they let his bullets travel at normal speed on his screen and instead create his bullet BACK IN TIME instead. By letting his bullets travel at normal speed on his screen not only do his bullets feel normal again, but it makes it nice and easy to aim too. So what do I mean by create the bullets back in time? Well what happens is this. Player A aims his railgun at player B and fires. He sees the hit and would expect to deal some damage. 100ms go past and the server finally receives this fire command. In this time player B has moved to a different position, but as far as the server knows player A is still aiming at player B's old position. Instead of just creating the bullet then and there and hoping it hits, the server will actually rewind the positions of all the players in the game back to when it thinks player A actually shot the gun. So the server rewinds player B back 100ms to when he actually WAS standing infront of player A and then creates the bullet. It then simulates the flight of the bullet and player B's movement as per normal back until the current time again. Now what happens is that player B does get hit because his position was temporarily moved back to where player A was shooting. The end result is that player A sees his bullet hit player B, it does hit, AND his bullet doesn't have to slow down to compensate for the lag. Awesomeness!
There are a few problems with this approach though. Firstly suppose you're player B. You run behind a corner and take cover. You think your safe. All of a sudden you see player A fire a bullet to where you WERE standing 100ms ago and suddenly you die. WTF you think? WTF indeed. On your screen you didn't get hit, but on player A's screen you did. However I code the netcode one of these screens needs to be wrong, that's just the unavoidable nature of the speed of light and high pings. But I think it's far more important and enjoyable for you to actually hit when you see you hit, than for you to get killed on the rare occassion when you think you shouldn't get killed. Not only does it make the game a lot smoother and responsive for everyone, but it makes it a lot fairer too.
The end result will actually be a combination of these 2 approaches that will try to balance the pros and cons of each method to make the game as fun and fair as possible. I'll need to tweak this a little bit but I'm confident that the end result will provide a much nicer feeling for everyone. Even people who live in the US and currently enjoy the privilege of playing with low pings should benefit. You will no longer have an absolute advantage over everyone else so yes, your average KD *will* suffer slightly because of this.. but just remember that having a low ping is still giving you an overall advantage. But even low ping players will see an improvement in their hit detection as the current system is still causing their bullets to miss frequently, especially in close range combat.
P.S. The way the current system works your bullets are slowed but it takes a while for it to become in sync with the server. This means that at extreme close range fighting your bullets simply aren't hitting your target. This will all be fixed with the new netcode, and will probably have quite a large impact on the balance of skills and weapons such as shotguns, blade fury, radiate and other close range things.
Tue 24 Jan 2012, 18:36
Well, Like in BF3, I don't like dying a half a second after I get to good cover. (Or proning outta sight) I like the idea though..
Also, Wouldn't this make the low pingers think they're lagging when they get headshotted through a wall by a 200+ pinger?
By all means, Do it, But first come out with new content.. You still haven't told us how far you've gotten in zombies, And the community is slowly dying out..
Tue 24 Jan 2012, 18:47
So doing this will make every player effectively have the aim advantage of a 0 pinger but the defensive disadvantage of a 300 pinger. Very big impact on gameplay especially for close range combat and maybe sprint.
Qwerty basically summed it up: I'm fine with this being implemented, but we're still waiting for Outbreak and we've not gotten a response on how much you've done for it.
Rex Nex says:
Fri 27 Jan 2012, 01:22
This is more important to overbreak for me. I was really hoping you would implement this widely-used system; as a end user, this really makes or breaks a game for me. The less I feel hampered by my hardware and connection, the more I am inclined to actually get better and not blame it on lag. I am very happy to see you have changed the netcode in this way; this is so much more enjoyable.
Getting killed while you are behind cover is annoying, but no where near annoying as emptying an entire clip into someone and dealing no damage because he is hosting the server and you have 200 ping. *ahem*cash*ahem*
Fri 27 Jan 2012, 15:37
Yup I agree. Anyway it's only taken me a day or two to code it in, so that's finished now. Bit hard for me to test until I can play on a server with a big ping, but I think it'll be a big improvement to gameplay. The solution I've come up with however is a hybrid between the previous system and the new one. Subvein faces challenges that most FPS games don't, the main one being that you can actually SEE the bullets. In CS the bullets are invisible. In BF3 they travel really fast and you can't see their trajectory too well due the first person view. But in Subvein they're right there and easy to see. If I went with the CS system 100% it'd look really strange to take damage when you can see your enemies bullets and they don't even appear to be hitting you (on your screen). So the issue isn't just the behind the corner thing, but also just running about in general combat. Anyway I've come up with a pretty good solution which combines the two.. we'll just have to see how it goes!
Anyway, back to Outbreak
Fri 27 Jan 2012, 18:33
Can you please give us a general time for when Outbreak is going to be released? A week? A month? A Moon Cycle?
Fri 27 Jan 2012, 21:22
your work is realy hard i hope you can finish it easily.Are you doing it alone?
Tue 31 Jan 2012, 19:49
*Pbbt* is what I have to say.
I now realise the complete futility in any sort of non-LAN competition in Subvein. Quite the disappointment.
The new system will definitely make the game more appealing to the casual player, which makes up the majority of players.
Mon 06 Feb 2012, 03:23
thumps up and hats off if youre doing it alone :O
Subvein Sundays: Official Play Sessions!
Subvein version 0.74 has been released!
Like Subvein on Facebook!
Subvein version 0.73 released!!
Let's Play Together!
Explosions now dynamically light up the map!
Subvein is on Steam Greenlight!
An amazing optimisation!
Version 0.71 has been released!
Version 0.7 is out! Translations, Unicode, and New Skills!
Today I'm going to add translations (переводы)
Version 0.698 is out! Vehicle netcode and skill changes
Version 0.697 is out! Restructured weapons, skills, missions
Version 0.696 released! Improved netcode, AI and skills!
Playing with pathfinding
Playing with netcode
Version 0.695 is here :D
Subvein v0.694 is rockin' OUT!
Subvein v0.693 is LIVE!!
Latest developments: In-game quick levelling!
Version 0.692 is out!
New version is out! Introducing v0.691
Yehaaa!! Version 0.69 is out!
Woo hoo! We now have new hosting :D
Woohoo!! Over 5000 members!
Subvein is back up and running!!
2000 members. Let's make it 20000!!
Subvein version 0.6 has been released!
New promo video!!!
Added a new Community page!
Just added camera shake :)
Updated the news page!
Start earning community credits today!
A war is coming..
Account system coming to Subvein v0.6!!
First ever demo of Subvein vehicles is up!
Version 0.551 Released :)
Subvein version 0.55 Released!
Version 0.541 is out. Thank god!
Version 0.54 is different. Experience it now!
Version 0.54 comes out in 24 hours!!
Subvein v0.53 is OUT!!
Subvein v0.53 will go up within 24 hours!!!!
Added a new SHARE button!
Added a new FAQ section to site!
Subvein version 0.52 is HERE!!!
Subvein v0.52 will be released in 7 hours!!
Development towards version 0.52:
Version 0.51 is OUT!