Global Price War 2 - Chat & MicroStorage Sample¶
A sample project demonstrating Beamable's Chat and MicroStorage features through an advanced trading game called "Global Price Wars 2".
In "Global Price War" (GPW), the winners say Buy low, sell high! Finish rich and be top on the Leaderboard..
Features¶
Beamable Features Used
This sample demonstrates integration with multiple Beamable services:
- Chat - Real-time messaging between players
- Connectivity - Player connection and presence management
- Content Management - Game configuration and data storage
- Inventory System - Player item and resource management
- Leaderboards - Player rankings and competitive scoring
- Microservices - Custom server-side business logic
- MicroStorage - MongoDB database integration for persistent data
Architecture¶
The GPW2 project uses a more sophisticated architecture compared to GPW1:
- Client-Server Model: Game logic runs on Beamable Microservices
- Database Storage: Market data and game state stored in MicroStorage
- Real-time Updates: Chat and market data synchronized across clients
- Scalable Design: Supports multiple concurrent games and players
Project Repository¶
The code for Global Price War 2 is available at Chat GPW 2 With MicroStorage Sample Project.
Screenshots¶
| Scene01Intro | Scene02Game | Scene03Chat | Scene04Settings | Scene05Leaderboard |
|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
Project Comparison
There are two repos for the "Global Price Wars" game each with distinct learning goals.
- Chat GPW Sample Project - Simpler project, the
GPWBasicDataFactoryuses random, local data values. - Chat GPW2 Sample Project With MicroStorage - Complex project, the
GPWMicroStorageDataFactoryuses Beamable Microservices and MicroStorage with data values stored in shared database. You are currently viewing the documentation for this project.
Download¶
| Source | Detail |
|---|---|
| Beamable | 1. Download the Chat GPW2 Sample Project 2. Open in Unity Editor (Version 2021.3 or later) 3. Open the Beamable Toolbox 4. Sign-In / Register To Beamable. See Getting Started for more info 5. Set up Docker and Microservices following the Microservices Guide 6. Deploy the MicroStorage and Microservices 7. Open the Scene01Intro Scene8. Play The Scene: Unity → Edit → Play 9. Click the "Start" Button 10. Enjoy! Note: This sample project requires Docker setup for Microservices and is compatible with Unity 2021.3 and later versions. |
Rules of the Game¶
- 1 player starts the game with limited turns
- After the final turn, the game is over
- The player's final score is calculated as
Cash + Bank - Debt - Each turn, the player makes decision to increase the total cash
- Use money in
Cash. Buy items at a low price, Sell items at a high price - Move money into the
Bank. The bank pays interest to the player after each turn - Move money out of
Debt.The debtors charge interest to the player after each turn - Chat with other players to better understand the market price of items
Pro Tip: Sell all owned items before the final turn to increase the final score.
Key Differences from GPW1¶
This advanced version (GPW2) includes several enhancements over the basic Chat GPW project:
MicroStorage Integration¶
- Persistent Data: Uses Beamable MicroStorage for persistent, server-side data storage
- Shared Market Data: All players see the same market prices stored in the database
- Real-time Synchronization: Market data updates are synchronized across all connected players
Microservices Architecture¶
- Server-side Logic: Game logic runs on Beamable Microservices for better security and consistency
- Data Validation: Server validates all transactions and market operations
- Scalable Design: Architecture supports multiple concurrent players and games
Advanced Features¶
- Database Persistence: Game state persists between sessions
- Enhanced Chat: More sophisticated chat integration with game events
- Market Dynamics: More realistic market behavior with server-controlled pricing




