Skip to content

Repository files navigation

Vortex Arena Banner

Technology Stack

Backend

  • Spring Boot: 3.5.8
  • Java: 17
  • Build Tool: Gradle
  • Database: MySQL 8.0+
  • Architecture: Layered (Controller → Service → Repository → Database)

Frontend

  • HTML5 Canvas for rendering
  • Vanilla JavaScript (no frameworks)
  • CSS3 for UI styling

Project Structure

arena-shooter/
├── src/
│   ├── main/
│   │   ├── java/com/example/arenashooter/
│   │   │   ├── ArenaShooterApplication.java
│   │   │   ├── config/
│   │   │   │   └── WebConfig.java
│   │   │   ├── controller/
│   │   │   │   ├── AuthController.java
│   │   │   │   └── GameController.java
│   │   │   ├── dto/
│   │   │   │   ├── LoginRequest.java
│   │   │   │   ├── PlayerProfileDto.java
│   │   │   │   ├── InventoryDto.java
│   │   │   │   ├── PlayerStatsDto.java
│   │   │   │   ├── StatsUpdateRequest.java
│   │   │   │   ├── InventorySyncRequest.java
│   │   │   │   ├── HealRequest.java
│   │   │   │   ├── KillUpdateRequest.java
│   │   │   │   └── WeaponSwapRequest.java
│   │   │   ├── entity/
│   │   │   │   ├── User.java
│   │   │   │   ├── PlayerStats.java
│   │   │   │   └── Inventory.java
│   │   │   ├── repository/
│   │   │   │   ├── UserRepository.java
│   │   │   │   ├── PlayerStatsRepository.java
│   │   │   │   └── InventoryRepository.java
│   │   │   └── service/
│   │   │       ├── AuthService.java
│   │   │       ├── GameService.java
│   │   │       └── ProfileMapper.java
│   │   └── resources/
│   │       ├── application.properties
│   │       └── static/
│   │           ├── index.html
│   │           ├── styles.css
│   │           └── game.js
│   └── test/
├── database/
│   └── schema.sql
├── build.gradle
└── README.md

Setup Instructions

1. Database Setup

  1. Install MySQL 8.0+ if not already installed
  2. Start MySQL service
  3. Run the database schema:
mysql -u root -p < database/schema.sql

Or manually:

mysql -u root -p
source database/schema.sql

2. Configure Database Connection

Edit src/main/resources/application.properties:

spring.datasource.username=root
spring.datasource.password=YOUR_MYSQL_PASSWORD

3. Build and Run Backend

Using Gradle wrapper:

# Windows
.\gradlew.bat bootRun

# Linux/Mac
./gradlew bootRun

The backend will start on http://localhost:7320

4. Access the Game

Open your browser and navigate to:

http://localhost:7320/index.html

Game Features

Controls

  • WASD - Move player
  • Mouse - Aim
  • Left Click - Shoot
  • R - Reload
  • Q or 1/2 - Switch weapons

Weapons

  • AKM (AR) - High damage, moderate fire rate
  • M416 (AR) - Balanced damage and fire rate
  • UZI (SMG) - Fast fire rate, lower damage
  • UMP (SMG) - Moderate stats
  • Shotgun - High damage, slow fire rate

Items

  • First Aid Kit - Heals 75 HP
  • Med Kit - Full heal (100 HP)
  • Energy Drink/Boost - Heals 40 HP
  • Helmet - Increases protection (Levels 1-3)
  • Vest - Damage reduction (Levels 1-3)

Game Flow

  1. Login Screen - Username/password authentication
  2. Lobby - Customize loadout, view stats, start game
  3. Arena Match - Explore map, fight enemies, collect loot
  4. Pause Menu - Adjust settings, quit to lobby

API Endpoints

Authentication

  • POST /api/login - Login or register user

Game Operations

  • GET /api/start?userId={id} - Start game session
  • POST /api/update-stats - Update player statistics
  • POST /api/sync-inventory - Sync inventory with server
  • POST /api/handle-kill - Record enemy kill
  • POST /api/heal - Update player health
  • POST /api/swap-weapons - Change equipped weapons

Default Test Accounts

Username Password Stats
player1 password123 New player
player2 password123 5 kills, 500 score
testuser test New player

Development Notes

Backend

  • No Spring Security (simple auth for demo)
  • Plain text passwords (educational project only)
  • CORS enabled for localhost development
  • JPA auto-creates tables on first run

Frontend

  • All game logic runs client-side
  • Backend only for persistence
  • Placeholder graphics (colored rectangles)
  • Responsive canvas rendering

Troubleshooting

Database Connection Error

  • Check MySQL service is running
  • Verify credentials in application.properties
  • Ensure arena_shooter database exists

Port Already in Use

Change port in application.properties:

server.port=8080

CORS Issues

WebConfig is already configured for * origins

Frontend Not Loading

Ensure you access via http://localhost:7320/index.html (not file://)

Future Enhancements

  • Multiple map selections
  • Sound effects and music
  • Persistent high score leaderboard
  • More enemy types and behaviors
  • Power-ups and special weapons
  • Multiplayer support

License

Educational project - Free to use and modify

Author

Shadhin Nandi

About

Vortex Arena is a full-stack 2D top-down shooter built with Spring Boot 3.5.8 and HTML5 Canvas. It features a layered architecture to manage MySQL-backed player stats, inventory systems, and real-time arena combat. Explore multiple maps, battle AI bots, and survive using a variety of weapons and healing mechanics.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages