Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Dance time!

Sign in to follow this  


Today is a good day. It is a good day because virtually every single frickin' bug has been fixed. I stayed up until 2:15AM beating away at my code and debug data, and finally everything is solved.

Evil Bug -> The Random Destructor

This one had me baffled. Since the results that were produced from this bug were pretty much random (very much like memory corruption bugs) it was exceedingly hard to track down. I ended up having to output all packet reading information and actually count up all of the bytes going in and out manually to figure out:

the server-out instance of PACKET_SWITCHWEAPON was sending out 2 bytes and the client was trying to read 3. Whoops. I forgot that clients don't need to send Player ID data to the server (server can figure it out based on address/port/socket), but the server needs to send Player ID data to clients. Thus the clients would all read one extra byte, rendering all of the remaining data in the packet (sometimes up to 100+ bytes) with essentially 'corrupt'/'garbage' data. This made for some very strange client-side occurances ingame. Things like non-existant players joining, weird garbage text/messageboxes, and in one case players spontaneously dieing. Very disturbing.

But now it's fixed, so all is now well.

Movement Prediction Revamp

This was the other issue that was getting on my nerves. It seemed that a lot of the time I'd land several consecutive hits in a row on another player, and it wouldn't deal any damage. This was obviously because the player is not in the location that my client is predicting he is. This is evident in many online games where you need to 'lead' the target to make hits, by firing bullets ahead of a moving player to where he will be in a moment. I don't like that at all, so I knew today was the day I'd start debugging movement prediction.

The first thing I did was rig up a temporary 'ghost' player to move around my local client with simulated ping. So basically what I'd see is both my local player and what the server would be see at a packet-update rate of 250ms. Wow; what I saw shocked me. On average, the player's true location was about 30 pixels off. That makes a big difference when you're fighting someone who is moving around.

So my solution was a (vaguely speaking) combination of forcing more powerful smoothening (none of that light nudging business :P) and more accurate guessing of where the player will be by the time the next update arrives.

Right now it's working beautifully on my simulation, but I still need to have it factor in the client's lag. Tonight's test should be a good one. My goal of having a bug-free quasi-large-scale test might be realized! :D

Oh, and I was so happy I celebrated by adding an automatic shotgun. I'm sure the testers will like that. [grin]
Sign in to follow this  


Recommended Comments

I had a bug like this in star wars : rebellion that took me a while to track down.

One good solution to this is if you can define a structure that is both send & received whole. That way you can just cast sizeof( structure ) bytes to the structure, ensuring that

a) you get every byte
b) the items are in the right order.

Share this comment

Link to comment
30 pixels off? Ouch! Yeah, that's a killer. Congrats on getting all of those bugs fixed. Demo please! :D

Share this comment

Link to comment

I'm defintely going to have to get in on the next public test.....

If your allowing people to join, I'd like to too.

Share this comment

Link to comment

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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!