Testing the PLG

Testing the PLG

Before I get into the testing section Progress on the tasks remaining


  1. 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. DONE
  2. Fix some conditions in chance the quarter can not find a theme room or it the two theme rooms are too close. *I have decided to ignore this and come back to it if i have time after the documentation.
  3. Place the furniture , loot and enemies into the level.
  4.  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. DONE
  5.  Store the seed number, the number of tiles used, the  distance to reach the exit and the exit room location DONE
So tomorrow I start working on placing the enemies and loot into the level.

Testing
Today I ran the PLG in a sequence of 40.
I have also added 3 functions at before the PLG machine set is set to finished.
All these functions store data I thought were important to make my case and demonstrate the randomization of the program.
  • RecordLevelDetails() stores the number of tiles and the distance from the shortest path from start to exit.
  • RecordExitLocation() stores in a file the location of the Exit room in the form of a Vector3.
  • RecordScanPoints() Scans the entire level in steps of 5 in width and length. At each point if the raycast his then a list adds the value 1 if it does not hit the listA stores the value 0. While in the  two other functions we add a line of data to the files with append, for RecordScanPoints() we load all the points into another listB, we add the values from listA to list B and rewrite the file. For the example of 800*600 level size in steps of five there are 4800 points.
To display these two results I created two separate scenes, this could be included in the same scene, but I prefer to keep them separate. Since this code is not needed in the creation.
So Scene "Testing Exits" on play displays the location of each exit point recorded, to achieve this it read the file with the exit points and converts the string into a Vector3 (the code to convert the string to vector was taken from (https://answers.unity.com/questions/1134997/string-to-vector3.html).
In the inspector you can see how many exits were recorded and are displayed.



For the testing points I use a different method, the scan point list has 4800 lines, each line represents one of the points scanned, its value is the sum of times there was a room occupying that point. 
First I read  the file and with two for statements , one for the width and one for the length I convert those points into Vector3  x,1,z values, in another list i store the integer value. since I will displaying all the points hit I need to differentiate  them by color thats' were we use the integer value of each point. As I am storing these values i also store the maximum value, for this example the maximum value is  62, so we set 62 as 100%  and 20%   is 62*0.2.
I use four conditions to change the colors in the gizmos.

 if (value > (int)(MaxValue * 0.2f))
            DisplayColour = new Color(0, 0, 1, 1f);

        if (value > (int)(MaxValue * 0.5f))
            DisplayColour = Color.yellow;// new Color(1, 1, 0, 1);// DisplayColour = new Color(0.67f, 0.17f, 0.77f, 1);

        if (value > (int)(MaxValue * 0.7f))
            DisplayColour = Color.red; // new Color(1, 0, 1,1f);// DisplayColour = new Color(0.97f, 0.01f, 0.53f, 1);

        if (value > (int)MaxValue * 0.85)
            DisplayColour = Color.black;

and for demonstration purposes i display the color coding in debug
        Debug.Log("Less than 20%-White");
        Debug.Log("Between 20%-50%-Blue");
        Debug.Log("Between 50%-70%-Yellow");
        Debug.Log("Between 70%-85%-Red");

        Debug.Log("Between 85%-100%-Black");

for the values tile count and exit to star distance I will import those values into excel.




Comments

Popular posts from this blog

Player stats and brightness.

More work done on the interface, saving data.