Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/kenzz55/ue5-iocp-mmo-server/llms.txt

Use this file to discover all available pages before exploring further.

The C++ IOCP GameServer reads two runtime configuration files — Database.ini and Redis.ini — before opening its listen socket. Everything else that shapes server behavior is baked into Common/Config.h as constexpr values and takes effect only after a recompilation. This page documents both layers so you can tune the server for your environment without hunting through header files.

Database.ini

Copy Database.example.ini to Database.ini in the same directory as the server binary and fill in your MySQL/MariaDB credentials. The file is excluded from source control by .gitignore.
FieldTypeDefaultDescription
hoststring127.0.0.1Hostname or IP address of the MySQL/MariaDB server
portinteger3306TCP port the database listens on
userstringgameDatabase user the server authenticates as
passwordstringgame_passwordPassword for the database user
databasestringgameSchema/database name to connect to
allow_dev_fallbackbooltrueWhen true, a hardcoded test / 1234 credential pair remains valid even if the database is unreachable. Set to false in any environment beyond local development.
# Database.ini
host=127.0.0.1
port=3306
user=game
password=s3cur3_g@me_pass
database=game
allow_dev_fallback=false

Redis.ini

Copy Redis.example.ini to Redis.ini in the same directory as the server binary.
FieldTypeDefaultDescription
hoststring127.0.0.1Hostname or IP address of the Redis server
portinteger6379TCP port Redis listens on
passwordstring(empty)AUTH password; leave blank if Redis has no password set
databaseinteger0Redis logical database index (0–15)
allow_dev_fallbackboolfalseWhen true, Redis connectivity failures are tolerated during development. Keep false in production.
# Redis.ini
host=127.0.0.1
port=6379
password=r3d1s_s3cr3t
database=0
allow_dev_fallback=false

Compile-time constants (Config.h)

All values below live in the Config namespace inside ServerSolution/Common/Config.h. Changing any of them requires a full rebuild of the server binary.
These constants are evaluated at compile time. Modifying Config.h without recompiling the project has no effect on a running or previously built binary.

Network

ConstantValueDescription
ListenPort7777TCP port the server accepts gameplay connections on
UdpListenPort7777UDP port used for low-latency movement datagrams
Backlog2147483647 (0x7fffffff)listen() backlog passed to the OS
BufferSize4096Default I/O buffer size per operation (bytes)
MaxPacketSize16384Maximum allowed size of a single received packet (16 × 1024 bytes)
MaxEchoPayloadSize4096Maximum payload size for echo packets (4 × 1024 bytes)
RecvBufferSize131072Per-session receive ring-buffer size (128 × 1024 bytes)
SendBufferSize65536Per-session send buffer size (64 × 1024 bytes)
InitialSessionPoolSize1024Number of session objects pre-allocated in the pool at startup
InitialSendPacketBufferPoolSize1024Number of send-packet buffer objects pre-allocated in the pool
InitialRecvBufferBlockPoolSize1024Number of receive-buffer block objects pre-allocated in the pool
WORKER_THREAD_COUNT4Number of IOCP worker threads servicing completion packets
MAX_CONCURRENT_THREADS0IOCP concurrency hint passed to CreateIoCompletionPort; 0 means use the CPU core count

Input validation

ConstantValueDescription
MinLoginAccountLength4Minimum number of characters in an account name
MaxLoginAccountLength64Maximum number of characters in an account name
MinLoginPasswordLength8Minimum number of characters in a password
MaxLoginPasswordLength128Maximum number of characters in a password
MaxChatMessageLength512Maximum character length of a single chat message payload

Session and threading

ConstantValueDescription
MaxPacketsPerSecond100Per-session inbound packet rate limit; excess packets are dropped
MaxSessionJobQueueSize1024Maximum number of jobs queued per session before backpressure is applied
SessionJobWorkerCount4Number of worker threads processing per-session job queues
HeartbeatIntervalSeconds5How often the server expects a heartbeat from each client (seconds)
HeartbeatTimeoutSeconds15Seconds without a heartbeat before a session is forcibly closed

Inventory persistence

ConstantValueDescription
InventoryDbWorkerCount2Number of worker threads dedicated to inventory database writes
MaxInventoryDbQueueSize4096Maximum number of inventory write operations queued before backpressure

Character-state persistence

ConstantValueDescription
CharacterStateSaveBucketIntervalSeconds1.0Duration of each save bucket in seconds; total save cycle = BucketCount × BucketInterval (10 s)
CharacterStateSaveBucketCount10Number of time-slice buckets that spread dirty-character flushes across the save interval
CharacterStateDbBatchSize100Maximum number of character rows written to the database in a single batch flush
CharacterStateDbRetryCount2Number of times a failed character-state batch write is retried before the error is logged and dropped

Game simulation

ConstantValueDescription
GameSimulationTickIntervalMs33Simulation tick period in milliseconds (~30 Hz)
MaxGameSimulationCommandQueueSize65536Maximum number of pending simulation commands buffered (64 × 1024) before backpressure is applied

Movement and AoI

ConstantValueDescription
MaxMovementDeltaSeconds0.05Maximum time-delta accepted for a single movement step; larger deltas are clamped
MovementAoiViewDistance3000.0Area-of-Interest radius for broadcasting movement updates (Unreal units)
MovementAoiCellSize3000.0AoI spatial-hash cell size; equals MovementAoiViewDistance
MovementNotifyIntervalMs100Minimum interval between movement-notification dispatches per entity (ms)
MovementNotifyDatagramBytes1200Maximum UDP datagram size used for movement replication packets (bytes)
MaxMovementReplicationPendingSnapshots65536Maximum number of pending movement snapshots queued for replication (64 × 1024)
MovementMaxWalkSpeed500.0Maximum authoritative walk speed used in server-side movement validation (Unreal units/s)
MovementMaxAcceleration800.0Maximum authoritative acceleration (Unreal units/s²)
MovementBrakingDecelerationWalking750.0Authoritative braking deceleration while walking (Unreal units/s²)
MovementGroundFriction5.0Ground-friction coefficient used in server-side movement integration
MovementBrakingFrictionFactor1.0Multiplier applied to friction during braking
MovementMinAnalogWalkSpeed150.0Minimum speed threshold for analog (stick) movement (Unreal units/s)
MovementInputDeadZone0.01Input magnitude below this threshold is treated as zero
MovementInputTimeoutMs250Milliseconds after which a movement input is considered stale and discarded

Monster AI

ConstantValueDescription
MonsterAoiViewDistance3000.0AoI radius for monster aggro and visibility; equals MovementAoiViewDistance
MonsterAoiRefreshIntervalSeconds0.2How often the monster AoI grid is re-queried (seconds)
MonsterRespawnDelaySeconds30Seconds after death before a monster re-spawns

Combat and load testing

ConstantValueDescription
EnableCombatDebugPacketstrueSend additional debug packets during combat for client-side diagnostics
EnableLoadTestSpawnSpreadtrueDistribute load-test entities across a grid instead of spawning them at a single point
LoadTestSpawnSpacing4000.0Grid spacing between load-test entities (Unreal units; equals MovementAoiViewDistance + 1000)
LoadTestSpawnGridWidth10Number of columns in the load-test spawn grid

Logging

ConstantValueDescription
LogAsyncQueueSize32768Capacity of the async log queue in entries (32 × 1024)
LogWriterThreadCount1Number of background threads consuming the async log queue
LogMaxFileSizeBytes52428800Maximum size of a single log file before rotation (50 × 1024 × 1024 bytes)
LogMaxFiles10Maximum number of rotated log files retained on disk

Metrics

ConstantValueDescription
EnablePerfMetricstrueMaster switch for the performance metrics subsystem
EnablePerfConsoleLogfalsePrint performance metrics to stdout on each interval tick
EnablePerfCsvLogtrueWrite rolling performance metrics to Logs/perf_metrics.csv
PerfLogIntervalSeconds5How often a metrics snapshot is recorded (seconds)
PerfCsvLogPath"Logs/perf_metrics.csv"Relative path of the CSV metrics output file
EnablePrometheusEndpointtrueExpose a Prometheus /metrics HTTP endpoint
PrometheusHttpPort9108Port the embedded Prometheus HTTP listener binds to

Port summary

PortProtocolPurpose
7777TCPClient gameplay connections (IOCP session layer)
7777UDPLow-latency movement datagram channel
9108HTTP (TCP)Prometheus /metrics scrape endpoint
Ensure your firewall or cloud security group allows inbound TCP and UDP on 7777 from game clients, and restricts port 9108 to your Prometheus scraper only.

Build docs developers (and LLMs) love