Files
osirose-new/world-service
raven ad6ba2c8e6 More work.
Added chat service
Updated packet service to pass the tcp stream around in a Arc type.
Updated character position data to not require multiplying the coords
Added more debug logs
Added an interceptor for gRPC comms with the chat server
Updated build and push script for the chat server changes
2025-06-06 17:52:29 -04:00
..
2025-06-06 17:52:29 -04:00

World Service

The World Service manages the game world state and character interactions in the MMORPG server architecture.

Overview

The World Service is responsible for:

  • Managing character positions and movement
  • Handling map changes
  • Processing character interactions
  • Managing NPCs, monsters, and objects
  • Handling combat and skills

Architecture

The service is built using the following components:

  • gRPC Server: Exposes world management endpoints
  • World State Manager: Maintains the current state of the game world
  • Map Manager: Handles map data and transitions
  • Entity Manager: Manages characters, NPCs, and monsters

Service Endpoints

The World Service exposes the following gRPC endpoints:

GetCharacter

Retrieves a character's world state.

rpc GetCharacter(CharacterRequest) returns (CharacterResponse);

ChangeMap

Handles a character changing maps.

rpc ChangeMap(ChangeMapRequest) returns (ChangeMapResponse);

MoveCharacter

Updates a character's position.

rpc MoveCharacter(CharacterMoveRequest) returns (CharacterMoveResponse);

GetTargetHp

Retrieves an object's current HP.

rpc GetTargetHp(ObjectHpRequest) returns (ObjectHpResponse);

World Data Structure

The world consists of:

  • Maps: Different areas with unique IDs
  • Spawn Points: Locations where characters can appear
  • NPCs: Non-player characters with fixed positions
  • Monsters: Hostile entities that can move and attack
  • Objects: Interactive items in the world

Configuration

The service can be configured using environment variables:

  • LISTEN_ADDR: The address to listen on (default: "0.0.0.0")
  • SERVICE_PORT: The port to listen on (default: "50054")
  • LOG_LEVEL: Logging level (default: "info")

Running the Service

Local Development

cargo run

Docker

docker build -t world-service .
docker run -p 50054:50054 world-service

Integration with External Systems

The World Service integrates with:

  • Database Service: For retrieving and storing world state
  • Auth Service: For user authentication and authorization
  • Character Service: For character data
  • Packet Service: For handling client requests related to the world