Databases

From CatchChallenger wiki
Jump to: navigation, search

Access

What server kind need what database:

  • Login server need: login (read in all case, if account automatic creation then read/write), common (all)
  • Master server need: login (read if account automatic creation), base, common (all, read)
  • Game server need: base (read), common (spec), server

Working set

To optimise the database change, performance, the monster/item is split by working set (frequent change but small size), and big set. When the working set is full, the dropped item is destroyed and the monster is transferred to big set (reason: to small free amount to accumulate monster and do grouped transfer).

Requirements

With the actual database structure (version 2, commit: 085281a66ce52232782a0f56e2339fa7070a350c), the requirements are:

  • Search by primary key
  • Search by index on single colomn
  • Search by index on multiple colomn
  • Able to store int, string, blobs

Preferred:

  • Able to work without primary key
  • Able to store 8Bits and 16Bits int, string: fixed and variables size

Not required:

  • Transactions (commit, rollback)
  • Relational (Join, ...)
  • Consistency (The master server lock the globale data linked to the account util the last write is done, then consistency done by the master server)

blob format

High compression mode

Format, see Compression to understand better why:

  • Not multiplex the data, to isolate the incompressible data.
  • Id use as incremental because it unique and into range

Imply:

  • Multiplex at data loading
  • Not problem at data saving due to buffer offset work
  • The offset to store the incremental value need to be as same type as the id
  • The offset to store the incremental value can do integer overflow to decrease the value (maybe can be use as some compression ratio optimisation)
  • Some prefetch optimisation problem, mean slow down.

Then it use NoSQL schema to have a good control on the datas (order, format, ...)

catchchallenger_common

character

allow

List of allow uint8_t resolved by dictionary:

  • 01 (Allow clan)

item

List of:

  • uint16_t item
  • uint32_t quantity

item_warehouse

List of:

  • uint16_t item
  • uint32_t quantity

recipes

List of:

  • bit array: recipe

reputations

List of:

  • int32_t point
  • uint8_t type
  • int8_t level

encyclopedia_monster

  • bit array

encyclopedia_item

  • bit array

achievements

  • bit array

monster

buffs

List of:

  • uint8_t buff
  • uint8_t level
  • uint8_t remainingNumberOfTurn

skills

List of:

  • uint16_t skill
  • uint8_t level

skills_endurance

List of:

  • uint8_t endurance

catchchallenger_server

character_forserver

botfight_id

List of:

  • bit array

itemonmap

  • bit array

plants

List of:

  • uint16_t, pointOnMap
  • uint8_t plant
  • uint64_t plant_timestamps

quest

List of:

  • uint8_t quest
  • finish_one_time boolean
  • uint8_t step