Prototype Development: Week 2

This week there were 2 main things that I introdcued to my prototype that I felt expanded the idea to a basic game using the foundation that I had created in the previous week to demonstrate the potential of the prototype.

The first was a time system which is an essential to a simulation oriented mechanic like this; I started by tracking the amount of frames that had been rendered for a basis for the time system. Next I had to make the date into a readable format, so I added a variable for years and months and had an array with the month names, these would increase every certain amount of frames passed which was done in a function that would be called every now and then in the render function. The final step was to create speed option so that players can speed up and pause the time, these would become more useful during the second feature that I added, but with the time features all finalised, I could move on to the more major feature that I planned.

The final part of my prototype was to create a money system, where players would spend money to build and upkeep buildings, but would get income from tax. Adding the spending was a fairly easy task, with a few lines a and variables it was working smoothly, I also made the bulldoze tool give back half the cost of the building demolished too which was a few if else statements. For income I used the date system as a basis were money would be given or taken away at the turn of a month, so I simply made that function call a function that calculated the income for a month with different types of buildings contributing differently to the value.

With all these new features, I had to re-arrange the UI so that it was readable and not cluttered and added a simple tutorial for understanding the income mechanics. The end result of my prototype looked like this:

The UI is something I will have to make minor tweaks to in accordance to the testing hardware since it is hard-coded which changes location based on monitors, but since it is a prototype and only a minor issue, I decided not to fix.

Overall I think my prototype when very well, I managed to achieve my goals that I set out to do with very few setbacks, Though there are some bugs, I don’t beleive they’ll impact the user negatively. Making a prototype is something rather new to me so getting a chance to practice making one will be a good learning experience and I hope to learn throught the testing that will commence too.


Protoype Development: Week 1

The start of my city builder prototype was to get a tilemap in place so players had a map to work with, plus a tile-based grid makes it easier to build a more ordered city. Getting the tilemap logic in place was fairly easy and was drawing coloured tiles fine, but it had some issues loading images, after some digging I found out that I needed a load handler in place to handle image drawing, so a few alterations made the code work with images too, so with this in place, I could work on the main focus of the prototype.

The building mechanics were initially simple to implement, I started with some event listeners for mouse clicks and created a boolean to check if a player is building, to test this I created a road and house asset that would change a tile on the map to the item that the player selects with a button on the webpage. Of course I needed the boolean to activate something, so I created an if statment in the render function that calls a building function if the boolean is true which did the trick for basic building.

The tricky part came when creating roads facing different directions, I originally planned to create a unified ‘smart’ road tool, but after some trial and error, it seemed out of this projects scope to implement well so I scrapped this system in favour of a rotate key that rotates pieces that the player chooses. With this I implemented an icon on screen that shows the current rotation to improve the user experience.

The final piece of the main building mechanics was a click-drag to make building lots of things easier, this was easier than I anticipated as it only required another event handler and a couple of changes to where the building boolean is called. Since this was rather quick, I used my extra coding time I allocated to adding some more buildings to the game which was some simple copying of code and drawing some new assets which gave the player some more choices when making their city.

With the main things in place this week, I can focus some more on polishing and adding some challenge elements next week to finalise the prototype, so I am pleased with my progress this week.