Same level different compositions

Hi, Guys

I have a question regarding my project architecture or how better to organize it. Let’s say I have two levels “Road to school” and “Inside school”. The “Road to school” level has a set of quests, NPCs, triggers to interact and some puzzles. So when a player has passed all the quests and puzzles on the level he can go to the next one level “Inside school”. Some similar things happens on this levels too, quests, puzzles, etc. when the player has passed all the things on the level “Inside school” he moves to the next one level again but the next one level is going to be “Road to school” again but with new quests, NPSs and puzzles. So now it’s “Road FROM school” for the player.
So my question is how to use the same level twice but with different set of actors and settings?
I tried to investigate the topic and it looks like sub levels sounds good for this purposes but as I understand sub levels is deprecated functionality. And now it’s expected to use world partition to separate level to several parts, but as for me it more suits to big open worlds game, when I have only a small level just with different set’s of actors. So would be appreciate for any ideas.
Thanks!

Hey @Koroldev!

So what I would do if it were me, have a boolean in the gamemode that will be checked, say “Done school”.

Then in the LEVEL BP, on beginplay, you get gamemode, cast to your current gamemode, and GET “DoneSchool”.

Then if TRUE> Set the original set of NPC’s to Hidden in game → True and these OTHER NPC’s to Hidden in game → False!

TLDR; You make them all part of the level then toggle their interactivity/visibility based on a bool in the game mode! :slight_smile:

1 Like

Thanks for your reply! Yes, adding all the expected actors to the level and then manipulate it through the level blueprint looks like the most easiest way, but I thought maybe there more proper way to doing it. Would be comfort to have possibility to switch sets of actors in editor. For now I should create directory for each of the sets and then turn on/off visibility for this directory in editor, looks like not the most reliable way. And regarding to the level blueprint I should keep lists of actors for every set and add each one new actor to expected set manually one by one and it makes the process longer.

Actually, this would be a great time to use arrays!

You can add each of the actors to an array in the Level Blueprint (Say, ActorSet1 and ActorSet2). You can create these Arrays in the Level BP itself (Use “Actor: Object” Array) and then with the LBP open, you can drag those actors into the graph to add them into the Array.

Alternatively, if you don’t have a huge overhead, you can use tags to differentiate group 1 from group 2 and on BeginPlay, “GetAllActorsWithTag:ActorSet1”-> ADD UNIQUE to Array “ActorSet1” and do the same for Set 2, THEN do the other stuff using the arrays and a “ForEach” node to apply. :slight_smile:

1 Like

@Mind-Brain still sounds like not elegant solution because I should add tags to each actor of each set or add all this actors to arrays manually inside the level blueprint. But with the Sublevel functionality I only needed to create an actor in the expected Sublevel and no any tags or arrays. I just show expected Sublevel and hide other Sublevels. But Sublevel functionality is deprecated which means as I understand that there should be modern decisions for such functionality :slightly_smiling_face:

@Mind-Brain looks like I’ve found the solution. Data layers seems good decisions for my case also for some cases Level instancing will be a good decision, I think. I will try to separate my sets of actors by using different data layers for it and then on/off the expected data layers in my level blueprint. Thanks for your replies : )

1 Like

Btw. I don’t think world partitioning does replace Sub Levels in general. You can still have seperate levels that can be streamed in and out.

1 Like

@S-Dot since Sub Levels is deprecated functionality, in which way I can separate levels without world partition?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.