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

Portal-like level editor.

Discussion in 'Game Design' started by thedrok_, Mar 15, 2018.

  1. thedrok_

    thedrok_

    Joined:
    Apr 24, 2017
    Posts:
    14
    Hello,
    I have been working on a game and i would like to create a level editor. I loved the way portal 2 did theirs but i have no idea how they did it. Any tips on how they did it would be great. Im not asking for code just the theory behind how it works. I would also like to know if they used the level editor when they made the levels in the base game. I'm new to the forums so if this is not the place to post something like this please inform me.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Is everyone else like me and didn't realize portal 2 even had a level editor? I'd suggest giving an example of what you want that doesn't require prior knowledge.
     
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,965
    My recommendation is to start by looking at an existing in-game level editor. Below is a link to one that was created by the ProBuilder developers (and I believe it uses ProBuilder under the hood) with the intention to show off the runtime features of the asset and as a starting point.

    https://github.com/Unity-Technologies/giles

     
    wccrawford, Martin_H and Mauri like this.
  4. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    Went to go check on it since I was not aware of it. Apparently it's still in beta... It's like seven years old, right?

    For a basic Snapmap like tool, it doesn't look too bad.
     
  5. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    The searchwords that will help you are likely "modular" and "grid based". These links might help:

    https://www.gamasutra.com/blogs/Joe.../Skyrims_Modular_Approach_to_Level_Design.php

    https://de.slideshare.net/JoelBurgess/gdc-2016-modular-level-design-of-fallout-4


    I'm fairly certain they did not.

    Since you are not asking about code details and only general concepts I think it's ok. For code/implementation questions this would be the wrong forum. For more gamedesign focused questions like e.g. "what are the implications of shipping a game with a very simple to use level editor and expecting the community to share content?" this would be the perfect forum in my opinion.

    The big question is what is your goal? Do you want to just make the work easier for you? Do you want to ship the editor to players? Do you wonder about how this workflow could end up affecting your game?
    Some screenshots or descriptions of how your game works right now and how you've build level content so far would help you getting better answers.

    Welcome to the forum!
     
  6. thedrok_

    thedrok_

    Joined:
    Apr 24, 2017
    Posts:
    14


    This is the best example of it i could find. The features i am curious about are the walls/floors and how to extrude them. By what i can see its based on a voxel system that only displays the outer most walls. Would i be right in thinking this or am i missing something obvious?

    As for my goal, i would mostly just like to make the work easier for my self by using a level editor especially if i can get all the functionality i would need. However if i can manage to make the level editor "feel" right in my game i would release it to users.
     
    Last edited: Mar 16, 2018
  7. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,965
    I'd be surprised if it were voxel-based. It's most likely just modifying the mesh in the same manner as ProBuilder but it could very easily be simpler than that and be nothing more than placing new meshes to give the illusion of extrusion. With how simple the rooms are practically any solution would be viable with modern hardware including individual cubes.
     
    Last edited: Mar 16, 2018
    Martin_H likes this.
  8. thedrok_

    thedrok_

    Joined:
    Apr 24, 2017
    Posts:
    14
    I did not explain my reasoning well so i will explain it better here. Instead of creating a box where all normals are pointing away from the center they point in creating the walls of a room. if you then remove the walls where the boxes touch it will create a room that essentially encapsulates all the voxels. This is how i view what is happening. To make the room bigger you add voxels and to make it smaller you remove them.
     
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,965
    I fully understood your reasoning. I'm simply pointing out that the answer to a problem is not necessarily the most complex one you can think of. If anything the answer is often the simplest implementation you can come up with that meets the needs of the game. A voxel system is anything but simple.

    Voxel systems make the most sense for games where the world itself needs to be mutable (changeable). For worlds where the game environment won't be changing much or at all it's a poor choice because it has steep system requirements (CPU and RAM) compared to a traditional solution.
     
    Last edited: Mar 16, 2018
  10. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    @thedrok_ take a look at Archimatix in the asset store. It's not precisely what you're looking for, but it's an example of easily (incredibly easily) adjusted mesh elements that have nothing to do with voxels at all.
     
  11. thedrok_

    thedrok_

    Joined:
    Apr 24, 2017
    Posts:
    14
    I see what your saying about it having steep requirements but is it really that big of a requirement when A) the voxels are stored in a 25x25x25 array of bytes and B) the mesh in only generated when voxels were changed. I cant seem to think of a simpler way of implementing it. A prefab based system like Giles doesnt really work the way i would like it too and implementing a prefab based system that does seems like a pain.
     
    Last edited: Mar 16, 2018
  12. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,965
    With the way you kept bringing voxels up it left the impression you wanted something far bigger or denser, but I still don't think that voxels are the best approach here. Either way you're determined to take that approach so the best thing to do is to just try it and see what happens.
     
  13. thedrok_

    thedrok_

    Joined:
    Apr 24, 2017
    Posts:
    14
    I am not all that set on it if a better solution comes up. I just dont have any better ideas on how to manage where to put walls floors etc. I had a very rough prototype of a voxel based system but couldnt seem to get it to work quite right. Every time i tried to place or remove a voxel it seemed to pick a random place near by where i clicked. I think i will try again and post my results but in the mean time if anyone has any other ideas on how to do it other than a voxel system i would love to hear them.
     
    Martin_H likes this.
  14. thedrok_

    thedrok_

    Joined:
    Apr 24, 2017
    Posts:
    14
    After working on a voxel based system i have found that although it works well for generating the mesh the actual editing of the level is messy and doesn't work well. If voxels aren't the answer what other solutions are there? Is the only other solution to use prefabs?