Day 5 - Progress

Challenge Design
Today, I planned to first work out the challenge designs and I wanted to translate them into flow charts before I started programming, when I noticed the overscope. All these different types of challenges, where in fact small mini games within my simulation. Which isn't really achievable within a week time. So I decided to redesign my challenges in a way that is do-able within the time limit. My new design excists of one type of challenge, one implementation script, one general design. But with different types of input, variables and slightly different gameplay. This new design can be interpreted as one generic design with alternate levels. This will probably result in a more efficient code and more content.

Challenge System
Now that I know I want to design my challenges, it's time to create the challenge system. I've created a flowchart to have a clear image of what I need to code (see image below).
















For the challenge system I first created a challenge test scene with a canvas. I set the canvas render mode to Screen Space - Camera, because I want the UI elements to adjust to a specific camera in the scene, the monitor camera. Next I created a monitor camera with orthographic view, just like the monitor cam in the previous test scene. Then I attached the new monitor camera to the canvas.

Before I build my challenge system I want to have a basic UI which simulates a windows computer. Therefor I'll create a desktop with a task bar. The task bar will always show when the player views the monitor, therefor I have to place it and know its size and placement, before implementing the challenges.

Desktop UI
I want to create a deskop, so it should give the idea of using a realistic windows computer. For now I won't create a working windows menu, but I will create the wallpaper, the task bar and dynamic local date and time. Those other details might be picked up in the polishing stage. 

First I wrote the synamic date and time script. I used System.DateTime.Now to retrieve the local time and date information. This was an easy step, but it's display didn't look anything like the Windows date and time. So I manually adjusted the data when necessary. 

System.DateTime.Now.Minute returns its minutes in integers of either one or two digits. But when it's 21:07 I don't want it to say 21:7. So I made an if statement to check if the int is lower than 10, if so I add a string, saying "0" in front of the int. Also I had to add the string ":" inbetween hours and minutes. 

Next was the date, this was a little more complicated. The DateTime Month returns an integer, but my Windows date stamp says "Jun". To solve this I created a pair key value dictionary to pair the returned integers with a string linked to the month's number. E.g. {6, "Jun"}

The DisplayTime() and DisplayDate() functions get called in Update. But I didn't want the time and date to be updated each frame. This is not necessary. So for time I stored the previous minute value and for date I stored the previous day value. In update I check if the previous minute is not equal to System.DateTime.Now.Minute before I call the function and for the date I check if the previous day is not equal to System.DateTime.Now.Day before I call the function. (see image below)














Once I created a dynamic time and date, I added a canvas to the scene. Next, a panel which displays the Windows wallpaper. On top of it (or actually below in the draw hierarchy) I placed the task bar. Then I created two GUI texts, one for the time display and the other for the date display. I attached the text boxes to the script and called their functions to display date/text in the appointed boxes. As you can see in the image below the time and date in the UI are equal to the computer's local time and date.























Challenge System
Back to the challenge system! This system excists of a framework for future challenge implementation and should have all basic functions a derived class needs to inherit. It's a large part of my project and I'll be breaking it up into steps.

If you look at my flowchart (first image of this post) you see the first box you come across is a level check. In order to create and check the player's level I'll create save and load data by using playerprefs. The player's level will increase after completing a challenge. For testing purposes I hard-coded the level incrementation by pressing F9 and the last level by setting it to a variable (which will later be changed to array.length).

Next I'll be creating a countdown timer, this will be the time limit for the player to solve the challenge. Also I'll create a count system for the available test runs, these will be the amount of chances the player has to solve the challenge.  The countdowntimer starts when the player starts a challenge, once the player solved the challenge the timer stops and when the player starts a new challenge the timer resets. The attempts counter checks if the player has any attempts left before giving an answer to the solution. I set the attempts counter to three and when the player gives the wrong answer it will decrease by one. When there are no attempts left, the game is over. For testing purposes I used random number generation, with a 50/50 chance, to create a right or wrong answer.

This is how far I got today, tomorrow I'll probably complete this part of the production stage.

Comments