Menu

#282 [Marauroa] Events lost after changing zone

open
nobody
None
5
2017-02-07
2017-02-06
Anonymous
No

I'm still struggling with changing zone and losing perceptions on client. First thing I noticed is a possible bug on RPWorld on the requestSync method it checks for the client id parameter but then goes ahead and tries to retrieve the PlayerEntry comparing the object instead of using the id.

This only return non-null if the object is exactly the one in the entry so I'm replacing that line with:
PlayerEntry entry = playerContainer.get(object.getInt("#clientid"));

But that brings me to the second issue, after I change zone and the sync is requested, it keeps being sent to the original zone (extracted from the entry). I haven't been able to find a place the entry's object is updated so the changces this zone is accurate are next to none so basically after I change zones my client keeps getting empty perceptions (confirmed it happens after the sync perception) and I suspect it's just being sent to the wrong zone
The engine thinks the object is in a zone, but is not on the objects of the zone so the event are lost when getting the caster of an action it retrieves the object from the PlayerEntry.

Discussion

  • Javier Ortiz

    Javier Ortiz - 2017-02-06

    Forgot to login prior to adding the issue. Not sure if the owner can be updated.

     
  • Hendrik Brummermann

    I think the root of the problem is, that you ended up with two distinct objects representing the player. The "object" in your example code should be the exact same object that is in PlayerContainer.

    The original concept of #clientid has a number of issues such as security, so nowadays the network connection information is used to associate clients with objects. #clientid is deprecated, but unfortuneteally was not cleaned up completely.

    (To prevent the security issue, there are checks to ensure that #clientid and the network connection identify the same object before actions are executed.)

    Please ensure, that you use the object in PlayerEntry to communicate with the client. Not a different object which has the same #clientid.

    I think, however, that the object in PlayerEntry can be replaced with a different object, if need arises.

     
  • Hendrik Brummermann

    There is RPWorld.changeZone() to transfer an object to another zone. It works both for players as well as any other object.

     
  • Javier Ortiz

    Javier Ortiz - 2017-02-07

    I do use the RPWorld.changeZone() currently, that's where the issue arose.

    Then I guess my question is, what is the proper way to add events on the server to be communicated to the client?

    As you add event, change zones, etc. the object changes. And again, I see no updates on the PlayerEntry anywhere to keep this up to date.

     
  • Javier Ortiz

    Javier Ortiz - 2017-02-07

    I'll rework the code to keep the player entry updated all the time then and see how it goes. Thanks!

     
  • Javier Ortiz

    Javier Ortiz - 2017-02-07

    Right now I use the objects on the zones to add events to them as needed then call RPWorld.modify on them. You saying that is not the way?

     

Anonymous
Anonymous

Add attachments
Cancel