Scene Positioning

Im making an open world rpg in several levels and the ability to go between them. There are atleast two doors in each level which lead to a different one. If you go to the second level from the first, it sets the player to its default in the scene. “This is all to reduce lag which is another problem in gdevelop”. But if you go from the second to the first, it sets the player to its default in the scene instead of near the door at the end of the level where it should. You should make it easier to change player position depending on what scene they came from. If there is an easy way to do this already, please let me know.


First, one feature request per thread. Always ensure you’re following the rules as laid out by luni here: Welcome to the User Feedback channel!

That said, this is generally done the same in all major game engines, and doesn’t require a specific feature for it.

  1. Give each door a variable with a unique ID value (name the variable “ID” or “DoorNumber” or whatever you want, give it a number, starting from 0. Keep them unique even across all scenes)
  2. Create a global array variable (or structure variable), name it “DoorConnect”.
  3. Make an index (or child variable) of that global variable for each door in your game.
  4. Make the value of that index (or child variable) the index of the door they go to.
  5. When your player collides with the door, set a global variable of “ExitDoor” to the value of DoorObjectNameHere.Variable(DoorNumber).
  6. Change your scene, then at the beginning of the scene, Check the condition of “The Value of Variable “DoorNumber” of the DoorObjectnameHere” is = to GlobalVariable(DoorConnect[GlobalVariable(ExitDoor)])", then set the action of “Set the position of Player to DoorObjectNameHere.X(), DoorObjectNameHere.Y()”

These are just examples of a way to do it, but it will have your player instantly be set to the position of the new door when the scene starts.

Also, “lag” as a concept in game development means network latency or input latency. Unless you are making a multiplayer game, lag shouldn’t have anything to do with the above conversation. Do you mean framerate/FPS? If so a lot of that is going to have to do with your event and asset optimization

For reference, I currently have a scene with roughly 1800 objects in the scene, and ~200 million pixels worth of tilemap background (~100 screens wide at 1920x1080), and get over 120 fps on my 6 year old laptop (Max refresh rate it supports), and 240 fps+ on my desktop (max refresh rate it supports). Trigger once, narrowing down which objects your targeting, and making sure you’re using the right events (not using “for each” when you could instead be using a single event with proper conditions, not using Tiled Sprites for backgrounds when you could instead be using tilemaps, etc).

If you do mean actual network lag, that’ll be dependent on your netcode design. If you mean input lag, you’d have to give more details (in a new thread) for people to further troubleshoot.

thankyou. Im honestly new to gamedev so when I was making the game I got really confused

1 Like