Teleport System buggy

There is issue with teleport system where the true position according to the game’s system isn’t updated when a user is teleported.

The way it seems to work is, when a user is teleported, their visual position for users in the room goes to the new position, as well as for the player themselves. However the game still thinks the user is in their old position. Only after teleporting a 2nd time does the position truly update for the game system.

This is hugely breaking in many circumstances, e.g. if a user is teleported, and then another user is teleported to their position, the 2nd user will be sent to their old position rather than new one. Also, if a player is teleported, then a user joins the room, that user sees them in their old position visually causing mismatch in visuals.

Would be great if this is fixable somehow, tysm

2 Likes

Was this ever fixed? The docs are not very good regarding this.

https://create.highrise.game/learn/bots-api/endpoints/teleportrequest

What is “rid: string”? Does this not take a Position type argument? Also anyone know what’s up with calls that have both a “rid” field and a “room_id” field? From context it seems “rid” should mean “room_id.” Is that inaccurate, or is there really redundancy here?

1 Like

You are correct; the TeleportRequest must include destination parameters in the payload. It should consist of x, y, z, and facing. Here is an example:

/**
* The request to teleport a user to a new destination.
*/
class TeleportRequest {
  /**
   * @param {string} userId - The ID of the user to teleport.
   * @param {string} destination - The destination to teleport the user to.
   * @param {string|null} rid - An optional request ID.
   */
  constructor(userId, destination, rid = null) {
    this.user_id = userId;
    this.destination = destination;
    this.rid = rid;
  }
}

Thank you. So what are these “request id” parameters then? The documentation doesn’t explain them.

1 Like

The request ID (rid) in the WebSocket is basically a randomly generated identifier that can be assigned every time you send a request or response. While it is not necessary to include, you may choose to keep it in case you intend to manage the specific request at a later point :slight_smile:

What I personally do is keep a function that generates a random rid , and I call that function every time I make a request. Here is the function:

function generateRid() {
  var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  var length = 8;
  var rid = '';

  for (var i = 0; i < length; i++) {
    var randomIndex = Math.floor(Math.random() * characters.length);
    rid += characters.charAt(randomIndex);
  }
  return rid;
}
1 Like