HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [] Is there a way to get the distance between two players when in different area  (Read 1310 times)

OurLord

  • World Owners
  • ****
  • Posts: 68
    • View Profile

I am hoping someone knows the answer to this.

I need to discover the distance between two players even if they are in different areas.

We are using seamless Link 2.0 and I am at a loss. I can get a players position but it is only relative to the area they
are in. I understand why a universal position is not wise due to floating point errors.

I have been trying to access the _seamlessLink_PositionalOffset field with no success.

Any advice on accessing the _SeamlessAreaLinkRegisrty and its enties _SeamlessAreaLinkRegisrtyEntry would be very much appreciated.

« Last Edit: Nov 02, 12, 08:40:12 PM by HE-Cooper »
Logged

HE-CHRISTOPHER

  • HeroEngine
  • *****
  • Posts: 424
    • View Profile

If the other character is replicated to your current area, the offset is applied to position fields (vector3) that are set to be reference frame adjusted in the DOM editor.  Assuming the default character classes, that means you can perform a simple vectorlength between the other character an your own.

If the other character is not replicated, or its fields are not subject to reference frame adjustment (or are not top level vector3s) then you need to get the position from the remote area server instance process (remote call) and then adjust it using the reference frame adjustment value.  This is significantly more complicated if the areas are not adjacently connected via seamless.
Logged
Christopher Larsen
CTO
HeroEngine

OurLord

  • World Owners
  • ****
  • Posts: 68
    • View Profile

Thank you for the reply, the second description is the situation I am  in.

I can get the players position by running functions in their area servers, I have read the wiki concerning reference frame adjustment and looked at a lot of code to try and discover:-

     1) Where the offset value is stored
     2) How to access this value and use it

I have found the field _seamlessLink_PositionalOffset in the _SeamlessAreaLinkRegisrtyEntry  DOM

but am at a loss as to how I access this value from code. I can't find the Node that this is attached to.

I'm happy to look at the code but cannot find any references in the server code which uses this.

The code I'm developing requires that I can get the distance between any two players whether in the same area  or not. I especially don't want it to think that two players are in the same location because they are in different areas say at the origin.

The resultant universal position does not have to be 100% accurate, close would be good enough.

On another note shouldn't World space be called Area space or am I missing something?


Any help would be much appreciated
Logged

OurLord

  • World Owners
  • ****
  • Posts: 68
    • View Profile

Thank you again HE-CHRISTOPHER for your response. But could you please answer my reply.

I understand I have to apply the reference frame adjustment value. But how do I get this value. You seem to understand the problem exactly and insinuate that you know how to do this.

How about letting me in on the secret or at least point me in the right direction.

Logged

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile

He's saying that if the areas are seamlessly linked, then the offset is already being applied. From a game design standpoint you'd probably need to be more specific about what type of information you're looking to display, as there's probably a simpler solution than actually calculating and deriving all of that information.
Logged

OurLord

  • World Owners
  • ****
  • Posts: 68
    • View Profile

I'm sorry I'm really struggling to understand.

The documentation somewhere says that the position of a character is realative to the area they are in, I seem to recall it was because having a position value within a world suffered from floating point rounding errors the further you got from the origin.

Also my test results show that even in a seamlessly linked area setup that if I request the position of each player online I can get results like the following which shows a player at the same location in two different areas:-

Code: [Select]

RAL_ReportPlayerPosition Area: 9223372057401021922 Instance: 13 Name: RAL_Seamless_04

PID: 9223372056452021549 nodeRef: 9223372056452021549 Position: (0,-0.098,0) Name: ourlord
Total number of players: 1
$AREA._GetSeamlessAreaTwoLinks ----------------
Area: 9223372057401021898 Instance: 13
------------------------------

RAL_ReportPlayerPosition Area: 9223372057401021898 Instance: 13 Name: RAL_Seamless_03

PID: 9223372056452021549 nodeRef: 9223372056452021549 Position: (0,-0.098,0) Name: ourlord
Total number of players: 1
$AREA._GetSeamlessAreaTwoLinks ----------------
Area: 9223372057401021922 Instance: 13


I am using the command:-
Code: [Select]

 PIDNode.GetPosition()


Where PIDNode is assigned to each player found in each area.

Am I using the wrong method, or is there something odd about my Seamless 2.0 configuration?

Just to reiterate my initial question I think I just need to access the _seamlessLink_PositionalOffset field in the _SeamlessAreaLinkRegisrtyEntry. I can't seem to find how I access this.

Thank you for your help.

Richard
« Last Edit: Oct 30, 12, 09:43:09 PM by OurLord »
Logged