Connecting Worldspaces

Hi! So for the better part of this year I’ve been working on a small open world game, well rather a small open world proof of concept for a personal project, nothing huge just 1 town, around 15ish npc’s, 2 quests, and a dungeon. I’m stuck on the problem of combining the exterior world with the interior and was wondering how some of you would go about this.
So i have buildings on the exterior world that i have to connect with their interiors, and i want both the player and npcs to be able to go between the two.
My first thought was to separate interior space and exterior space into different scenes and stream them in during run time, but that brings up issues of connecting the right doors to the right area.
My idea right now is to keep it in the same scene but far under the exterior space and just enable and disable renderers, but it’s got some performance issues I’m not sure are worth it.
Both of these also come with the question of dealing with ai and physics calculations when not in the same area, but i feel thats a different design problem altogether that i think i figured out in a LOD processing sort of way.
How would some of you go about this?

Set a trigger at the door that will “teleport” the character into the interior of the building. It will have a loading screen, but if you set the interior up properly so that not too much loads, it should not be very long. Look at Sectr in the asset store. It will do this for you and works well.

Also, Tonyli has one that is free and works well too! https://www.assetstore.unity3d.com/en/#!/content/38168

There is also an asset that will load the scene when you click on the door. https://www.assetstore.unity3d.com/en/#!/content/31373

1 Like

Do you really need to calculate AI and physics when the player’s not there? Can you instead disable NPCs that are outside of the player’s area, and then update them with a rough approximation of their activity when the player returns? Otherwise it would be burning a lot of cycles on things that the player wouldn’t be there to see.

If your concern is rendering performance, keep in mind that Unity only renders geometry that’s in the camera’s view frustum. You can further improve rendering performance by using occlusion culling to reduce the amount of overdraw.

If your concern is memory, either of the tools @Teila listed above can help. Scene Doors (the second link) is probably easiest because it’s just a clean cut-over to a different scene (e.g., interior of a building). Scene Streamer is handy to keep your player in memory and just stream pieces like building interiors in and out of memory, but you need to prepare your scenes for streaming (as described in the Scene Streamer docs).

2 Likes

I missed this part. That is exactly what I would do. Why have something animating and rendering if no one can see it? I see many people saying they want their animals and npcs to carry on even when no players are present…but I don’t get it. :slight_smile: You can still create a living ecosystem with your npcs even if they are not actually walking through the doors.

Part of making a successful game is making it “appear” to do something using coding and little tricks rather than have it actually happening. So the NPC walks from the fields to the door of his cottage and disappears. Later, if a player enters the house, the NPC will recreate inside the house. But when the player’s character is not inside the house, the NPC is not there, not being rendered, and not animating.

3 Likes