Saturday, June 16, 2018

Chapter 4 NIM

For the next few months I will be posting Chapter 4 of my "Creating HTML5 Games Using Animate" eBook, which is broken into 8 sections. Once that has been completed, I will post an update for my spelchan.com plans. With my Masters program starting in September, I am not sure how much time I will have to devote to the site so hopefully will have a better idea once this chapter has been finished being posted. I do plan on continuing porting a game a month from Blazing Games to Spelchan.com but may focus on the simpler games. I am planning on blocking out time for both porting and my emulator project but obviously if I need the time for my course work and TA/RA duties then those hours will be sacrificed.

While I have seen this game go by other names, I was introduced to the game as NIM. I have no idea why it was called that, but figured that I would stick with the name I am familiar with. The game is a very simple game where you have a set number of objects. Each turn the players can take from one to three objects. The goal of the game is to be the player who grabs the last object.

Apparently this game has been used within the mathematics of Game Theory to demonstrate certain principles. I have also heard that the game has been mathematically solved and that there is a way of playing the game that will guarantee winning the game. I have not researched either of these things, but readers who are interested in this game may want to do research on these topics.

The game has already been posted on my Spelchan.com site for February (NIM). Here is a screen shot of the game:



This chapter starts out with a look at the design behind the game in the section “NIM Design Overview”. Normally when I am developing games, I focus on the game play and getting the core game working before getting to things such as title screens but for this game I am developing the game in sequence. The ”Title Screen” section then covers the creation of the animated title logo sequence with the “The Play Game Button” section explaining how the start game button was created and how to write the JavaScript to activate the button.


With the title screen out of the way, we need to start work on the game so the “Limiting Layers” section covers the laying out of the playfield in such a way that we don’t need to use 40 different layers for handling the layout. As the game is controlled by the player, the “Player Panel” section covers how the user interface element of the game works. Having buttons to remove gems doesn’t do very much unless you are able to remove gems so “Gem Removal” covers removing gems from the game screen. The removal of gems is refined by adding different game states and a computer-controlled player in the “State of the Game” section. Finally, we have “Winning and Losing” which covers ending the game.

No comments: