ProudNet.Eng
WebsiteProud ConsoleLanguage
  • 🌐ProudNet
    • ProudNet Introduction
    • Download and Install
      • How to verify your ProudNet license
      • AMI
    • Project Settings
      • C++
      • C#
      • Mac Xcode
      • Linux
      • Unity3D
        • iOS Build
      • Unreal Engine 4
      • Running the PIDL Compiler
    • Using ProudNet
      • Server and Client
        • Utilization of Server
        • Utilization of Client
      • RMI
        • Utilization of RMI
      • PIDL
        • Utilization of PIDL
      • Event handling
      • Communication messages
      • P2P Communication
        • Using P2P communication
    • Utilization of ProudNet
      • How to use
      • Tips for performance
    • Using DB in ProudNet
      • DB Cache System ver.2
        • DB Cache Theory and Understanding
        • Install DB Cache and Set Up Network
        • DB Cache Server and Client
        • DB Cache usage and application
          • Utilization of DB Cache
      • ADO API
      • ODBC API
    • ProudNet Utility
  • ProudNet Note
    • Technical Notes
      • Main Loop
      • Setting up a server firewall
      • Encryption and decryption
      • What to do in case of an error
      • List of error messages
      • Synchronizing Character Position
      • Client-Server Communication
      • MiniDump (Error Dump System)
      • [Version 1.6] Server-to-Server LAN Communicator
    • Glossary
    • Sample examples
  • 🌐Proud Service
    • Guide for Console
    • ProudChat
      • Download SDK
        • C++
        • C#
        • Unity3D
        • Unreal Engine 4
      • Features in Console
Powered by GitBook
On this page
  • Game database schema for DB cache
  • Prepare the DB cache server
  • Prepare the DB cache client
  1. ProudNet
  2. Using DB in ProudNet
  3. DB Cache System ver.2

Install DB Cache and Set Up Network

PreviousDB Cache Theory and UnderstandingNextDB Cache Server and Client

Last updated 1 year ago

Game database schema for DB cache

The database schema for DB cache can be configured as desired by the user.

However, the following rules must be followed.

  • The RootUUID, OwnerUUID, and UUID fields must be present.

  • When RootUUID, OwnerUUUID, and UUID are specified as Combination PK, it adversely affects search using indexing. Therefore, creating and using each index helps improve performance.

  • Among the above fields, the RootUUID and OwnerUUID are designated as Non-Unique Index, and the UUID is designated as Primary Key.

  • The above field must be in varchar(38) format in MySQL and uniqueidentifier format in MSSQL.

  • The names of the Root table and Child table must not be duplicated.

  • The stored procedure used by the DB cache client and server are automatically added to the game database schema; do not modify or remove them.

Example script for adding 3 required indexes

ALTER TABLE dbo.Gamer ADD CONSTRAINT
 
PK_Gamer PRIMARY KEY CLUSTERED
 
(
 
UUID
 
) WITH( IGNORE_DUP_KEY = OFF) ON [PRIMARY]
 
 
 
CREATE INDEX IX_Gamer_OwnerUUID ON dbo.Gamer
 
(
 
OwnerUUID
 
) WITH( IGNORE_DUP_KEY = OFF) ON [PRIMARY]
 
 
 
CREATE INDEX IX_Gamer_RootUUID ON dbo.Gamer
 
(
 
RootUUID
 
) WITH( IGNORE_DUP_KEY = OFF) ON [PRIMARY]

Prepare the DB cache server

After creating the database schema, you need to create a DB cache server instance. Only one instance of type Proud.CDbCacheServer2 is sufficient between each game server.

Instance
Description

Proud.CDbCacheServer2.New

Creating an instance

Proud.CDbCacheServer2.Start

Execution

  • The connection string to connect to the DB instance is in the form of an ADO connection string, which you can see in the sample.

  • The authentication key of the DB cache server is the data sent by the DB cache client to identify the connection on the DB cache server.

  • When calling Proud.CDbCacheServer2.Start, Proud.CDbCacheServer2StartParameter.m_tableNames must contain the table names defined by the user.

  • While Proud.CDbCacheServer2.Start is running, sp_Get<tablename>Data, sp_Remove<tablename>Data, and sp_Add<tablename>Data are automatically created.

Prepare the DB cache client

Each game server (authentication server, game zone server, lobby server, etc.) must run Proud.CDbCacheClient2.New to create a client instance of type Proud.CDbCacheClient2.

After creation, you must attempt to connect to the DB cache server via Proud.CDbCacheClient2.Connect. The connection attempt is asynchronous and Proud.IDbCacheClientDelegate2.OnJoinDbCacheServerComplete is called when the connection succeeds or fails. The DB cache client internally uses Proud.CLanClient, but since it is a thread pooling method, there is no separate FrameMove.

To disconnect from the DB cache server, destroy the Proud.CDbCacheClient2 object or call Proud.CDbCacheClient2.Disconnect. At this time, the DB cache client calls Proud.IDbCacheClientDelegate2.OnLeaveDbCacheServer.

🌐
Example of a database schema for storing gamer data in an MMORPG