top of page

Internship - Week 7 - Final Details

Hey there,

This week we will be implementing the last details to finish our generator. First we will see how we can generate doors between the roads and rooms. It would be nice if we could actually enter the rooms we created. Then we will find a way to remove any roads that dead end. Finally we will put a wall around all the roads to finish the generator.

Image 1. final result of the completed generator.

 

Door generation

This is quite simple, actually. Lets define the steps, necessary to get our doors in the right place.

  • Check every wall tile for each room.

  • Detect if the wall tile is a suitable tile(not a corner tile) to place a door.

  • Detect if the tile is connected to a road.

  • Place the door.

Three out four steps should be relatively easy, only step 2 could give us some problems. Lets take a look at what each step does exactly.

Image 2. Showing the door creation steps.

Doors can only be created if the connected walls(image 2.3) are in one line. It does not matter if this line is horizontal or vertical. If you look at image 2.3 you can see that there are 2 tiles being searched. For the tile with number one, the connected walls are in one line. The connected walls for number two, on the other hand, are not in one line. This means that we can only create a door at the tile with number 1.

There is one more requirement besides, having the connected walls in one line. The tile being searched should be connected to a road tile. All wall positions where a door can be created, can be seen in image 2.4.

Now we have a way to walk from room to room and actually enter them.

 

Removing dead ends

Dead ends do not serve a purpose in the current generator, this is why we will be removing them. Lets define the steps like we did for the door generation.

  • Check every road tile on the map.

  • Detect if there are only neighboring tiles in one direction.

  • remove current tile and move to the neighboring road tile.

Take a look at image 3 and see the steps at work.

Image 3. Showing the steps for removing dead end roads.

Image 4 shows the final result between a map with dead ends and a map without dead ends.

Image 4. with dead ends. map without dead ends.

 

Wall creation

Creating walls for the roads is very simple. You check the neighbors for every road tile on the map. when a neighbor tile is an abyss tile. Change the tile to a wall tile. Now you have walls around your roads.

Image 5. Without walls. Roads with walls.


Featured Posts
Recent Posts
Archive
Search By Tags
No tags yet.
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

Lars Temmink

Game Programmming Portfolio

bottom of page