Masters of Simfra

A persistent browser-based MMO 4X strategy game backend. Players create empires, accumulate resources over real time, queue buildings and research, build fleets, and dispatch them across a star map. Combat resolves asynchronously through event-driven workflows, and players return later to inspect battle reports and collect returning fleets. The entire backend is provisioned with Terraform and deployed through CI/CD.

Services

Service Role
CloudFront CDN for the browser client (static assets from S3)
S3 Static frontend hosting and pipeline artifact storage
Cognito Player identity, authentication, and session management
API Gateway V2 Player-facing game command API with JWT authorization
Lambda Command handlers, event fan-out, and lightweight simulation logic
ECS Longer-running simulation workers for combat resolution and leaderboard aggregation
DynamoDB Player state, planets, build queues, fleet orders, battle reports, and idempotency records
ElastiCache Hot leaderboard data, sessions, and frequently queried galaxy-map state
EventBridge Domain events for fleet arrivals, battle completion, and notifications
Scheduler Delayed execution of build completion, fleet travel, and research timers
SQS Dead-letter queues and delayed action buffering
SNS Operator alerts and player notification fan-out
AppConfig Live balance values (production rates, build times, ship stats, combat modifiers)
KMS Encryption at rest for all persistent data
Route53 DNS zone for the game domain
IAM Least-privilege roles for Lambda, ECS, and CI/CD
ECR Container image registry for ECS worker images
CodeCommit Git repository for game source code
CodeBuild Builds Lambda packages and ECS container images
CodeDeploy Deploys Lambda functions
CodePipeline Orchestrates build and deploy stages

Architecture

Browser
  |
  v
CloudFront --> S3 (static client)
  |
  v
Cognito (player auth)
  |
  v
API Gateway V2 (JWT authorizer)
  |
  v
Lambda (command handlers) --> DynamoDB (game state)
  |                              |
  v                              v
EventBridge (domain events)   ElastiCache (hot reads)
  |
  +--> Scheduler (delayed actions: build/fleet/research timers)
  +--> SQS (action queues)
  +--> ECS (combat resolution, leaderboard workers)
  +--> SNS (notifications)

The game loop is event-driven rather than turn-based. Resource accumulation is computed from elapsed time. Build queues, research, and fleet travel use EventBridge Scheduler for delayed completion. Combat resolves asynchronously when fleets arrive at their destination, producing battle reports and triggering return-trip scheduling.

AppConfig provides live-ops balance tuning without redeployment. All persistent data uses KMS encryption at rest. Security groups and IAM roles follow least privilege across frontend delivery, authentication, command APIs, simulation workers, and operator controls.

What This Validates

  • Timestamp-driven resource accumulation with correct offline progression
  • Idempotent command handling for player actions
  • EventBridge Scheduler for delayed game events (build completion, fleet travel, research)
  • Asynchronous combat resolution through event-driven ECS workers
  • DynamoDB for high-throughput game state with battle report persistence
  • ElastiCache for hot leaderboard and session data
  • AppConfig for live balance configuration without redeployment
  • CloudFront CDN serving a browser client from S3
  • Cognito player authentication with API Gateway JWT authorization
  • Full CI/CD pipeline deploying Lambda functions and ECS worker images
  • Encryption in transit and at rest across all data paths
  • Cross-service event routing through EventBridge, SQS, and SNS