An innovative multiplayer action-RPG platformer where levels are generated from GeoJSON data representing real-world trips. Transform your travels into playable adventures!
- Google OAuth Login: Secure authentication via Google account
- Multi-Character System: Each player can create up to 3 unique characters
- Character Progression: Each character has independent stats, inventory, and progress
- Character Switching: Easily switch between your characters
- Action-RPG Platformer: Side-scrolling platformer with combat, NPCs, and item collection
- GeoJSON-Based Levels: Levels generated from real-world trip data (hiking routes, travel paths, etc.)
- Combat System:
- Simple slash attacks for basic enemies
- Magic spells with elemental requirements for special foes
- Different enemy types: slashable, magical, armored, flying, bosses
- Multiplayer: Real-time multiplayer using WebSockets and MQTT
- Morality System: Killing NPCs increases "evil points"
- Economy: Collect gold, silver, and copper coins
- Buildings: Inns for rest, shops for trading, and special locations
- Dynamic Generation: Coordinates from GeoJSON become platform positions
- Contextual Entities: Properties define enemies, NPCs, buildings, and collectibles
- Duration-Based: Short trips (5 min), long trips (15-20 min), or split multi-level journeys
- Themes: Forest, desert, mountain, snow, and more
- Backend: Django with REST API
- Frontend: Phaser.js game engine with TypeScript
- Real-time: WebSockets (Django Channels) + MQTT
- Data: GeoJSON for trip definitions
- Rendering: HTML divs (replaceable with PNG sprites)
browser-platformer/
โโโ backend/ # Django backend
โ โโโ geojson_platformer/ # Django project
โ โ โโโ settings.py # Configuration
โ โ โโโ urls.py # URL routing
โ โ โโโ asgi.py # ASGI config for WebSockets
โ โโโ game/ # Main game app
โ โ โโโ models.py # Database models
โ โ โโโ views.py # API endpoints
โ โ โโโ serializers.py # REST serializers
โ โ โโโ admin.py # Django admin config
โ โ โโโ geojson_processor.py # GeoJSON โ Levels converter
โ โ โโโ mqtt_client.py # MQTT integration
โ โ โโโ consumers.py # WebSocket handlers
โ โ โโโ fixtures/ # Sample data
โ โโโ requirements.txt # Python dependencies
โ โโโ manage.py # Django management
โโโ frontend/ # Phaser.js frontend
โ โโโ src/
โ โ โโโ main.ts # Entry point
โ โ โโโ scenes/
โ โ โ โโโ GameScene.ts # Main game scene
โ โ โโโ entities/
โ โ โ โโโ Player.ts # Player character
โ โ โ โโโ Enemy.ts # Enemy entities
โ โ โ โโโ NPC.ts # Non-player characters
โ โ โ โโโ Collectible.ts # Coins and items
โ โ โโโ services/
โ โ โ โโโ api.ts # Backend API client
โ โ โ โโโ websocket.ts # WebSocket client
โ โ โโโ ui/
โ โ โโโ UIManager.ts # UI overlay management
โ โโโ index.html # HTML entry
โ โโโ package.json # NPM dependencies
โ โโโ vite.config.ts # Vite configuration
โโโ sample_trips/ # Example GeoJSON trips
โโโ mountain_journey.geojson # Mountain pass adventure
โโโ forest_path.geojson # Forest trail
โโโ desert_expedition.geojson # Desert caravan route
- Python 3.10+
- Node.js 18+
- npm or yarn
- Google Cloud account (for OAuth - free)
- (Optional) MQTT broker (e.g., Mosquitto) for multiplayer
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment file and configure Google OAuth
cp .env.example .env
# Edit .env and add your Google OAuth credentials
# See GOOGLE_OAUTH_SETUP.md for detailed instructions
# Run migrations
python manage.py makemigrations
python manage.py migrate
# Load sample data (enemies, NPCs, items)
python manage.py loaddata game/fixtures/sample_data.json
# Create demo trips from GeoJSON
python setup_demo.py
# Create superuser (for admin access)
python manage.py createsuperuser
# Run server
python manage.py runserverThe backend will be available at http://localhost:8000
Important: You must configure Google OAuth to use the game. See GOOGLE_OAUTH_SETUP.md for instructions.
cd frontend
# Install dependencies
npm install
# Run development server
npm run devThe game will be available at http://localhost:3000
- Login: Click "Sign in with Google" to authenticate
- Create Character: Create your first character (you can have up to 3)
- Select Character: Choose which character to play
- Pick a Trip: Select from available GeoJSON-based journeys
- Start Adventure: Begin your journey!
- Arrow Keys: Move left/right
- Space: Jump
- Z: Slash attack (melee)
- X: Magic spell (costs mana)
- C: Interact with NPCs
- Create Characters: Up to 3 characters per Google account
- Switch Characters: Return to character select to change characters
- Independent Progress: Each character has separate stats, inventory, and progression
- Delete Characters: Remove unwanted characters to make room for new ones
- Navigate Platforms: Jump across platforms generated from trip coordinates
- Combat Enemies: Use slash attacks or magic based on enemy type
- Collect Coins: Gather gold, silver, and copper
- Interact with NPCs: Talk to merchants, innkeepers, and quest givers
- Visit Buildings: Rest at inns, trade at shops
- Complete the Journey: Reach the end of the level
- Track Progress: Your character's progress is automatically saved
- Slashable: Defeated with basic attacks
- Magical: Require magic spells
- Armored: High defense, take reduced damage
- Flying: Airborne enemies
- Boss: Powerful end-level challenges
- Player: Character stats, inventory, currency, morality (max 3 per user)
- Fields:
user(ForeignKey),character_slot(1-3),is_active
- Fields:
- Trip: GeoJSON data, difficulty, theme, duration
- Level: Generated level segments with platform data
- Enemy: Enemy templates with stats and weaknesses
- NPC: Non-combatant characters with dialogue
- Building: Inns, shops, towers, etc.
- Item: Weapons, armor, potions, spells
- PlayerInventory: Player's collected items (per character)
- LevelInstance: Active multiplayer sessions
- LevelProgress: Player completion tracking (per character)
Create a GeoJSON file with:
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[longitude, latitude],
[longitude, latitude],
...
]
},
"properties": {
"name": "Your Trip Name",
"description": "Description",
"difficulty": "easy|medium|hard|expert",
"estimated_duration": 10,
"theme": "forest|desert|mountain|snow",
"background_story": "Your story here",
"enemy_distribution": {
"slashable": 50,
"magical": 30,
"armored": 15,
"flying": 5
},
"npc_encounters": [
{
"type": "merchant",
"location_index": 3,
"name": "Trader Bob"
}
],
"buildings": [
{
"type": "inn",
"location_index": 5,
"name": "Rest Stop"
}
]
}
}-
Upload via Django Admin:
- Navigate to
http://localhost:8000/admin - Go to Trips โ Add Trip
- Paste your GeoJSON data
- Fill in metadata
- Save
- Navigate to
-
Generate Levels:
- In admin, select your trip
- Click "Generate Levels" action
- Levels will be created automatically
-
Or via API:
curl -X POST http://localhost:8000/api/trips/ \ -H "Content-Type: application/json" \ -d @your_trip.geojson curl -X POST http://localhost:8000/api/trips/{id}/generate_levels/
POST /api/auth/google/login/- Initiate Google OAuthPOST /api/auth/logout/- Logout userGET /api/user/me/- Get current user info
GET /api/characters/- List user's characters (max 3)GET /api/characters/active/- Get active characterPOST /api/characters/create/- Create new characterPOST /api/characters/{id}/activate/- Set active characterDELETE /api/characters/{id}/delete/- Delete character
GET /api/trips/- List all tripsGET /api/trips/{id}/- Get trip detailsPOST /api/trips/- Create new trip (requires auth)POST /api/trips/{id}/generate_levels/- Generate levels
GET /api/levels/- List levelsGET /api/levels/{id}/- Get level detailsPOST /api/levels/{id}/start_instance/- Start multiplayer instance
GET /api/players/- List playersGET /api/players/{id}/- Get player detailsPOST /api/players/{id}/rest/- Rest (restore health/mana)POST /api/players/{id}/add_currency/- Add coinsGET /api/players/{id}/inventory/- Get inventory
GET /api/enemies/- List enemy templatesGET /api/npcs/- List NPCsGET /api/items/- List itemsGET /api/buildings/- List buildings
Note: Most endpoints require authentication via JWT token.
WebSockets are configured by default via Django Channels. Multiple players can join the same level instance.
For advanced multiplayer with external MQTT broker:
-
Install MQTT Broker:
# macOS brew install mosquitto brew services start mosquitto # Ubuntu/Debian sudo apt-get install mosquitto sudo systemctl start mosquitto
-
Configure Backend: Edit
.env:MQTT_BROKER_HOST=localhost MQTT_BROKER_PORT=1883 -
Enable MQTT in Django: Uncomment in
game/apps.py:from .mqtt_client import mqtt_client mqtt_client.connect()
Currently, entities are rendered as colored divs. To use PNG sprites:
-
Add assets to frontend:
frontend/public/assets/ โโโ player.png โโโ enemy_slime.png โโโ npc_merchant.png โโโ platforms/ -
Update entity classes: In
Player.ts,Enemy.ts, etc., replace:this.sprite = scene.add.rectangle(x, y, 30, 40, 0x00FF00);
With:
this.sprite = scene.add.sprite(x, y, 'player');
-
Preload assets: In
GameScene.tspreload():this.load.image('player', 'assets/player.png');
- Create in Django admin or via API
- Update
Enemy.tscolor mapping - Add to level generator in
geojson_processor.py
# Backend
cd backend
python manage.py test
# Frontend
cd frontend
npm test- Backend: Follow Django best practices
- Frontend: TypeScript with Phaser.js patterns
- GeoJSON Processing:
geojson_processor.pyhandles conversion logic
- Boss battles at level ends
- Quest system with objectives
- Crafting system
- Player-to-player trading
- Leaderboards
- Mobile support
- Real sprite assets
- Sound effects and music
- Save/load system
- Achievement system
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - feel free to use this project for learning, experimentation, or building your own trip-based games!
- Check Python version (3.10+)
- Ensure virtual environment is activated
- Run migrations:
python manage.py migrate
- Check Node version (18+)
- Clear node_modules:
rm -rf node_modules && npm install - Check if backend is running on port 8000
- Run
python setup_demo.pyto load sample data - Check Django admin for trips
- Ensure
is_active=Trueon trips
- Ensure Django Channels is installed
- Check that ASGI application is configured
- Verify WebSocket URL in browser console
For questions or issues, please open a GitHub issue or contact the development team.
Transform your real-world adventures into epic platformer journeys! ๐บ๏ธ๐ฎ