Skill Tree Activated

The quest to become an indie game developer

#100DaysOfCode#100DaysOfGameDevC#CodingGame DevIllogical BaconPanic RoomScript-writingUnityVisual Studio

Tile Grid

Day 032 #PanicRoom
R2 Day 002 #100DaysOfCode
Day 097 #100DaysOfGameDev

Rather than overtly defining a house by directly inputting the number of columns and rows that would make it up, I wanted to define a house size by using relative scale dimensions. It would be so much easier, and more relatable, to say a house is 180 feet by 120 feet rather than 54 columns by 48 rows. The former is easy to understand and visualize while the latter is more abstract and leaves too much information out that such measurements would depend on.

To accomplish this, I used my player model to determine an approximate scale based on an average height of six feet and an average width of two feet. This gave me an approximately-scaled size for my floor and wall tiles. Using these dimensions, it was a simple matter of calculating the conversion of real-world scaled measurements into my game-world and determining an algorithm that would handle the math in the background once the desired house size was entered. This takes a lot of guesswork out of the equation and yields structure sizes that will closely resemble the desired dimensions sought out.

Here is my code for the InitialiseGrid function that handles all of this at startup:

Leave a Reply

Your email address will not be published. Required fields are marked *