Character Selection - kukfa/mmoserver GitHub Wiki

The character selection process is the first thing to happen after the client disconnects from the login server and connects to the game server.

Packets

The character selection functionality uses ChannelType 04 (CharacterManagerClient), with the following processing functions:

  • 00: Connected
  • 01: Disconnected
  • 02: CharacterCreated
  • 03: GotCharacter
  • 04: Character Creation
  • 05: Select Character

Connected

Sent by both sides to initiate the character selection process. Must be sent before any of the other character selection packets. No additional packet data necessary

Disconnected

No additional packet data necessary

CharacterCreated

Sent by both the client and server when creating a character. The client will send its version of the packet first, then expects the server's version of the packet in response.

Sent by client

Sent after the player presses the Accept button in the character creation screen. Contains a brief amount of information about the character that was created, which is used to reconstruct the character object on the server side.

Packet structure:

  1. [2] ChannelType + processing function ID (0402)
  2. [Varies] Character name in ASCII, followed by a null-byte at the end
  3. [Varies] Class of character that was created, in the form of "avatar.classes.ClassGender"
    • e.g. avatar.classes.FighterMale
  4. [6] Individual bytes signifying the character design choices made by the player:
    • [1] ??? (outside of player's control)
    • [1] ??? (outside of player's control)
    • [1] Face
    • [1] ??? (outside of player's control)
    • [1] Hair
    • [1] Hair color

Sent by server

TODO

GotCharacter

Used by both the client and server for transferring character info. The client will send its version of the packet first, which is followed by the server sending its version of the packet in response.

Sent by client

Used to request character data. No additional packet data (just ChannelType and function ID)

Sent by server

Used to send the player's characters in serialized form.

A character is serialized by sending a specific sequence of DFC Objects. The relevant classes here are the Player class and the Avatar class -- there is an important distinction between the two. Note: From here on, proper noun Player (with a capital P) refers to the actual Player class, where common noun player (with a lower-case p) refers to the person playing the game.

The Player class is essentially a container class for entities that the player controls (e.g. their character, their bling gnome...). These player-controlled entities are added as nodes to the Player object, which signifies that the player has control over them. The Avatar class is what holds the information for the actual in-game character, and has different nodes that contain relevant information: Modifiers, Manipulators, UnitBehavior, Skills, Equipment, and UnitContainer. Thus, the Player object has the Avatar object as a node, because the player controls their in-game character.

Putting everything together, here's what a packet looks like for sending a serialized character:

  1. [2] ChannelType + processing function ID (0403)
  2. [1] Number of characters being sent
  3. The following is repeated for each character:
    1. [4] Character ID, big-endian
    2. Serialized Player object
      • DFCClass: Player
      • GCClass: Player
      • Properties:
        • Name -> CharNameHere
      • Node: Avatar
        • DFCClass: Avatar
        • GCClass: avatar.classes.ClassGender (e.g. FighterMale)
        • Properties:
          • Skin -> [4 byte ID]
          • Face -> [4 byte ID]
          • FaceFeature -> [4 byte ID]
          • Hair -> [4 byte ID]
          • HairColor -> [4 byte ID]
          • TotalWorldTime -> [4 byte ID]
          • LastKnownQueueLevel -> [4 byte ID]
          • HasBlingGnome -> [4 byte ID]
        • 6 nodes:
          • Modifiers
          • Manipulators
          • UnitBehavior
            • GCClass: avatar.base.UnitBehavior
          • Skills
            • GCClass: avatar.base.skills
          • Equipment
            • TODO
          • UnitContainer
    3. String of unknown purpose (Player::readObject)
    4. String of unknown purpose (Player::readObject)
    5. [4] Unknown (Player::readObject)
    6. [4] Unknown (Player::readObject)
    7. Serialized object w/ unknown purpose (Player::readObject)
    8. [1] Unknown (Player::readObject)
    9. [1] Unknown (PlayerPreferences::ReadDataFromDisk)
    10. String: Difficulty setting (PlayerPreferences::ReadDataFromDisk)
      • Normal, Formidable, Extreme, Insane
    11. [1] Unknown (PlayerPreferences::ReadDataFromDisk)
    12. [1] Unknown (PlayerPreferences::ReadDataFromDisk)
    13. [4] Unknown (Player::readObject)

Character creation

Used by the server to tell the client to enter the character creation screen. No additional packet data necessary

Typical Packet Sequence

TODO