End of week 10

End of Week 10. 



Things week I managed to calculate and display the path from the starting room to the exit. I also calculate the total distance it takes.

The red dots and line indicate the shortest path to the exit.


 As I looked at the path I realized that Some randomization in selecting the next point is needed.
Initially I would just add the available exit points to the list and select one randomly. Then I decided to insert those new exit points (so they are on the top of the list) and then select the First exit from the list. This works smoothly but can create some long corridors. For this reason I decided to still insert the  exits but randomly pick one of the first three. **this now picks up an error if at the start of the creation there are less than 3 exits in the list.**
I added a button in the gui, and keep tweaking the editor to my needs.
Theme percentage and theme were added to the dungeon Piece script. And a new script was created named themes.


There are 4 themes set for the moment. A array of arrays holds the percentage of theme for the adjacent rooms. You will notice that the fire array has more values, this is because we can dictate the steps need reach the main theme room for each theme. this is all done so as we approach to the main theme room the theme itself builds and grows as we get closer.

In the image above I place a yellow gizmo box to indicate the main theme room. you can see in the inspector the room selected next to it has the same theme and its percentage is 30.

How the theme rooms are selected.

I think the level can support 1-2 themes placed in the level, but I intend to make that adjustable but for now it is fixed to two themes every time. I want may two themes to be set apart, So bellow is my algorithm for selecting the two theme rooms.
Scan across the level dimensions and  find the 2 more dense quarters.
Within each of those quarters cast a ray if it hits (its a tile) and the tile type is room or open area store that tile name, if it does not hit repeat.
Pick a random theme[x] and set it to the room and set the percentage to 100.
Store all the tiles connected to our main them tile in List A
Repeat for the number of values we have in ThemePercentageArray[x] of that theme.
{
Copy the values of A to B
clear list A
For all of those tiles in List B
if 
the list has already been used ignore it.
Else 
Apply the theme and percentage
Store all the tiles connected to the tile in a list A
}

I also Placed some conditions in the room generator Editor so the user cannot place the starting room outside the exit.


What is left for week 11
  1. **Put a condition to fix the error when the exits are less than 3.
  2. Work on the seed generator for controlled randomization. 
  3. Place restrictions on all controls in the room generator editor. So you can't place the replaced rooms outside the level and the scan lines.
  4. Fix some conditions in chance the quarter can not find a theme room or it the two theme rooms are too close.
  5. Place the furniture , loot and enemies into the level.
  6. Create a function that will repeat the level creation 500 times.
  7.  Scan the area and store the points that were hit. - this is for demonstration purposes to show how many times that area has a tile placed, to demonstrate how different the levels are.
  8.  Store the seed number, the number of tiles used, the  distance to reach the exit and the exit room location

Comments

Popular posts from this blog

Player stats and brightness.

Testing the PLG

More work done on the interface, saving data.