Copying or duplicating scenes vs. using external layouts

Hello everyone,

I am a novice Gdevelop 5 user and currently I am learning how to create a game with multi scenes. I found that I can simply copy and paste an existing scene, rename it, edit its objects to create a new scene. This will also copy all the events, conditions and their associated actions. I found this option easier since I only have to change the objects in the new scene to create a new level. Also, any changes to a given scene does not impacts other scenes.

I would like to know what are the pros and cons of using this approach to create levels vs. creating levels using external layouts when most of the events and objects in my levels are similar (except their placements and sprites). Is there any performance or other impact to the overall gaming experience?

I found it little inconvenient to start designing a level all over again with external scenes (since it only copies all the objects in the scene, not their placements and their related events).

Please forgive me for asking this question in the “Open Topic” category as I did not find any other category to ask your opinion.

Thanks

1 Like

Hi!

Since your objects are placed differently in different scenes, then I suppose you’re doing it right.

_______________________________________________________________________

External layouts are more useful for constant objects such as UI elements, & less so for game scene objects.

Example usage of External Layout for UI (top-right):

_______________________________________________________________________

For repeated events, you should consider using External Events.

Yes, that’s what I discovered after creating few levels. :slight_smile:

1 Like

The issue here is that if you need to change an event that affects all the scenes, you have to open all the scenes and modify each one. Or if you want to add another object, it has to be added to each scene (unless it’s a global object).

The way around this is to use an external event, and link to that event from each scene. Then it becomes one set of events used across multiple scenes.

An advantage of external layouts is that if you have the same set of events for multiple levels, then you need just one scene that creates the playing objects from the external layout, and so again only have one set of events. And if you add an object to the scene, it is automatically available in the external layouts.

Another advantage is that you can combine multiple external layouts in one scene. So your UI which would be pretty much the same for each level, mixed with a different background based on whatever level is being played. You can even define a number of different enemy formations in an external layout and then add one or some of them to the scene as you need them.

3 Likes

Great suggestions! I like the idea of using an external event and link it from each scene.

I tried creating objects from an external layout, but was unsuccessful. I am sure I must be doing something wrong, but I like the concept of editing the layout once and re-using it in different scenes.

How are you creating the external layout objects? Remember the external layout has to have the scene that’s using it as the base scene, and it has to be done once (beginning of scene is the usual way):

2 Likes

Yes. That’s how I am creating the external layout.

However, I don’t see the changes in the scene generated using this condition/action.

I believe it should display the objects as added in “Untitled external layout”. Am I missing something here?

Where are the external objects positioned? Do the object’s co-ordinates fall within the window that the scene starts with?

For example, if your object is placed at 1000,1000, but your resolution is 800x600, then it won’t get displayed until you move the scene camera. Where you position the object in the external event is where it gets placed in the scene.

Also, is the scene that uses the external layout also the scene that is set as the base for the external layout?

Have you set the objects in your external layouts as ‘Global Objects’?

You don’t need to set the objects as global if the scene is used as the base for the external layout.

1 Like

This was a great exercise! Cleared some of my key misconceptions about External Layouts/objects.

Thank you so much @MrMen @Fyrebrand_Gareth for your wonderful insights.

I did a little digging and found the following simple flow for global events/layouts:

  1. Create a Base Scene with UI and events.
  2. Create an External Layout with Base scene as its base. This will create a new layout with all objects and events used in the Base Scene. In fact, External Layout does not have an event sheet, it points to Base Scene Events.
  3. You can create a new Derived Scene and use the External Layout by adding “Create Objects From External Layout” with event " At the beginning of the scene. The objects will only appear in the Derived Scene if they are set as global objects.
  4. You can link events in the Derived Scene from the Base Scene using “Include events from the Base Scene”.
  5. Any objects added/modified in the Base Scene layout and events will be automatically reflected in the External Layout. However, they will only appear in the derived scene if the object added/modified is set as global object.
  6. Any objects added to External Layout will not impact Base Scene even if they are set as Global objects. They will only appear as Global objects in the object explorer of the Base scene. You can add them to the Base Scene if you want, but any changes to the Base scene will impact External Layout. So you may end up creating unnecessary duplicate objects.
  7. You can continue to create new objects/events in the derived scene which are specific to that scene.
  8. If you delete the Base Scene, the External Layout has to be linked again with the new scene.

EDIT: Fixed minor terminology conflict in step 6.

1 Like

If you add an object to the external layout, it is added to the base scene. The objects listed in the external event object panel are those from the base scene.

@TrinityNeo You sum it up really well & consise! :astonished:

_______________________________________________________________________

There might be a semantic confusion with this phrasing:

By ‘External Scene’, did you mean an ‘External Layout’ or a ‘Derived Scene’? :sweat_smile:
I’m assuming you meant a ‘Derived Scene’?

Oops! My bad! I meant “External Layouts”.

This is not what I have observed. I have cross verified with a sample Base Scene and External Layout and here’s what I got:

  1. Any object added to the Base Scene will appear in the External Layout not vice versa. Any object added to External Layout will not appear in the object explorer of the Base Scene unless it is added as a Global Object in the External Layout.

  2. Even if the Base Scene has the Global Object in the object explorer, it will not show up in the scene unless explicitly added.

  3. Any objects added to External Scene will not impact Base Scene even if they are set as Global objects.

I don’t now what you are doing, but if you add a sprite to an external layout, it is added to the associated scene, not to the external layout. The external layout only uses the objects available to it’s associated base scene.

Here’s what I mean:

New project, one scene:


One blank sprite named BaseSceneSprite added to base scene:


Added External Layout, and set BaseScene as associated scene for it:


Added blank sprite to External Layout:


ExternalLayoutSprite is in the object list for the associated scene, BaseScene:


Perfect! Thanks for the clarification.

1 Like

I might be mistaken, but I think what MrMen is saying here…

…is that rather than creating a new Scene for each Level,
you should instead create a new External Layout for each Level,
& load the appropriate External Layout for the appropriate Level.

All on the same Scene.

1 Like