Fun Splash!

A Browser-based 3D Aquarium Game

An Openprocessing Sketch of 'Fun Splash'- a 3D Aquarium Game

  • Work Type: Creative Coding Course Project
  • Duration: 4 Weeks
  • Categories: Games Development

About the Game

‘Fun Splash’ is a browser-based 3D Aquarium Game. In this game the user is able to buy fish, feed them, clean the tank and earn money over time. This game is time based so if the fish are not fed beyond a certain amount of time they die. Over time the cleanliness of the tank also changes making the tank water darker.

Game Development

The game uses local storage to keep track of some variables and read them back into the game when the game is played on the same machine and browser. I am storing the time at which the game was first played on a computer and saving it in local storage. Similarly, I am also keeping track of fish count and some other variables such as the type and state of fish.

I created this game in p5.js and used two libraries; WebGL and DOM.

DOM library is used for the UI elements of the game. The game has a shop screen which displays two fish types and buttons to buy those fish. When one of the buy fish button is clicked user either sees a confirm purchase screen or an insufficient funds screen depending on how much coins the user has.

Using Object oriented programming principles various classes were implemented for the development of this game. A message class was created to display a message about insufficient funds and an 'OK' button which closes the message screen. A confirm Screen class was implemented to display a purchase confirmation screen with two buttons; 'Yes' and 'No'. 'Yes' button subtracts the coins, increases fish count and adds a new fish to the aquarium while the 'No' button closes the confirm screen and cancels the purchase.

A StatusBar Class was implemented to display the top bar with fish count, coins count, happiness state and cleanliness state of the tank. StatusBar also displays a bar at the bottom with three buttons; shop, food and clean.

The values of cleanliness and happiness variables depend on the time passed since the last time user cleaned or fed the fish. Currently cleanliness level decreases after every 5 seconds and happiness decreases after every 10 seconds (the shorter time durations are used for testing/debugging purposes). Coin regeneration is based on time. The user gets 20 coins every 3 minutes.

The game code is available on Openprocessing: Link to Openprocessing sketch.