Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

3D environments

Discussion in 'Game Design' started by derf, May 18, 2015.

  1. derf

    derf

    Joined:
    Aug 14, 2011
    Posts:
    356
    Which is the better approach to crafting a 3-D environment for a FPS type game. This is a simple 30-40 minute horror survival game set in a old mansion. 1 player object, multiple pick up objects like keys, journal entries and pictures with 2 enemy objects on patrol.
    .
    Approach #1: Create a multilevel 3-D environment that the player moves through from floor to floor with no load zones. This is what I am currently working with and I am wondering what effects it will have with the mesh bake and mesh agents. There is a cellar, first floor, second floor and an attic. There are stairs from the cellar to the first floor and 2 sets of stairs from the first floor to the second floor and finally one flight of stairs from the second floor to the attic. They are all on a 45 degree incline.

    With there be ANY issues, caveats or problems with having one large 3-D environment for the enemy AI to interact with as far as path finding goes?


    Approach #2: (Resident Evil style or Alien: Isolation style) Create each scene as a room or corridor within the mansion, or a WHOLE "wing" of the mansion as the scene. This means I would have a main wing, east wing, west wing for each floor, which than means I would compartmentalize things like the attic and cellar. I know this would give me more control over the interior design and environment size, but at the same time I feel it will lose out on chases and hiding behind static objects to lose the enemy objects as their is little room to explore, plus they can easily load between scenes or areas to escape the enemy object. Since the main focus of the game is evasion I feel this approach will be a problem on to itself.


    Approach #3: (Amnesia: The Dark Descent style) Create each floor as a scene and their is loading between the cellar to the first floor, first floor to second floor, second floor to attic and vice versa. This style seems to "feel" like a good trade off between the two previous approaches, but still lacks because a player can still load between cellar and first floor to simply evade something and reload the cellar to try again, but the cellar is large enough that they must spend time to explore and may still need to evade the enemy objects.

    Is there another approach someone can think of or an example style from a game?
     
  2. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I would think if you setup occlusion, the first approach should work fine. I'm no expert but my limited understanding of occlusion is the system only has to deal with the models that are in the current occlusion area that the player is in. That allows large scenes with lots of models but models are only loaded when the player is in a place where they can see them.

    I could be totally wrong but that is my understanding. Maybe someone a bit more experienced with occlusion and LOD stuff can chime in. But pretty sure that would work.
     
  3. derf

    derf

    Joined:
    Aug 14, 2011
    Posts:
    356
    I'm not talking about the occlusion, but generally the walk mesh and navmesh. Is it better to have simple relatively flat 1 floor scenes of buildings; or is it fine having a multi-floored building complete with stairs connecting the floors together?
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Occlusion culling will be good (mandatory even) to reduce the amount of things that are needlessly rendered. But those things (walls, furniture, enemies) will still be loaded in memory.

    If memory and initial loading time aren't concerns, just keep the whole mansion in memory like you're doing. You can mask the initial loading time by playing an animated loading scene. I'd still recommend breaking up the contents into zones (i.e., groupings of GameObjects). Only enable the zones containing the player and the enemies, and perhaps their adjacent zones to make it easy for mobiles to cross into new zones.

    There are some good arguments for splitting the mansion into multiple scenes: you can reduce the amount of stuff loaded in memory, designers can work on different scenes simultaneously without conflicting with each other, etc. (From what I've seen on the forum, Unity 5's shared scene editing might not yet be ready for prime time.)

    If you want enemies to chase the player across different floors, you'll need multiple floors in memory. You can stream them in and out using the excellent, feature-rich SECTR Stream, or Scene Loader for a free option, or code your own using Application.LoadLevelAsync. This will save memory and also save CPU because you won't have to update objects far from the player. If they're separate scenes, they'll have separate navmeshes. If you keep multiple scenes in memory (e.g., first floor and second floor), you can use off-mesh links to connect them.
     
    BackwoodsGaming likes this.
  5. derf

    derf

    Joined:
    Aug 14, 2011
    Posts:
    356
    Again, this is not about occlusion, this is more to the navmesh and navmesh agents when enemies are attempting to navigate a multi-level navmesh. My overall concerns were mostly with the navmesh agents being able to move from the cellar to the attic traversing up 3 floors using stairs. The Unity documentation seems to lean towards it not being an issue, but was interested in opinion from other's whom may have had a similar design in previous games.

    I know that simple geometry for the navmesh is great for agents to follow, but here the geometry is not simple. There are 4 floors with ramps connecting them at defined locations but is is not a stairwell but are independent module pieces.

    If the player makes noise on second floor and the enemy is in the cellar but is within range, I need it to use the location of the noise as the navmesh agent's destination and the multi-level navmesh is causing me concern on having such a non standard navmesh.

    So will there be any issues, problems with navmesh agents moving from say position Vector3(32,1,16) to Vector3(32,10,16) on a complex navmesh?

    With those coords the agent will start out in the basement on the far side, will have to move to the cellar stairs to go to the first floor, than will have the option of two sets of stairs A and B to go to the second floor. From where the cellar stairs are; stairs B are closer, but stairs A are closer to the noise location. Either way the agent will move to one of the stairs to get to the second floor now there is only one set of stairs from the second floor to the attic, so the agent must move to them and then up to the attic before finally moving to the destination.

    Having written all that; my questions are simple.

    WILL
    there be any issues, problems, glitches, etc. with a complex geometry navmesh? (Monstrum comes to mind)

    Should we focus on creating scenes/levels that will create a simple geometry for the navmesh for game play purposes? (again Monstrum comes to mind)

    What do you feel is an acceptable design? Simple or complex? I will be doing some basic tests this weekend with the enemies moving and will probably post my results on performance and functionality.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Multi-floor navmesh(es) shouldn't be a problem. But agents can always get into trouble if you have really complex dead-ends that they can get stuck in. You can add a simple monitoring script to detect if they're stuck too long and pop them out.

    Gray-box the most complex geometry you think you might have in the mansion. This should be very quick, and when you're testing this weekend you can make sure navigation is up to the task. Some seemingly-simple things (e.g, a chair and a table too close to each other) can cause navigation issues, while some seemingly-complex things (e.g., traversing multiple floors) are really fairly trivial using features such as off-mesh links.

    Since the game revolves around sneaking, I'd argue for complex. The more realistic you can make the sneaking model, the more satisfied the player will be. For example, will walls. floors, and closed doors dampen sounds? Will it be louder to walk on a creaky wooden floor than a plush carpet?

    p.s. - I think one of the reasons we mentioned occlusion culling is because this might impact how you split up (or not) the mansion, which will in turn impact how you set up navigation.

    p.p.s. - You really might want to consider the complete SECTR suite. Your project would be a perfect use case. SECTR streams areas in and out, does occlusion culling, and does zone-based audio.
     
    theANMATOR2b likes this.