Core

From DSP Wiki
Revision as of 20:04, 23 July 2012 by Kegsay (Talk | contribs) (Created page with "Referred to as the "Core", this is the main C++ codebase. It is split into different sections which will be outlined here. Please note that this may not always remain in date ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Referred to as the "Core", this is the main C++ codebase. It is split into different sections which will be outlined here. Please note that this may not always remain in date as new things are added. The main beef of the server code will be outlined here, but not the extreme odd cases which are never used (e.g. /common/ or /items/ folders).

Map Server (aka Game Server)

The Map Server is the main server which governs how the game is played. It is REQUIRED in order for the server to work. The Connect Server is also required in order for characters to connect to the Map Server. The Search Server is optional. The following subsections breaks down the map server based on where it is physically located folder-wise.

Entity AI (/src/map/ai)

This governs how the server should respond to given actions. These actions are on a high-level, e.g. attacking, disengaging, using TP moves, using items, etc. You can treat this AI as a primitive state system, whereby you can be in the "Attack" state, "Roaming" state, and so on.

All Entities

  • ActionAttack : Logic when attacking, including delay, calculation of damage, hit rate, counters, paralyze, intimidation, you name it.
  • ActionNone : No logic at all (e.g. a mob that has despawned may be in this state, or a deallocated entity).
  • ActionEngage : When you engage, these checks are performed. Usually transfers straight into ActionAttack after calling lua scripts. For monsters, you engage on aggro/turning red only.
  • ActionDisengage : Logic that occurs when you disengage.
  • ActionFall : Logic when you transfer from being alive to being dead, the transition to the Death state.
  • ActionDeath : Logic when you're dead, usually maintenance tasks like removing yourself from the entity pool.

Characters

  • ActionMagicStart : Checks to perform when beginning to cast a spell, you can say things like "Not enough MP" or "You must have a pet" here.
  • ActionMagicCasting : Checks to perform whilst mid-cast, this also checks to see if you are past the cast time for the spell where it will go into ActionMagicFinish.
  • ActionMagicFinish : Checks to perform when finishing casting (spell interruption from movement), including calling the lua scripts for spells.
  • ActionMagicInterrupt : When you have been interrupted, this is the state you enter.
  • Action

Monsters

  • ActionDropItems : Drops items, including calculating the probability of drops, assigning them to the treasure pool, etc.
  • ActionFadeOut : Fades the monster out after death.
  • ActionMobAbilityStart : Checks to perform when starting a TP ability e.g. selection of a TP move
  • ActionMobAbilityUsing : Checks to perform whilst using a TP ability e.g. check for Stun and if so, interrupt the move.
  • ActionMobAbilityInterrupt : The state to go into when interrupted.
  • ActionMobAbilityFinish : Checks to perform when the TP ability finishes, including calling lua scripts.
  • ActionRoaming : Manages the idle state, including moving around.
  • ActionSpawn : Checks to perform on spawn.
  • ActionSleep : Checks to perform when slept (usually the checks are to see if you can wake up).

Pets

  • ActionMobAbilityStart : Checks to perform when starting a TP ability e.g. selection of a TP move
  • ActionMobAbilityUsing : Checks to perform whilst using a TP ability e.g. check for Stun and if so, interrupt the move.
  • ActionMobAbilityInterrupt : The state to go into when interrupted.
  • ActionMobAbilityFinish : Checks to perform when the TP ability finishes, including calling lua scripts.

LUA (/src/map/lua)

This provides the main interface between scripting land and C++ land. If scripters need some awesome thing in the core added to LUA, this is where you add it. This is split into several different sections, all of which are very different, so check out the dedicated LUA section for more info.

LUA (Core)

Packets(/src/map/packets)

This defines the packet structures that will be sent to the client. If an update breaks FFXI, this is where you have to go to fix it (because the packet strucutres have changed!). This is a VERY meaty section, so has its own section.

Packets

Other (/src/map)

This contains everything else, which is actually quite a lot. It can be broadly grouped into these categories:

* Entities (NPC,Pet,Char,Mob)
* Instances (BCNMs)
* Items (Armor, Weapons, Consumables, etc)
* Effects (Modifiers and Status Effects)
* Zone (handling of everything in the zone)
* Synthesis
* Parties
* Linkshells
* Time management
* Enmity

Search Server

The Search Server was designed to take a lot of the heavy lifting search stuff away from the main server. If you were to do these searches on the main server, the game would grind to a halt and stop working, primarily because the server would be too busy doing SQL queries and not handling incoming packets. Its primary focus is on searching and the auction house.

Searching

Auction House

Connect Server (aka Lobby Server)

The Lobby Server is a magical server whereby almost certainly a wizard did it. It consists of three distinct sub-servers (for some reason) which don't always get along. This is the least documented server and one of the more obfuscated ones. The three processes are discussed below (but not in that much detail)

1

2

3