Search Unity

Your professional opinion on the implementation of a game idea.

Discussion in 'Game Design' started by chrispcr, May 25, 2015.

  1. chrispcr

    chrispcr

    Joined:
    May 25, 2015
    Posts:
    2
    I'm working on a fps game in my free time. One of the main mechanics is that the level will change randomly. For example, you're walking down a hallway and its suddenly longer than you remember it. Or you go to open a door expecting one room and you'll get a completely different one. Other examples: A very large room where it doesn't seem to fit. You open an outhouse door expecting an outhouse and you get a ballroom, or your on the 5th story of a 2 story house. Or even a hallway or door opening to an field or other outside area.

    What I was thinking was to break the level into small 4x4x8 chunks (floors, walls, stairs, elevators, etc...). To show different areas I would just change the material on the models. Each one of these chunks would be a object, and each object would have pointers to next 6 chunks (up, down, left, right, froward, backward). So basically it would be 6 way linked list. Then I just limit the number of objects to what the system can handle and let the game decide whats needed. Deleting chunks in the extremes and creating new ones as the player progresses. Then use a simple text file to keep track of how the levels/buildings originally looked.

    I would need algorithms to make sure doors line up, that the chucks are rotated in the correct direction, and objects are lined up correctly so there isn't random chucks leaving gaping holes in the level.

    The hardest part I can think of, is to make sure the engine is rendering what can be seen from the player's current location. For example, a public restroom in the middle of a open field. From the outside is 2x2x1 building surrounded by grass, but when you open the door you see a 15x15x3 room. So what should you see 4 chunks in? The room or whats on the other side of this small restroom?

    So what do you guys think of this idea? Practical? Impractical? Is this a situation where I'm fighting the system instead of working with it? Does Unity already have a feature for stuff like this? Do you have a better idea?
     
  2. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
  3. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I have no working knowledge about a system like this, but it sounds like this could also be accomplished using multiple cameras in the scene.
    One camera rendering the first reality, the other rendering the second reality. ??
     
    Kiwasi likes this.
  4. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    There are a couple of ways of doing this. You could setup the scene with everything present and use different cameras with different culling layers, you would also need to change the collision matrix so that outside the door the player can walk through the supposed empty area, but once through the door the collision matrix works as normal. You could fake it: simply have a 2D rendered image showing the ballroom scene behind the door or within the outhouse, then when the player moves through you load tzhe 3D ballroom scene, this is the method usually used when going from outside to indoors in quite a lot of games, doing it this way also means that you can setup quite a few small scenes and load them randomly at certain threshold portals such as doors or turning the corner in a maze, the latter can be made to seem seamless by using additive loading, by actually have a variety of small scenes setup like this it is possible to achieve what you require in a simpler way, randomly setup the transition areas i.e. corridors and dungeons or whatever but hav eopening doors load a small scene this means that when the player backtracks you can even open a different scene than the one they expect once they step through that door.
     
  5. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    There's a lot of games about screwing with standard physics; Portal is probably the best example. So, I'd say there's fun precedent for what you're trying to do.

    A question, though - You've mentioned what differentiates your FPS from others, but why are the random changes there?
     
  6. chrispcr

    chrispcr

    Joined:
    May 25, 2015
    Posts:
    2
    @sicga123 I was actually thinking about that, but I would use a collision box on the door and use some method to check to see if the player is looking through the door. For example use isVisable to check if the doorway is on the screen, then use raycast to check that nothing is blocking the door, and if the player is actually looking through the door. If the player is, then show layer 2, if not show layer 1. Or as theANMATOR2b suggested use different cameras. The 2nd way you described is the way I was originally going to do it, but I found out that Unity personal (I think it was basic at the time) didn't allow render textures. So I came up with this idea to get around that limitation. Unity 5 doesn't have that limitation, I may just go back to it, because as this idea works abstractly, it's a little harder to actually implement it.

    @Asvarduil The game is going to be a survival horror game. This idea isn't really a part of core game play, it's mostly to mess with the player. As to why it happens, the going idea at the moment is that the player is on a ship that uses an engine that bends space-time to travel. The antagonist (again at the moment) is going to be the ship's AI, using the engine to bend space-time within the ship. It's going to mostly be used when the player gets use to an area, then things will subtlety change. Hallways will be longer/shorter than you remember them. Doors will open to different places. You thought it turned right, but now it goes left. It will keep you on your toes.

    Like I said this isn't apart of core game play, puzzles aren't going to be built upon this idea, I just thought a dynamic approach would keep the game more interesting. I just wanted to ask because this idea seemed to fly in the face of convention, and that's not always a good thing.
     
    Ryiah and theANMATOR2b like this.
  7. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    You don't neccesarily need render textures, you just need to check the angles the player can see things at, or if the door is shut and the player has to open it then you know the angle the player has to be to do that. If it didn't work perfectly, I mean it does depend on how you capture the image and whether you put AO on it etc, then because your game is already unusual in the approach to doors and portals you would simply put some kind of forcefield looking mask over it. The other thing you have to remember is that if you want a render texture actually looking at the different scene through the door then you will have to load that scene which may delay overall loading times of the game, it might be better to fake it and then just load the ballroom when the player steps through especially now that you have access to previous pro only features. Loading times is still a big bugbear for players and I've found that players prefer numerous loading scenes that take seconds each load rather than 1 loading scene that takes 3 minutes.