Skip to content

henrikfalk/Bacteria-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bacteria Simulator

A bacteria simulation minigame - C# OOP in Unity

This is my Unity project for the tutorial "Submission: Programming theory in action" from the mission "Apply object-oriented principles" from the "Junior Programmer " pathway at "Unity Learn".

The goal for this tutorial is to demonstrate knowledge of OOP (Object oriented programming) using abstraction, inheritance, polymorphism and encapsulation.

Link to tutorial: Submission: Programming theory in action

Enjoy!

Regards Henrik

The game

The game simulates the life of different bacteria types in a aquarium. Totally unrealistic and just for fun.

Maybe I should have chosen peaceful fish for the aquarium but I like the idea of something "out of control" is at bit more interesting for at simulation.

The game explores different Unity features and concepts.

Unity concepts

  • Mouse selection using RaycastHit and child gameobject
  • Two cameras (One following GameObject and the other with zoom, rotate and pan function)
  • "Glass" material
  • GameObject highligt when mouseover
  • Switching scenes with (memory) datapersistence (Singleton)
  • Datapersistence between gamesessions (JSON)
  • Use of StartCoroutine()
  • TMPro package (TextMeshPro)
  • Imported models and materials (UV mapped) from Blender
  • FSM (Finite State Machine) for the simulation with UI interactions
  • Particlesystems
  • Custom HDRI Skybox
  • Pause and unpause game (Scaled and unscaled time)
  • Modal windows

Controls in the "SimulationScene"

Keys actions:

  • 'n': New simulation
  • Toggle 'l' for follow a selected bacteria or not (Switching camera)
  • Toggle 'p' or 'spacebar' : Pause or resume running simulation
  • 'q': Stop current simulation. If no simulation is in progress then the game will return to the MainSimulationScene
  • 'Esc' : Quit Follow
  • Toggle 'h': Help
  • 'WASD' or arrow keys: Pan vertical and rotate horisontal

Mouse actions:

  • Left Button : Select bacteria
  • Right Button: Kill selected bateria
  • Scroll Wheel: Zoom in and out
  • Scroll Wheel Button: Pan vertical and rotate horisontal

Development environment

  • Operating system: Manjaro Linux
  • Developer IDE: Unity Editor v2022.3.5f1
  • Editor: Visual Studio Code
  • Version control: GitHub using GitKraken
  • Documentation: Obsidian

Tools and resources

Development status

Current version v0.5.2:

  • Fix: No camera found when quitting simulation if looking at a bacteria

General:

  • Each scene is runnable from the Unity Editor
  • The bacteria are reproducing but the simulation is not balanced yet!
  • Purple bacteria are killing the green and red bacteria
  • The population limit is set to 500 bacteria
  • One detox "pill" removes 25 ppm toxicity
  • The bacteria have a approximate lifespan. When they die, they turn black and falls to the bottom of the aquarium. After a period they dissolves in the water

In development

  • The add food feature
  • Cleanup old inactive configuration code
  • Better light. Maybe user interactive.
  • Solve the problem with the fertility percent
  • Porting to Godot gameengine

Roadmap

  • More efficient way to track and handle bacteria in the simulation
  • Custom event handling to decouple UI elements better
  • View simulation report
  • Move hardcoded values for balancing the simulation to one place
  • Add watershader
  • Add shader for food
  • Internationalization
  • Keyboard navigation in the dialogs
  • Food (Doing something positive!)
  • Gamification of simulation
  • Core game settings like display resolution etc.
  • Port to the gameengine Godot for comparison
  • Create a beautiful UI

Userguide

This userguide is work in progress. At the moment just screenshots.

Main scene

Laboratory

New simulation

Look at bacteria

Prototypes

"SimulationScene"

This is my first prototype to test if I could make bacteria:

My second prototype that controls the bacteria amount to add:

Prototype 3: Status UI element and an "Add Food" feature:

Prototype 4: Bacteria selection and info UI element:

"MainMenuScene"

First UI mockup of the MainMenuScene, which also is the startscreen of the game:

"LaboratoryScene"

First UI mockup of the LaboratoryScene in which you can modify the aquarium environment and the bateria:

About

A bacteria simulation minigame - C# OOP in Unity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published