Skip to content

Battleship Game#

A strategy-type guessing game between two players.

Introduction#

I am learning new frameworks for both frontend and backend Node.js, then I thought about building a 🔥 battleship game to push myself to get the hang of these frameworks.

It has been almost 2 years since the Covid-2019 pandemic started. Quarantines and lockdowns are implemented in every country and every city across the planet. Everyone has to wear facemasks. Few companies have to stop their operation.

Fortunately, the company I am in allows employees to have a work from home setup. In the new project, my team have what they called Fun Friday, and it is held as a virtual teambuilding or entertainment where co-workers just have fun! 🎉

Battleship

I am learning a new frontend framework, Angular, and a new backend framework, Nest.js, and I need a goal or a project to build to effectively practice what I have learned. And I thought about integrating socket.io as I did in the past with Nine Men's Morries, hence, Battleship!

Website#

Features#

  • Chat
  • AI (against Computer)
  • Local game (same device)
  • Online game
  • Game audio
  • Game variations

Game Features#

Fleet#

  • Classic (5 ships)
  • Russian (10 ships)

Shot variations#

Hit streak#

Each player takes a turn
A player can continue to strike or make a move while the guess hits a part of the opponent's ship. Otherwise, if it's a miss, the player will have to end the turn.

Salvo#

Both players move at the same time for each round and mark targets on the board. The number of marks they can place corresponds to the same number of remaining allied ships that they control.
When both players confirmed their marks, the firing round will commence to hit everything that was marked.

Chain Shot#

Each player takes a turn
A player will mark targets based on the number of remaining allied ships regardless if the guess was a hit or a miss.

Single Shot#

Each player takes a turn and can only mark target positions one at a time. This is the classic way or the very first variation that Battleships were played in board games.

Conclusion#

Battleship game, is a web application I developed as the second Node.js project and deployed online so that people can interact, chat and play with each other or play locally at the same device.

Everyone felt a new experience in our virtual fun Fridays with this game I developed and at the same time, I had applied my knowledge whatever I learned in my Angular and Nest.js training. Especially, the drag and drop feature that Angular Material is not very basic to learn and you really have to use lots of brain cells for both design and logical algorithm on placing and dragging the ships on the board.

I was planning to refactor the code on my first web application Nine Mens Morris but did not have enough time to build the same entertainment, at least for now. Since the original source code is functional and can still be played. However, it is not responsive in mobile view.

With the global pandemic and the idea of fun Fridays virtually, I have to come up with more ideas on web application to be built with these frameworks in Node.js 🧐

It is just only the beginning...

Comments