ChrisRx / dungeonfs

A FUSE filesystem and dungeon crawling adventure game engine
BSD 2-Clause "Simplified" License
1.03k stars 29 forks source link

Is it possible to create multiple routes to the same room? #8

Open pintergreg opened 7 years ago

pintergreg commented 7 years ago

I'd like to make a more advanced dungeon and I wonder how it is possible to create multiple routes to a room.

As a directory structure I would create something like this:

.
└── room1
    └── room2
        ├── room3
        │   └── room4
        │       └── room5
        │           ├── room2 -> ../../..
        │           └── room6
        └── room5 -> room3/room4/room5

where room1/room2/room5 is a symbolic link to room1/room2/room3/room4/room5 and room1/room2/room3/room4/room5/room2 is a symlink to room1/room2.

I tried to define this dungeon with the following yaml:

dir:Root:
  description: "A poorly lit hallway proceeds you to the north."
  adjacent:
    - room1
  contains:
    - README
dir:room1:
  description: "you're in room 1"
  adjacent:
    - room2
dir:room2:
  description: "you're in room 2"
  adjacent:
    - room3
    - room5
dir:room3:
  description: "you're in room 3"
  adjacent:
    - room4
dir:room4:
  description: "you're in room 4"
  adjacent:
    - room5
dir:room5:
  description: "you're in room 5"
  adjacent:
    - room2
    - room4
    - room6
dir:room6:
  description: "you're in room 6!"
  adjacent:
    - room5

I know this creates a loop, but makes it possible to write not so linear games. I seems that a room structure like this results an infinite loop in the code as my CPU load jumped to 100% when I tried to mount this test level.

ChrisRx commented 7 years ago

I will try and reproduce and get this fixed. It should be able to do that but I suspect that the logic I wrote to build the tree of directories is not terminating correctly on previously visited rooms in this case. I know it's been a while already so if you have already tracked down the bug, feel free to submit the fix, otherwise I will try and jump on this very soon.