Monday, April 3, 2017

Game Development: Text Based Game "Number Wizard"

The online course I've taken were introducing the feature available in Unity using a very simple text based game. The game was called "Number Wizard".

What I learnt from this game were:

  1. How to change the layout of Unity's panels.
  2. Unity's folder structure.
  3. Unity's scene and objects.
  4. How to print logs into Unity's console using print() method.
  5. Unity's game application flow.
    • We can attach a script to an object.
    • That script inherited MonoBehaviour
    • It has Start() method that will be called once in the beginning
    • There is Update() method that will be called once per frame.
  6. How to get input from keyboard.

While all those points are very obvious and basic, I think it is a good start to get to know them all in the beginning of this journey. So it will be a good foundation for me to go faster later.

About Number Wizard

Number Wizard is a game to guess player's number in mind.
Here is the game play of the game:

  1. Player just need to think about one number between 1-10000.
  2. The game will guess with a number.
  3. The player need to answer whether that guess higher, lower, or equal.
  4. If it is still not equal, the game will guess again until find the number of the player have in mind.

The Game implementation

The player can interact with the game using up arrow (tell the guess is higher), down arrow (tell the guess is lower), or space (tell the guess is equal). The game will end if the player press space key. The complete implementation of player's interaction can be seen in line 29-44.

To find the number, we need to implement binary search by calculating the middle value of min and max bound as you can see in FindMid() method in line 64.

You can see the complete project in this  repository of mine:

Please leave comment and suggestion if you find this post interesting. Thank you :)

1 comment:

  1. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Personal Installment Loans
    Title Car loan
    Cash Advance Loan


Text Editor Tips: Some Useful Brackets Extension

Brackets  is an open source and free-to-use text editor and primarily being used by web developers and designer. I mainly use Brackets for d...