The 2D World Simulator is a desktop application developed in Python that simulates a virtual world composed of various organisms, including animals and plants. Each organism exhibits distinct behaviors and interactions within a two-dimensional grid environment.
- Dynamic World Structure: The simulation operates on an NxN grid where each cell can be occupied by a single organism.
- Diverse Organisms: Includes a variety of animals and plants, each with unique behaviors and characteristics.
- Turn-Based Mechanics: The simulation progresses in turns, with each organism performing actions based on its species-specific behavior.
- Collision Handling: Manages interactions between organisms, such as movement, reproduction, and combat scenarios.
-
Wolf
- Behavior: Moves to a randomly selected neighboring cell. In case of a collision with another organism, the one with higher strength prevails.
-
Sheep
- Behavior: Similar to the wolf but with different strength and initiative values.
-
Fox
- Behavior: Moves to a neighboring cell only if it's not occupied by a stronger organism.
-
Turtle
- Behavior: Has a 75% chance to stay in the same place. Reflects attacks from animals with strength less than 5; the attacker returns to its previous cell.
-
Antelope
- Behavior: Moves two cells instead of one. Has a 50% chance to escape from a fight by moving to a free neighboring cell.
-
Human
- Behavior: Movement is controlled by the player using arrow keys. Possesses a special ability called "Immortality" which can be activated with the 'End' key.
-
Grass
- Behavior: Attempts to spread to a random neighboring free cell.
-
Sow Thistle
- Behavior: Performs three attempts to spread in each turn.
-
Guarana
- Behavior: When consumed by an animal, it permanently increases the animal's strength by 3.
-
Belladonna
- Behavior: Kills any animal that eats it.
-
Sosnowsky's Hogweed
- Behavior: Kills every animal in its immediate neighborhood except the cyber-sheep. Also kills any animal that eats it, apart from the cyber-sheep.
For more detailed information about the game, refer to the Instruction.pdf
file included in the repository.
To add organisms to the grid:
- Select the desired organism by clicking on one of the pink tiles.
- Click on the grid tiles where you want to place the selected organism.
- Arrow Keys: Move the human character in the desired direction and proceed to the next turn.
- End Key: Activate the human's special ability, "Immortality," and proceed to the next turn.
- Home Key: Save the current game state.
- Insert Key: Load a previously saved game state.
- Escape Key: Exit the game.
- M Key: Play background music.
To run the program:
-
Download the Repository:
- Click on the green "Code" button and select "Download ZIP."
- Extract the contents of the ZIP file.
-
Install Required Libraries:
- Ensure you have Python installed on your system.
- Install the necessary libraries using pip:
pip install pygame tkinter pillow
-
Run the Program:
- Navigate to the extracted folder and run
main.py
:python main.py
- Navigate to the extracted folder and run
Music from Minecraft. Icons inspired by Minecraft.