Search Unity

How could I implement Locations in my Text-Adventure Game?

Discussion in 'Game Design' started by DerMax01, Apr 16, 2021.

  1. DerMax01

    DerMax01

    Joined:
    Apr 5, 2021
    Posts:
    1
    Hey, I am working on a Text-Adventure Game. For now, I want to implement Locations into my Game, something like a Map. So I think I could make a Room-like System with the Asset Menu by creating multiple Assets with an exit points, which connects every Location. But maybe anyone can think of a better idea for solving this.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Typically, each room would have some unique identifier (could be a number, or it could be a short name). Then for every room exit, you simply assign the identifier of the room that leads to.
     
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    A text adventure game was one of the first programs I made and every once in a while I think about how I would approach it with a modern game engine. With Unity I would fully embrace the concept that components are what define the objects in your world.

    What defines a room? An item? An actor? All of them have functionality that they share while having functionality that is unique to them. In fact nothing inherently prevents them from sharing some functionality and some games have rooms, items, and actors that blur the lines between each other.

    My approach would be to have all three be GameObjects in the world. Where the object is located in the world and its relationship to other objects would be handled by what it is the child of. If I wanted an item in a room, for example, I would simply have the item be the child of the room. Creating a room would be as simple as adding a component that handles exits and the locations they lead to.

    Zork II has a series of orbs. Each orb is both an item and a room. Implementing them with the above method would be as simple as attaching an Exits component to the orb. If the player (or other actor) were the child of the orb then they would be inside the orb as if it were a room. If the player and the orb were both children of the same parent then the player could simply pick up the orb like any other object (assuming no components prevent it).
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Room are basically container