How can I load the contents of another layout into the existing layout?

0 favourites
  • 6 posts
  • Back in the C2 days, I built a hacky little plugin that allowed me to load the contents of another layout into the existing running layout. I could choose to load everything from the layout and it would map the layers from the loading layout to the running layout's layer names. Or I could single out a particular layer to load from and load into. It was very useful for a variety of games, such as...

    Stitching together a random set of scenarios:

    I used it to stitch together random gameplay scenarios. For example, it's an endless randomly generated game except the content is a series of scenarios that are picked from and each scenario was setup as a separate layout. Therefore each of these layouts were never "run" themselves, they were simply loaded. The height of the scenario was used to also inform the main running layout of where to stitch the next layout.

    Loading scenes in an adventure game

    This one may sound more abstract but it was just another application of the plugin. I would load "cinematic" scenes that were prepared as separate layouts and have them appear in the main running layout.

    What I'm wondering is, do I need to build another plugin in C3? Or is this now possible through some new event API in C3 or via Scripting that I don't know about?

    At the most basic level, all I really need is a way to read the contents of another layout, its layers and its instances. If I could read properties of the other layout and the layers as well as the instances, that'd be even more powerful.

    Alternatively, is there a way in the Scripting API, to access the JSON that represents the initial game data?

  • Stitching together a random set of scenarios:

    I used this system in a couple of my games. But of course, it won't be practical with big complex scenes.

    Another idea is to make a "snapshot" of the scene layout (during development) and save it in a text file. This can be some bare bone information about each object (type, position, angle, layer etc.), or a complete save state in JSON format. Then you can use this data to recreate the scene in runtime.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey dop2000

    Thanks for your suggestions. Here are my thoughts.

    Regarding the first proposal:

    That's a nice idea but like you said, it wouldn't really scale and it'd become pretty impractical/messy quickly I think. Also I believe it'd be very prone to bugs as you're effectively storing all the possible scenarios/content arrangements you want to load in areas off screen.

    Regarding the snapshot approach:

    I did consider this but again I think it's messy and introduces an "over the top" process into the development cycle in which we'd need to be regularly loading the layout up, grabbing the JSON, possibly altering it in some way and then adding it back into the project. Any small iteration of any scenario or layout would require this re-generation process.

    More thoughts:

    Considering we have the existing layout system that can compartmentalise the content that we would want to load, it seems like we'd be reinventing the wheel with the above approaches.

    I am wondering what Ashley thinks about this. Some kind of support for this feature would be really useful for a variety of games I think.

    Also, in case anyone is wondering, here is how the hacky C2 plugin I made previously worked. These were its methods:

    LoadLayoutLayer

    Description: Load layer {1} from layout {0} into layer {2} with offsets {3} and {4}.

    LoadWholeLayout

    Description: Load all layers with matching names from layout {0} with offsets {1} and {2}.

    The latter automatically mapped the layer names from one layout to another.

  • Hey dop2000

    Thanks for your suggestions. Here are my thoughts.

    Regarding the first proposal:

    That's a nice idea but like you said, it wouldn't really scale and it'd become pretty impractical/messy quickly I think. Also I believe it'd be very prone to bugs as you're effectively storing all the possible scenarios/content arrangements you want to load in areas off screen.

    Regarding the snapshot approach:

    I did consider this but again I think it's messy and introduces an "over the top" process into the development cycle in which we'd need to be regularly loading the layout up, grabbing the JSON, possibly altering it in some way and then adding it back into the project. Any small iteration of any scenario or layout would require this re-generation process.

    More thoughts:

    Considering we have the existing layout system that can compartmentalise the content that we would want to load, it seems like we'd be reinventing the wheel with the above approaches.

    I am wondering what Ashley thinks about this. Some kind of support for this feature would be really useful for a variety of games I think.

    Also, in case anyone is wondering, here is how the hacky C2 plugin I made previously worked. These were its methods:

    LoadLayoutLayer

    Description: Load layer {1} from layout {0} into layer {2} with offsets {3} and {4}.

    LoadWholeLayout

    Description: Load all layers with matching names from layout {0} with offsets {1} and {2}.

    The latter automatically mapped the layer names from one layout to another.

    If you have a feature request post it here:

    construct3.ideas.aha.io

  • Hey LaurenceBedford. Awesome, I wasn't familiar with that feature request tool.

    I've submitted a more detailed explanation of the feature there:

    construct3.ideas.aha.io/ideas/C3-I-1410

    I hope others find this proposal interesting.

    In summary, the use cases I can think of for others looking at this thread:

    • Stitching together a random set of scenarios for an endless game. Useful for hyper casual games.
    • Loading an pre-orchestrated battle experience "event" into a larger game. Useful loading a complex boss fight or battle scenario into a Metroidvania or any big game.
    • Fading in and out preconfigured cinematic scenes in a continuously running main game layout. Useful for treating each layout as a cinematic to be loaded.
  • Back in the C2 days, I built a hacky little plugin that allowed me to load the contents of another layout into the existing running layout.

    Hi!

    Could you please share this plugin! I could really use it...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)