Jumping Problem

09/11/2010 20:15 Arcо#1
Well, on my 5071 source, I got a lot of things good to go, but now I have one really bad problem. If you jump once, then move at all you get dc'd. No matter what. You jump, then walk, boom dc. I been trying to fix this on my own for a few days, but no success. Here's some snippets of codes that deal with players jumping and walking. Does anyone see anything wrong with it, or do you think it may have something to do with setting location?
09/11/2010 20:20 -Fáng-#2
Try debugging it! I had the same problem with my custom source and I figured out that it was the NPCs that weren't spawning correctly... but if your NPCs and Mobs are spawning correctly, I'd check your movement packet. What happens if you jump and then jump again? Does it do the same thing?
09/11/2010 20:24 Arcо#3
Quote:
Originally Posted by -Fáng- View Post
Try debugging it! I had the same problem with my custom source and I figured out that it was the NPCs that weren't spawning correctly... but if your NPCs and Mobs are spawning correctly, I'd check your movement packet. What happens if you jump and then jump again? Does it do the same thing?
Npcs and mobs spawn correctly, I login where there are npcs and mobs, and they are there, no problem. And obviously I tried debugging it or else Iwouldn't have posted asking for help. And I said any player movement causes dc. Jump+walk, or jump +jump.
09/11/2010 20:27 -Fáng-#4
What about just walking? Just... any kind of movement what so ever? How are the coordinate variables being saved? Because it looks like that handler might be correct. Did you run a block test to see what the new coords are and do they match what you're doing on the server?
09/11/2010 20:30 Arcо#5
Quote:
Originally Posted by -Fáng- View Post
What about just walking? Just... any kind of movement what so ever? How are the coordinate variables being saved? Because it looks like that handler might be correct. Did you run a block test to see what the new coords are and do they match what you're doing on the server?
You can walk, for a good 5 or so seconds, then it disconnects. But if you just stay still, you don't disconnect. And yes yes I did that. And they matched.
09/11/2010 20:35 -Fáng-#6
Quote:
Originally Posted by .Arco View Post
You can walk, for a good 5 or so seconds, then it disconnects. But if you just stay still, you don't disconnect. And yes yes I did that. And they matched.
That's so weird... so the coords are matching... is it possible that they're not saving and the system is getting stuck with them making the client socket lag? That could make it disconnect. How is it saving these variables?
09/11/2010 20:43 CptSky#7
When you broadcast the packet, you probably send the packet with the TQClient seal.
09/11/2010 20:45 Arcо#8
All the packets are sent with the TQSeal, or else none of them would even be valid.
09/11/2010 20:48 Kiyono#9
Quote:
Originally Posted by .Arco View Post
All the packets are sent with the TQSeal, or else none of them would even be valid.
Aren't there 2 of them? TQserver and TQclient, could be wrong though.
09/11/2010 21:04 Arcо#10
Even so, point being, if they weren't sent, then ALL my packets would be invalid aye?
09/11/2010 21:25 -Fáng-#11
What does the console say? Nothing? Do a lot of breakpoint tests on 1 jump and see where it disconnects... not only in the Jump handler but where it goes after that. We can't see your source so it's kinda hard to help. =\
09/11/2010 21:30 .Kob#12
Quote:
Originally Posted by .Arco View Post
Well, on my 5071 source, I got a lot of things good to go, but now I have one really bad problem. If you jump once, then move at all you get dc'd. No matter what. You jump, then walk, boom dc. I been trying to fix this on my own for a few days, but no success. Here's some snippets of codes that deal with players jumping and walking. Does anyone see anything wrong with it, or do you think it may have something to do with setting location?

Have you tried:
Hero.Screen.Reload(false, Packet);

I say this because with impulse's source you can see this:
client.Screen.Reload(generalData);
09/11/2010 21:31 -Shunsui-#13
is the player (x,y) been updated ?
09/11/2010 21:34 .Kob#14
Quote:
Originally Posted by -Shunsui- View Post
is the player (x,y) been updated ?

Yes,

Quote:
Hero.Entity.X = new_X;
Hero.Entity.Y = new_Y;
09/11/2010 22:12 -impulse-#15
.Arco do this.

go in wherever you got the disconnection sequence ( Socket.Disconnect or Socket.ShutDown ) and generate an exception.

Make sure you have a single try-catch in the packet handler like so your exception will be caught by the try-catch from your packet handler.

Eg:

public void Disconnect()
{
throw new Exception("this is just a helpful exception");
if(Socket.Connected)
{
Socket.Disconnect(false);
Socket.Close();
}
LogOff();
}

public void HandlePacket(byte[] buffer, Client client)
{
try
{
ushort length = buffer[0] | (buffer[1] << 8);
ushort type = buffer[2] | (buffer[3] << 8);
switch(type)
{
case ...
}
}
catch(Exception exc)
{
Console.WriteLine(exc);
}
}


Once you do that, try to move the way you said and when you should disconnect, the exception will be thrown. Once the exception is thrown, just follow the stack trace and see where it goes till it gets to the disconnection sequence. It will be helpful.