Interior/exterior switching.

Problems building or running the engine, queries about how to use features etc.
slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Interior/exterior switching.

Post by slapin »

Hi, all!
To save memory and CPU I want to unload exterior when player character enters any building and load the interior and do it depending on that building. Each interior is unique to that building. The player entering is detected by btGhostObject trigger, but how can I implement loading/unloading? Can Paging component help me here?

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 513
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 188

Re: Interior/exterior switching.

Post by sercero »

Hello,

I wonder if you'll be able to do this in a way that is not jarring for the player.

Because, what happens if the player enters the building but wants to exit it a few seconds later becase he changed his mind?

Now you have to reload the exterior in a split second, which will not work that way.

In fact, the paging component what it does is start loading assets based on distance (if I'm not mistaken) so that when you reach a certain area that area has been loaded.

Another thing is this: are your buildings or structures going to have windows?
What happens if the player looks out the window? The exterior was unloaded...

Unless we are talking about the player going into a cave and they can't go back.

I think this is a more of a gemedev question, I would search the forums here or the Godot forums because the implementation of this is more of an architectural thing more of a game engine thing.

I think this problem has already been solved in the gamedev community, I would ask in forums focused on gamedev.

Anyway, I hope you get a good answer because I'm interested as well. But my game is not so advanced as to be wondering about this.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: Interior/exterior switching.

Post by slapin »

I'm fine with black and load screens at this stage.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: Interior/exterior switching.

Post by slapin »

I not going to go for realism here so

  • the wiindows can be not transparent (like in many games) (most simple)
  • the immediate area around building might not be unloaded having part of world still alive (if I have time and energy to do that).

But if I do the first way then I can later do the second if I will have a will to do so.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2180
Joined: Sun Mar 30, 2014 2:51 pm
x 1168

Re: Interior/exterior switching.

Post by paroj »

slapin wrote: Sat Jun 07, 2025 10:09 am

To save memory and CPU

can you elaborate on where you expect those savings to come from? You will need to save more CPU then re-loading will cost you.

As far as Ogre is concerned, the main CPU cost will be culling. The more objects there are the more we need to test for visibility.
However, there are specialized SceneMangers that allow you to partition and skip large parts of it. Notably there is:
https://ogrecave.github.io/ogre/api/lat ... nager.html

As for memory, you can unload resources that you know are not used on the interior and Ogre will re-load them automatically from disk the next time they become visible (at the cost of stuttering).

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: Interior/exterior switching.

Post by slapin »

The stuttering is what I want to avoid and that is why loading screens and known good switching place is what I need.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: Interior/exterior switching.

Post by slapin »

Well, the memory savings come from less stuff being loaded. Also I expect to save on culling. Thanks for advice on portal system.