Several 3D environments. How to ?

Started by
5 comments, last by Karnot 9 years, 10 months ago

For example, i might have an environment that is a game level, and my character walks around it. But when i open his inventory it shows another, small environment where i can rotate a character's model, change his equipment and so on. What is the "time-tested" way to do that ? Do i just put all environments i might call on in every game level ? That seems excessive, but i cant think of anything else.

For instance, in Unity i could create a game level in one file, and inventory screen in another, and switch between the two, but it is somewhat problematic to keep track of the data, not to mention there will be a loading time, however small it might be. In most modern games inventory screens and such just come right up, as soon as i press the button. Do people really just put everything in one level ? Please explain this to me.

Advertisement

your inventory is not part of the level at all. Your level is just data, as is your inventory, but they are not the same. That being said, how you display it is up to you.

A screen that operates on a characters inventory simply needs to have access to that inventory, how ever you store that data. When the user accesses the inventory, the screen pops up, allows the user to interact with their equipment, and when closed, the game resumes as normal. I'm not familiar with unity, so i'm not sure how i would accomplish that with said tool, but surely there is a GUI system in place.

In Unity, yes, they're still usually separate levels. Preload the inventory/menu levels and never unload them. When they're inactive, simply disable/hide their rendering. You'll usually need some kind of game-specific system in place to manage GUI objects, visibility, input modes, etc.

Note that in Unity (at least back in 3.5) you also have to deal with the annoying part where there's only a single Cartesian space, so you have to place all the UI assets at some world position never seen from within the game (or use some similar kind of trick, maybe with object tags/filters). Multiple distinct spaces are ridiculously useful and any engine lacking them should be kicked in the metaphorical shin. smile.png

Sean Middleditch – Game Systems Engineer – Join my team!

>you have to place all the UI assets at some world position never seen from within the game

Is it done in a different way in other popular engines ? I.e. UE, CryE, etc ?

The engine I use has two ways to do this. One way is to render what a particular camera sees to a texture.

The other way is to project what a camera sees over another camera view (the seeing camera can be in another screen.

So we do our 3D GUI in that other scene, and just project it over the main camera.

The objects in that other scene can be manipulated by code, or animation still.

They call me the Tutorial Doctor.

SeanMiddleditch is correct I will just elaborate:

In most game engines like Unity,UDK and many others, you will create a separate scene or level for your inventory.

In your level with the character you will have a camera that renders that scene, in your inventory you will have a other camera to render it's own scene.

When you press the inventory key the inventory scene will be drawn over your current scene, with it's background transparent.

Interaction with the inventory checks to see if it is visible and usually uses a screen ray for interaction, a buffer or list is used to store information for quick access.

The Hud is usually made the same way.

There are many other methods, some better others worse.

Thanks.

This topic is closed to new replies.

Advertisement