Zelda with random dungeons!

Show off your games, demos and other (playable) creations.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

Deeper Mysteries

I'm currently pondering how I can expand the sense of mystery in the game. I have already implemented most of the basic Zelda stuff, such as buttons and breakable walls. And I've gone beyond that, and added traps, secret switches and doors. But that is not enough. I want every dungeon to feel mysterious, and right now I don't get that feeling yet.

Extra floors

There's often a lot of unused space in a level, and I think this would excellent to add an extra hidden floor to a level. Extra floors should contain much tougher enemies, and better rewards. I think you should be able to find an extra heart container and/or magic container there. And perhaps you can collect a piece of some legendary weapon. Maybe I can even add magic spells that you can collect here. But that's getting ahead of myself. Because, how do you reach this extra floor?

Image

I've always liked this artwork for the original Legend of Zelda. I like the idea of wandering through this mysterious underground labyrinth, and uncovering some kind of secret tunnel or mechanism. I also liked the idea of statues opening up, or being lifted up to reveal a hidden door. But if I am to add extra floors, then it needs to be something not too obvious. So here's what I've come up with so far, and may implement in the near future:

Second floor entrance

This is a special room that does not show up on your normal map. It spawns adjacent to a secret room (which are also invisible on your map). So its basically two secrets in a row. Once you enter this room, the player is officially on a different floor, and the map now shows only that floor. The entrance itself is hidden from sight, and the player needs to find something first, in order to reveal the entrance. So you'll need to return to this room later, once you've found something in the level. This could be a key or a crystal of some sort. I already have a ton of different keys, so maybe it needs to be something other than a key. It could also be multiple items, that have to be placed in various recesses, in order to reveal the entrance.

Clues

Finding the key(s) to the second floor should be incredibly difficult. But what I could do, is spawn hints that are engraved on dungeon walls. But perhaps you need a special item first, before you can decode the symbols on the wall. Then there's the special hint room, which could perhaps reveal all the locations of secret items that you need to find on your map.

Pressure Plates

Normally the pressure plates that trigger a trap, can be noticed if you have a keen eye. But perhaps the player now needs to find pressure plates that are completely invisible, until you step on them. Once you do, the wall could slide open, to reveal a hidden item.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

Bombs can now be thrown!

I want all weapons to have a charge attack, and it made the most sense to me that throwing would be the logical charge attack of a bomb. So all you need to do is hold the attack button, to pick the bomb up, instead of placing it. Another press of the attack button makes your character throw the bomb in the desired direction. The bomb will not explode while you are holding it. The fuse isn't primed until you actually throw it.

I played a bit of Link to the Past, and it really started to annoy me how cumbersome the controls were with this simple action. I want bomb throwing to be swift and easy to do, with as little unintended mishaps as possible. You need to be able to concentrate on your strategy, and not on trying to get the controls to do what you want. Why should you be forced to first place a bomb, and then pick it up, only to have it blow up in your own hands? That is dumb. Why not lift the bomb up immediately and prime it before you throw it?

Projectiles can have an arc now, and more parameters

I added parameters that allow projectiles to move in an arc, and to bounce if needed. Obviously the vase doesn't bounce when thrown, it breaks. But the bomb does bounce, and does not explode until it times out. So these are two different behaviors that the code now supports. I also wanted the travel distance of thrown objects to be more hard coded, and not rely on FPS. So projectiles now have a maximum travel distance. When you throw a vase or bomb, it will always travel the same distance, regardless of your FPS.

Gateways now spawn

Progress on gateways is a bit slow, due to all the dependencies. But the game does spawn them now. First of all, what are gateways in this game? They are transitions from one floor to the next (within the same dungeon). Earlier I discussed how much empty space is often left when the game generates a dungeon. So I wanted to give any dungeon that uses less than half of the available space, an extra floor. The dungeon creator first looks for all secret rooms, and then attaches the gateway adjacent to it, with another breakable wall (the kind without obvious cracks). If there are no secret rooms, then it just finds a suitable location for the gateway.

The gateway is a room with a large staircase, that teleports the player to a different part of the maze. The gateway does not show up on the map, unless you visit it, because the map only renders the rooms of the floor you are on. So the moment you enter a gateway room, the player is considered as being on the next floor already (even if you haven't gone down the stairs yet). Confusing? Well the reason for this, is because I don't want any of the dungeon items to spoil the secret. So this is why the second floor is not rendered unless you are actually on it. Once you go down the stairs to the next floor, the dungeon items that you've collected so far, still work. So the map still works (and shows all unexplored rooms on that floor) and all the keys also work. But all of the enemies on this floor will be tougher, and there will be better rewards.

Finding the gateway room is meant to be difficult. Initially the large staircase to the next floor will be covered by a large statue. To move the statue, you need to collect 4 crystals, which are hidden in the dungeon. These crystals must then be placed in sockets in the gateway room. So where are these crystals?

Crystals spawn in 4 random rooms in the dungeon, and are hidden in invisible secret alcoves. To open these alcoves, you must find a hidden switch or pressure plate, which opens the alcove. There are no visual clues. But the game does spawn a cryptic wall tablet in the room, that provide a clue to where the hidden switch is located. There's also a hint room which can sometimes spawn in the dungeon, which marks all the crystal locations on your map.

If all of this sounds incredibly difficult to figure out, its meant to be that complicated. The second floors are optional, and are intended to be an advanced secret. You really need to try hard to find them. The game is not going to spell it out. I expect every player to stumble upon this secret eventually, and then it should feel like a big discovery. Because there are powerful items to be found on the second floor, and it even has its own boss fight (which is also very tough).

So what's the progress on this all?

-Gateway rooms: Spawn as intended. One gateway room per dungeon, if there is enough unused dungeon space. The staircase is not functional yet, and neither is the statue covering it. (Awaiting crystal, staircase and statue functionality)
-Crystal sockets: Four of these spawn in the gateway room, but are not functional yet. (Awaiting alcove and crystal-item functionality)
-Crystal items: These still need to be added. I think the hud will also need an icon for them.
-Hint tablets: Four of these spawn in random rooms in the dungeon, but are not functional yet. (Awaiting text box functionality)
-Alcoves: Not implemented yet. Alcoves should slide open to reveal a crystal-item. There should be 4 in total in each dungeon.
-Statue and push objects: I need to implement better collision detection before I add pushable objects. I'm still trying to figure out how to best handle these objects with the current static collision system. I also need to find a way to trigger a statue to slide on its own. Once this goes in, I will also add push blocks to various rooms, as a means of opening doors, and revealing hidden chests.
-Staircase: While warps are already working, staircases are not. I can probably modify the teleport code for this purpose, because the two aren't that different.
-Second floor: Floor tracking is working, but I have not updated the code yet so that it can spawn additional corridors for different floors. So now there's just a gateway, without a floor to go to.
-Hint room: This special room type already spawns (randomly), but it isn't functional yet. (awaiting textbox functionality)
-Text boxes: This is high on my priority list. I need a way for the game to open and close text windows.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

Large boss rooms

The game now generates large boss rooms, if possible. Large boss rooms are the size of 4 rooms, and are preferred over smaller ones. How ever, this does pose some issues with the exact placement of these things. The game first generates a path from start to finish, and then it attempts to go back a room, and use 4 rooms to make one really big room. This can create some issues, when the rooms kind of go in a circle around the exit. Because ultimately this means the boss room replaces two existing rooms. On many occasions, this has lead to a situation where the entrance was directly adjacent to the boss room, or the boss room had more than one entrance (and often one of those completely negated a locked door).

The way to solve this issue is simple on paper. I should simply be creating the dungeon in reverse. I should start by placing the exit, and then place the 4 rooms that make up the boss room, and then continue to generate the rest of the dungeon, and place the entrance at the end. But this means a large overhaul of the code, which I am not looking forward to. Its always annoying to have to redo your own work. On the plus side, if I create the boss room BEFORE creating the dungeon, then the rooms will always go around it. So I'll always have a large boss room, instead of sometimes, which is what I have now.

I'm planning some really massive boss battles, so one room is simply not enough space.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

Image

Large boss rooms and reverse dungeon order
(As you should be able to see in the screenshot, the large boss room now spawns correctly, and also shows up correctly on the mini map. Further more, you can see an overpass being rendered on the mini map.)

So, this was quite a hassle. But I finally have it working as intended. The game now always spawns a large boss room (the size of 4 rooms) adjacent to the dungeon exit. The game also creates the main corridor of the dungeon (finish to start) in the exact reverse order. So it starts with the exit now, then places the boss room, and then builds a corridor of rooms with an entrance at the end.

I left some backup code in there, so the game is still capable of creating a small boss room, just in case something goes horribly wrong. I have not seen the small boss room since this big change to the code. As far as I can tell, the game is always successful in building a large boss room.

To ensure that there is enough space, the exit is always placed one room away from the level limits, both in width and height. This prevents a situation in which the exit is so close to a corner of the level, that it instantly hits a dead end.

Fix to the map screen

I fixed a problem where the map screen was not showing where the treasures are, if you have the crystal ball. This was simply due to a goof in the render order.

Fix to the mini map

The mini map now also shows where an overpass is, just like the full map. This makes navigating the dungeon a bit less confusing.

Warp stone added

I've added a new item to the game, called the warp stone. The warp stone allows you to instantly teleport back to the entrance of the dungeon, or instantly teleport to the dungeon exit, if debug is enabled. This item has two reasons for existing. First of all, it solves a potential blocking issue, when the player jumps down from a balcony, into a row of rooms that are locked (and if you don't have the key, you are stuck). This is an issue I still want to solve in code, but this item is a back up, in case something goes wrong.

Another reason for the item, is to repeatedly test the level transitions. I don't want to play through the entire dungeon every time I want to test the transitions. So this item allows me to instantly teleport to the exit if I'm in debug mode. There's still a couple of problems with transitioning from one dungeon to the next. The game doesn't always fade out correctly. Or the player doesn't spawn in the correct spot, when the next dungeon fades in. This will take a lot of trial and error to sort out.

Crystals added

Crystals are now displayed in the hud, right below your dungeon-items and keys. The player now also has a variable to keep track of these. I've also added sprites for the alcoves, in which the crystals will be hidden. The code for placing tablets has also been fixed, so that it can no longer place more than tablet in the same room.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

Blocks can now be pushed

During level creation, the game now adds a push-block to any room that has the random attribute of requiring a push-block to open a door, or reveal a chest. The doors in that room also become closed trapdoors, and any treasure chests in the room are kept hidden.

This was quite a bit of work. So far, all of my collision has been static, but now I had to add a new object type that can move. I plan to also use this new object class for other interactive objects, such as draggable statues, and the alcoves that I mentioned earlier.

How does it work?

During room creation, the room is checked to see if it deserves a moving block. The game then scans the room template for usable block positions. It looks at all used and unused block positions in the room, and it does not hesitate to replace an existing static block with a push-block.

When the player bumps into a push-block, it checks if the player is pushing hard enough (I keep track of the player's push strength). It then checks if the block is allowed to be moved, and then selects a new location for that block to move to. The update function then translates the object to the new position. Upon reaching its destination, the script fires off an event to reveal any hidden chests, and to open any unopened trapdoors.

For now, a block can only be pushed once, and not be pulled. However, this does mean that the player could trap himself with a block. So eventually I'll have to figure out a way to make pulling objects work as well. To prevent the player from moving through the block while it is moving, I temporarily turn the collision of the destination-tile on, long before the block has actually reached it. So there's double collision at work here. One for the tile, and one for the object itself.

The game also checks if the destination tile isn't occupied. So you can't push the block through walls, or through other blocks. You are also not allowed to push a block, while it is already moving. If I want to allow the player to drag a block around the room, I'll have to translate the player along with the block. I already have some basic code that allows me to turn off the controls of the player, and move him to a specific position without interference. But it will involve a few more checks to get it to work correctly.

I also want to have puzzles were the player must push a block onto a specific tile. This doesn't work at the moment, and I may have to alter the lay out of certain rooms, to ensure that the block can always reach a button.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

Blocks can now be pulled as well

This was a little more tricky, since the game has to check behind the player for obstructions, and then translate the player along with the block. Currently it works, even if the player moves a bit choppy in the process.

Blocks can now be pushed onto buttons

The game now creates rooms where you must move a block on top of a button, in order to open a door, or reveal a hidden treasure chest.

Crystal placement

Four crystals can now be placed in sockets in the secret gateway room, which spawns on each level. This will trigger a large statue to slide aside, to reveal the staircase to the second floor. The part where the statue slides aside, must still be coded. And there currently is not yet a way to obtain the crystals (because the alcoves aren't implemented yet).

EDIT:

Large blocks and statues now slide aside, upon placing the 4 crystals in their sockets. Collision detection is a bit dodgy though.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

Image

Here is a picture of the gateways in action. I've made some changes to the way a gateway to the second floor shows up on your map. In hindsight, it didn't make sense that the gateway room was considered as being on the second floor, when it is the staircase that leads down to the second floor.

So instead, the gateway room only shows up on your map after exploring it, but is still considered as part of the first floor. It is the only room, that doesn't show up on the map, unless visited. Because normally once you grab the map-dungeon item, it reveals every room that you have not explored... except if it is the gateway room. This room is basically uncharted. It is on none of the maps.

In the screenshot you can see how the crystals that you collect, can be placed inside 4 wall mounted sockets. Once you do that, the large statue slides aside, and reveals a staircase. Walk onto the staircase, and you are teleported to the second floor of the dungeon.

Second floor creation

I'm still sorting out a lot of issues with the second floor creation code. The problem is, that with the rest of the dungeon already created, there's a lot of opportunity for unlucky spawns. It needs to find an empty room to place a second treasure room (which is easy), but then connect a large boss room to that room (which is harder). It then needs to select one of the four rooms that make up the boss room, and expand the dungeon from there (this is the hardest part). And then once it reaches the end, it must create the room that you teleport to (bottom picture). The entire process of finalizing a dungeon is pretty simple. But its hard to choose a valid random location, that won't get the crawler stuck on rooms that have already been created for the first floor.

Joypad support

Thanks to the forum's handy search feature, I was able to quickly find out what I needed to know to implement joypad support. The documentation on the wiki is really kind of bare bones. I noticed that the standard joypad code doesn't support my normal USB joypad. It does however support the Xbox controller, so for now I'm sticking to that. The wiki makes no mention regarding what the name is for the trigger buttons on the front of the xbox controller. Right now I'm just using the right bumper for stuff like dodging, but I think right trigger would make more sense.

Also, if anyone reading this is familiar with the Xbox controller. Would using your sword fit the A button, or the X button? Right now it is mapped to "X", because I might use "A" for jumping. And I use "B" for secondary items, and for cancelling menus. Does this make sense? Or is it better the other way around?
User avatar
TheMeq
Citizen
Posts: 56
Joined: Fri Sep 02, 2011 9:56 pm
Location: Nottingham, UK

Re: Zelda with random dungeons!

Post by TheMeq »

Could you not create like a debug for the controller and just print out whatever love detects when a button or trigger is pressed on the controller?

EDIT: Maybe this will hint at what you need to do? They are AXIS instead of BUTTONS: https://love2d.org/wiki/GamepadAxis so you can get the sensitivity ect;
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Zelda with random dungeons!

Post by Imaculata »

I've been looking at that page. But I believe the axis only refer to the left and right thumb stick. There's no mention of the triggers at the front.

But your suggestion is a good one. I'll give that a try, and see if the output tells me what button is being used.
User avatar
TheMeq
Citizen
Posts: 56
Joined: Fri Sep 02, 2011 9:56 pm
Location: Nottingham, UK

Re: Zelda with random dungeons!

Post by TheMeq »

It would make sense for it to be an axis rather then a button considering the triggers on an xbox 360 controller have multiple sensitivities.

This way, love can tell you how much the trigger has been pulled, whereas if it was a button, it would just say whether it was pushed or not.

do a val = love.joystick.getNumAxis() (or getNumAxes as the wiki states), and see if it comes out with 2 (for the thumb pads), or 4 (including the triggers).

Edit: Sorry, it's this instead: axis = Joystick:getAxisCount( )
Post Reply

Who is online

Users browsing this forum: No registered users and 116 guests