# My proposal

- name: Chaewon Lee
- student ID: 20220552
- [URL](https://git.prototyping.id/20220552/homework5)

## Describe the game

```
what does the user have to accomplish? How do you win or lose? What type of interactions are possible?
```

**Orb.io** is a 3D survival game inspired by `.io-style` games, particularly [Slither.io](http://slither.com/io), reinterpreted in a _three-dimensional_ visual environment.

The player controls a glowing sphere moving through a dark space filled with smaller orbs. While the gameplay mechanics are based on classic snake-like systems, the game presents them using 3D rendering and spatial depth.

### Objective

The player's goal is to survive as long as possible while collecting glowing orbs to increase their score and grow in size.

### Core Mechanics

- The player moves continuously across a 3D environment (constrained to a flat plane for clarity and control).
- Small glowing orbs are scattered throughout the space.
- When the player collects an orb, their score increases and their body grows longer.
- The player leaves behind a trail of body segments that follow the head, forming a snake-like structure.
- As the player grows, navigation becomes more difficult due to increased length and space constraints.

### Win / Lose Conditions

- There is no fixed win condition. The game is endless, and success is measured by the player's score and survival time.
- The player loses if:
  - They collide with their own body
  - They hit obstacles or boundaries in the environment

### Player Interactions

The player can:

- Control movement using keyboard (`WASD` or `arrow keys`) or mouse input
- Collect orbs to grow and gain points
- Avoid collisions with their own body and obstacles
- Restart the game after losing

The gameplay loop is simple and repetitive:
`Play` → `Collect` → `Grow` → `Avoid` → `Fail` → `Restart`

The simplicity of the mechanics allows for immediate understanding, while increasing difficulty creates tension and replayability.

## How will the game look like?

```
What are the game elements (e.g. characters, world, interface) and how will they be implemented in code (e.g., modules, classes, objects, functions)? Feel free to use diagrams, flow-charts or any other visual representation to show your plan.
```

The game will feature a dark 3D environment with glowing spheres as the main visual elements, creating a clean and immersive experience.

<img src="environment.png" style="max-height: 300px;">

### Game Elements

- **Player**: glowing sphere with trailing body segments
- **Orbs**: collectible glowing spheres
- **Obstacles**: larger objects that cause collision
- **World**: bounded arena on a flat plane
- **UI**: score, best score, start and game over screens

### Code Structure

The game will be organized into simple modules:

`main.js`  
 ├── `GameManager`  
 ├── `Player`  
 ├── `Orb`  
 ├── `Obstacle`  
 └── `UI`

- **Player**: movement, growth, collision
- **Orb**: spawning and collection
- **Obstacle**: collision handling
- **GameManager**: game state, score, restart
- **UI**: display elements

### Gameplay Flow

![](flow.png)

### Technical Approach

- Built using **Three.js** for 3D rendering
- Movement constrained to a plane for simplicity
- Objects managed using classes and arrays
- Collision detection using distance checks
