This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Am I on the right track? (Connecting rooms)

chitogechitoge Posts: 6Member
edited July 2016 in 2D
Hi, I'm making a dungeon crawler like The Binding Of Isaac, and I would like some advice to know if I am on the right track with how I approached doors that connect each room.<br /><br />Since I use a Tilemap to generate rooms, I can't add functionality to a tile such as a door tile with a script that handles moving between rooms. Only collision works with Tilemaps and tilesets. So, I made a door scene that is instanced with the script I want and it works well. <br /><br />My concern is if my way of having instanced doors in my scene tree is inefficient or messy, because it gets the job done but when I look at the remote inspector and check the scene tree, I have a bunch of idle door nodes that are literally only there to tell my world which room it should teleport the player to when he touches it.<br /><br />cJL2rmE.png<br /><br />I only generated 3 rooms with 1 door each, but when I start implementing multiple branches with rooms, this approach seems inefficient.<br /><br />TUHpVag.png<br /><br />I know that another way is to only render the current room so that I only have 4 possible doors in the scene tree, but what if I wanted to have the whole dungeon rendered?<br />


  • SchusterSchuster Posts: 369Member
    Hi,<br />I am a beginner with Godot  G:<br />my solution for doors...what use the Area 2D for doors and preload door node only when the player/camera is (the door is visible) close?<br />so you should only have one node -the door (or a group of different variations of doors)
  • ScipiScipi Posts: 4Member
    It shouldn't be particularly inefficient since there likely won't be thousands upon thousands of doors. Plus the physics system makes use of spatial partitioning, which helps deal with that kind of thing.<br /><br />The only other thing you could probably do if you really wanted to avoid having a lot of nodes is use a tilemap and tileset just to paint areas that are doors and have a Position2D at the center of your character sprite with a script that will lookup which tile you are on and transition you accordingly if you are on a door tile.<br /><br />But really, you shouldn't prematurely optimize. Don't try to make something potentially more complex/error prone in the name of efficiency until you see a definite performance hit.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.