• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GM8 - Tips on tunnels

R

Retro_Dude

Guest
Hello everyone, I'm having a small bit of error I could use some tips on.

I'm doing a clone of Hunt the Wumpus for the TI-99 and the only thing left is doing the tunnels. I kind of got it working but once in a while there are parts that block off the tunnels.

My way of handling the generation is: On created, the pieces are placed randomly on the map, and I do a check to see if a compatible part is next to another compatible part, if not they shuffle around randomly until a layout is generated.

I guess I'm looking for hints on a failsafe mechanism so the generation doesn't stop until it's perfect.


Example:
 

NightFrost

Member
Well, you say that every part is randomized until a compatible part has been selected. What should follow is a tunnel system that connects throughout, but you say it doesn't always happen. There must then be something wrong in the code that checks for connections, but since we don't see any code we can only guess.
 

Yal

šŸ§ *penguin noises*
GMC Elder
I guess I'm looking for hints on a failsafe mechanism so the generation doesn't stop until it's perfect.
Could you start with a known working (but trivial) layout, and then randomly move parts around in ways that makes the level less trivial, but don't ruin the perfectness? (I.e., doing it backwards) The problem with pure randomness is that it's random, you won't know if you get a working result after 10 iterations or 10,000,000 iterations... or ever, if the logic is flawed.
 

NightFrost

Member
On another note, I notice that you're using a four-way connection that is actually two separate corridors. If your construction is compeltely random, it is possible to create a layout where one row is constructed out of it in alternating, horizontally-flipped manner, which would completely cut connectivity between upper and lower parts. If your code only considers connectivity of the current tile to adjacent ones (for example in a dungeon constucted horizontally from top left, connectivity to tile above and tile to left) instead of to the entire maze, you cannot avoid potential disconnect as the tile is two separate connections in one tile. There might be algorithms that can construct mazes with such tiles, or it might be possible to modify an existing one to deal with those, but I'm only familiar with the classic perfect-maze style construction with algorithms such as recursive backtracker, using tiles where every entrance to a tile connects to every other entrance on that tile.
 
Top