Jump to content
  • 0

Client <---> Server Synchronization!


Question

Posted

Hello my friends again...

so i enabled the DEBUG configs today and i saw that the client position and server position are not the same and in some cases an error was appearing..!

so how can i make the server and client to have the same char position?!

Recommended Posts

  • 0
Posted

ur talking about the validatePosition packet...

 

First of all its sooooo hard coded, you wont ever make a worty modification in it...

Secondly the only solution to this is geodata, but imo, the serverXYZ != clientXYZ or serverIntention != clientIntention isnt even close to a problem

  • 0
Posted

ur talking about the validatePosition packet...

 

First of all its sooooo hard coded, you wont ever make a worty modification in it...

Secondly the only solution to this is geodata, but imo, the serverXYZ != clientXYZ or serverIntention != clientIntention isnt even close to a problem

can you explain it better? :P

i have geodata and pathnodes and the Geodata config is setted to 2

  • 0
Posted

can you explain it better? :P

i have geodata and pathnodes and the Geodata config is setted to 2

What he says is that the client reads the l2 world differently from the server, if i am not mistaken.

  • 0
Posted

What he says is that the client reads the l2 world differently from the server, if i am not mistaken.

so the only solution to synchronize these things is just a good geodata?

  • 0
Posted

can you explain it better? :P

i have geodata and pathnodes and the Geodata config is setted to 2

 

You could try to leach ValidatePostion.java packets from other packs, cause formulas differ among projects

  • 0
Posted

You could try to leach ValidatePostion.java packets from other packs, cause formulas differ among projects

hmmm... i will search tomorrow and i will reply the results!

  • 0
Posted (edited)

so... i've made some changes...

		if (activeChar.isInBoat())
		{
			if (Config.COORD_SYNCHRONIZE == 2)
			{
				dx = _x - activeChar.getInVehiclePosition().getX();
				dy = _y - activeChar.getInVehiclePosition().getY();
-				// dz = _z - activeChar.getInVehiclePosition().getZ();
+				dz = _z - activeChar.getInVehiclePosition().getZ();
-				diffSq = ((dx * dx) + (dy * dy));
+				diffSq = ((dx * dx) + (dy * dy) + (dz * dz));
				if (diffSq > 250000)
				{
					sendPacket(new GetOnVehicle(activeChar.getObjectId(), _data, activeChar.getInVehiclePosition()));
				}
			}
			return;
		}

and i've added this option:

			if (Config.COORD_SYNCHRONIZE == 3)
			{
				activeChar.setXYZ(_x, _y, _z);
				return;
			}

i saw that on Config.COORD_SYNCHRONIZE == -1 it's saying only the Z coord will synch with the server... by using the code activeChar.setXYZ(realX, realY, _z);

so if this code is synchronizing only Z... what will happened if i will make it like the code above?!

 

Edit: i tried and something else..

-				if (((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800))
+				if (((Math.abs(dx) > 200) && (Math.abs(dx) < 1500) && (Math.abs(_x - activeChar.getClientX()) < 800)) && ((Math.abs(dy) > 200) && (Math.abs(dy) < 1500) && (Math.abs(_y - activeChar.getClientY()) < 800)) && ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800)))
				{
-					activeChar.setXYZ(realX, realY, _z);
+					activeChar.setXYZ(_x, _y, _z);
+					realX = _x;
+					realY = _y;
					realZ = _z;
				}

i tested it and i can said that the cords have a better synch than before but not actually the same at all times..!

so these are the coords

 

client pos: 83245 148623 -3405 head 32916
server pos: 83241 148623 -3408 head 32907
 
please can you explain me what exactly is the "heading"? cause in some cases is the same from server with client and in other cases is far different than client..!
 
edit 2: i think is far better the last way i do..
before doing this i was have dual box with admin and a normal char and the char was looking to different way on both clients..!
and now with this the players have fully synchronization on each client!!
Edited by xXObanXx
  • 0
Posted (edited)

Which is the point of trying to synch this thing?

first before changing the last code i placed above the player was looking to giran temple for example and the other player was looking the player to see from the other side..!

 

second and important thing that i THINK will get fixed is on attack... what i mean?

a player is hitting a mob.. and start running... the mob is hunting him.. then an other player is hunting the mob.. the melee attack range is 40 but the player after every attack starting and hitting from far distance more than 40 range..! cause of server and client are not synchronized on this side! ;)

and third may be some bugs by stucking on walls etc. i think this will fix the second and the third thing (first tested and working as it should be) ;)

 

Edit: the second thing tested and working well as it supposed to do!!) :D

Edited by xXObanXx
  • 0
Posted (edited)

You just need a proper geodata to solve that problems...

edit. the heading is the rotation of your char, if I'm not wrong.

Edited by ^Wyatt
  • 0
Posted

You just need a proper geodata to solve that problems...

edit. the heading is the rotation of your char, if I'm not wrong.

i have geodata and pathnodes 1 month now... and never disappointed.. i think my geodata is good... (i know is not the best.. but is good enough for now)

and as i've seen... the problem solved with this:

-				if (((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800))
+				if (((Math.abs(dx) > 200) && (Math.abs(dx) < 1500) && (Math.abs(_x - activeChar.getClientX()) < 800)) && ((Math.abs(dy) > 200) && (Math.abs(dy) < 1500) && (Math.abs(_y - activeChar.getClientY()) < 800)) && ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800)))
				{
-					activeChar.setXYZ(realX, realY, _z);
+					activeChar.setXYZ(_x, _y, _z);
+					realX = _x;
+					realY = _y;
					realZ = _z;
				}

so i think is not geodata's side but development's side..! ;)

  • 0
Posted (edited)

I think it can be java side if you have not geodata, but with geodata enabled it could be solved through it. But I'm not sure, never played with these things  :poker face:

Edited by ^Wyatt
  • 0
Posted (edited)

I think it can be java side if you have not geodata, but with geodata enabled it could be solved through it. But I'm not sure, never played with these things  :poker face:

actually the code that i modified is for geodata.. ;)

if ((Config.GEODATA > 0) && ((diffSq > 250000) || (Math.abs(dz) > 200)))
			{
				// if ((_z - activeChar.getClientZ()) < 200 && Math.abs(activeChar.getLastServerPosition().getZ()-realZ) > 70)
				
				if (((Math.abs(dx) > 200) && (Math.abs(dx) < 1500) && (Math.abs(_x - activeChar.getClientX()) < 800)) && ((Math.abs(dy) > 200) && (Math.abs(dy) < 1500) && (Math.abs(_y - activeChar.getClientY()) < 800)) && ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800)))
				{
					activeChar.setXYZ(_x, _y, _z);
					realX = _x;
					realY = _y;
					realZ = _z;
				}
				else
				{
					if (Config.DEVELOPER)
					{
						_log.info(activeChar.getName() + ": Synchronizing position Server --> Client");
					}
					
					activeChar.sendPacket(new ValidateLocation(activeChar));
				}
			}

I think the problem solved! what do you think? :)

Edited by xXObanXx
  • 0
Posted

actually the code that i modified is for geodata.. ;)

if ((Config.GEODATA > 0) && ((diffSq > 250000) || (Math.abs(dz) > 200)))
			{
				// if ((_z - activeChar.getClientZ()) < 200 && Math.abs(activeChar.getLastServerPosition().getZ()-realZ) > 70)
				
				if (((Math.abs(dx) > 200) && (Math.abs(dx) < 1500) && (Math.abs(_x - activeChar.getClientX()) < 800)) && ((Math.abs(dy) > 200) && (Math.abs(dy) < 1500) && (Math.abs(_y - activeChar.getClientY()) < 800)) && ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800)))
				{
					activeChar.setXYZ(_x, _y, _z);
					realX = _x;
					realY = _y;
					realZ = _z;
				}
				else
				{
					if (Config.DEVELOPER)
					{
						_log.info(activeChar.getName() + ": Synchronizing position Server --> Client");
					}
					
					activeChar.sendPacket(new ValidateLocation(activeChar));
				}
			}

I think the problem solved! what do you think? :)

 

No, revert anything you did. Bad client xyz is a rare phenomena, you will make the things worse... You can't fix it with simple changes, you think that L2J developers let it that way because the where nubs?

Guest
This topic is now closed to further replies.


×
×
  • Create New...