Jump to content

[Q] How do you clear/reset ExServerPrimitive packet properly


Recommended Posts

Long story short, I've written a function that displays a circle around the character when certain conditions are met. However, I can't seem to find a way to make it so that the circle in question is dynamic, or in other words to make it move around with the character. (No matter what I tried, the result was always the same - heavy FPS drop in the client after 15-20 seconds).

Is there a way to update the circle in real time (as the character moves) and if so, how?

I'm looking for a solution that does not involve client modifications. Any ideas, tips, and tricks are more than welcome.

Edited by Bru7aLMike
improved clarity
Link to comment
Share on other sites

1 hour ago, Bru7aLMike said:

Long story short, I've written a function that displays a circle around the character when certain conditions are met. However, I can't seem to find a way to make it so that the circle in question is dynamic, or in other words to make it move around with the character. (No matter what I tried, the result was always the same - heavy FPS drop in the client after 15-20 seconds).

Is there a way to update the circle in real time (as the character moves) and if so, how?

I'm looking for a solution that does not involve client modifications. Any ideas, tips, and tricks are more than welcome.

 

A primitive packet require you to define it using a name.

Basically try send again an empty primitive or to a different location such as 0, 0, 0 with the same name and it will replace it.

Link to comment
Share on other sites

Well, I did try sending an empty primitive but the client still suffered from an FPS drop.  I'll try sending a point at predetermined coordinates next.

Any idea how to make it so that the circle moves with the character without clearing the existing lines and sending them all over again at different coordinates?

Like, is there a way to basically link the said packet to player's coordinates so that no matter where the character goes, the circle goes with it and the char is always in the middle of the circle (from top-down perspective).


I realise this might be a silly question but I'm still new to this kind of stuff, so... here we go. 😄

What would happen if I simply send another packet with the same name but with different coordinates without clearing the lines of the previous one? Would the old one be replaced?


 

//debug_center: the assigned name of the packet 
//clearDebugPackets: clears all lines and points associated with the packet and sends an empty packet with the same name
//reset(): clears the cached packet server side;

debug_center = activeChar.getDebugPacket("center");
debug_center.reset();
activeChar.clearDebugPackets(debug_center);

 

Edited by Bru7aLMike
additional question in order not to spam the thread
  • Thanks 1
Link to comment
Share on other sites

The only possibility would be to use a Threadpool and call it every X times. That packet DRAWS things on client, there is nothing like "realtime". It stays on screen until you decide it mustn't stay on screen.

 

As you say, more you use forms, laggier your client will be. At this moment, I don't think it's possible to dump all the "hidden" forms, even after a packet reset. Client properly cleanups when the Player actually disconnects to the lobby, which probably cleans all forms from client memory.

Link to comment
Share on other sites

  • 3 weeks later...
On 12/6/2021 at 7:29 PM, Tryskell said:

The only possibility would be to use a Threadpool and call it every X times. That packet DRAWS things on client, there is nothing like "realtime". It stays on screen until you decide it mustn't stay on screen.

 

As you say, more you use forms, laggier your client will be. At this moment, I don't think it's possible to dump all the "hidden" forms, even after a packet reset. Client properly cleanups when the Player actually disconnects to the lobby, which probably cleans all forms from client memory.

Hello , i am using acis 382 pack and i set when teleporting into town to get rr , select char and enterworld and i am wondering if is there any way to check client memory cache size to set this to happen when is like > 60% full ? because right now i just set to Rnd.get(1,100) > 47 🙂

Edited by arm4729
Link to comment
Share on other sites

  • 2 years later...
Posted (edited)

You can LOCK the topic. I have finally found the answer to my problems. It appears to have been here, on the forum, all along.
And more specifically, the following excerpt of Elfo's comment:

"In order to fix that you have to store the original Location (x, y, z) of the player when they EnterWorld.

When you create an ExServerPrimitive package you need to provide a name, an x, a y and a z. These values NEED to be the X of the spawn location and the Y of the spawn location. The Z can be -65535 to ensure that the icon will be below the ground."

 



 

On 12/6/2021 at 7:29 PM, Tryskell said:

The only possibility would be to use a Threadpool and call it every X times. That packet DRAWS things on client, there is nothing like "realtime". It stays on screen until you decide it mustn't stay on screen.

 

As you say, more you use forms, laggier your client will be. At this moment, I don't think it's possible to dump all the "hidden" forms, even after a packet reset. Client properly cleanups when the Player actually disconnects to the lobby, which probably cleans all forms from client memory.



From what I could gather over the years, it appears as if the client replaces the circle based on String "NAME", which you send with the ExServerPrimitive.

Also, I did try your suggestion, albeit slightly altered, and it works like a charm. Namely, creating a runnable that loops through a POOL of players and sends them the updated Circle. A player is added and removed from the pool based on the VIEW FARM ZONE OUTLINE variable status. I'm just not sure if I should stop the runnable when the pool is empty or let it cook, given the fact that it loops only once per second and that I'm using a Flag at the very first check to break execution if the POOL is empty.

Edited by Salty Mike
Link to comment
Share on other sites

On 6/11/2024 at 6:48 PM, Salty Mike said:

You can LOCK the topic. I have finally found the answer to my problems. It appears to have been here, on the forum, all along.
And more specifically, the following excerpt of Elfo's comment:

"In order to fix that you have to store the original Location (x, y, z) of the player when they EnterWorld.

When you create an ExServerPrimitive package you need to provide a name, an x, a y and a z. These values NEED to be the X of the spawn location and the Y of the spawn location. The Z can be -65535 to ensure that the icon will be below the ground."

 


From what I could gather over the years, it appears as if the client replaces the circle based on String "NAME", which you send with the ExServerPrimitive.

 

You indeed have to save player position over Enterworld to properly clean it up later (if you don't, even trying to delete packet content would eventually keep it up), that's what we do with debug packet (which is a reusable Map of ExServerPrimitive packets) on aCis.

 

It doesn't solve the FPS stuttering - more you draw/delete lines, more your client becomes laggy. It's like if client wasn't deleting drawn points/lines properly, but instead simply hide them and redrawn content above.

 

If you got a solution, I would happy to integrate it.

 

You should check aCis#Player _debug packet integration, it allows very big amount of lines/points to be drawn, it is also reusable.

 

https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java?ref_type=heads

Quote
private Location _enterWorld;
private final Map<String, ExServerPrimitive> _debug = new HashMap<>();


https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java?ref_type=heads

Quote

// Set the location of debug packets.
player.setEnterWorldLoc(player.getX(), player.getY(), -16000);

 

Edited by Tryskell
  • Thanks 1
Link to comment
Share on other sites

On 6/11/2024 at 7:48 PM, Salty Mike said:

You can LOCK the topic. I have finally found the answer to my problems. It appears to have been here, on the forum, all along.

This is dedication! 2 years working on a problem. Congratulations!

Link to comment
Share on other sites

16 hours ago, Tryskell said:

 

You indeed have to save player position over Enterworld to properly clean it up later (if you don't, even trying to delete packet content would eventually keep it up), that's what we do with debug packet (which is a reusable Map of ExServerPrimitive packets) on aCis.

 

It doesn't solve the FPS stuttering - more you draw/delete lines, more your client becomes laggy. It's like if client wasn't deleting drawn points/lines properly, but instead simply hide them and redrawn content above.

 

If you got a solution, I would happy to integrate it.

 

You should check aCis#Player _debug packet integration, it allows very big amount of lines/points to be drawn, it is also reusable.

 

https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java?ref_type=heads


https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java?ref_type=heads

 


Thanks!

I'll take a second look and let you know if my implementation of the clearCircle() helps with the stuttering once I find time for some extensive testing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...