My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
GameFiles  
How to create an EQdkp game file for your game.
Featured
Updated Feb 4, 2010 by daz...@gmail.com

Introduction

This wiki article will explain and demonstrate how to create your own game file for EQdkp. This article will be using the World of Warcraft (WoW) EQdkp game file to demonstrate.

The File Structure

The typical file structure for a game will look something like this:

<eqdkp_root>
|
|-- games
    |-- wow
    |   |-- game_wow.php
    |   |-- language
    |       |-- english
    |           |-- lang_game.php
    |-- ...

Each game needs to have a short, unique key name to identify the game by. Start by creating a folder with this key name (for example, "wow" for World of Warcraft). Inside this folder, create a PHP file called "game" + your keyname. This is the file that will contain the information about the game required for use by EQdkp.

Optionally, you can include a language file for the game. This file should be called lang_game.php, and be placed inside a folder named after the language.

The Files

game_wow.php

A full example for the file structure can be found in our repository.

The game file should only be usable by the game manager class, and by EQdkp. As such, you should place the following at the start of each game file.

if (!defined('EQDKP_INC') || !defined('IN_GAME_MANAGER'))
{
    header('HTTP/1.0 404 Not Found');
    exit;
}

$game_info array

Next up is the $game_info array. This array holds information about the game itself.

$game_info = array(
    'id'        => 'wow',
    'name'      => 'World of Warcraft',
    'shortname' => 'WoW',
    'version'   => '1.0',
    'max_level' => 70,
    
    'available' => array(
        'armor_types' => true,
        'classes'     => true,
        'class_armor' => true,
        'factions'    => true,
        'races'       => true,
        
        'professions' => false,
        'parsing'     => true,
    ),
);

Here's an explanation of each of these fields:

Key Name Data Type Required? Description
id string yes The keyname for the game. This is used to identify the game in EQdkp's code and the database. This should be exactly the same as the game's folder name, as well as the keyname in the file's name.
name string yes The full name for the game. Used on the pages of EQdkp to reference the game (for instance, on the admin/manage_game.php page).
shortname string no Currently not used yet.
version version string yes Determines the game file's revision. Must adhere to the format as used by the version_compare() function. NOTE: this will be used in a future version to allow upgrading a game from itself.
max_level integer yes Sets the maximum level achievable in the game.
available array no Will be used to set flags to determine what information is available in this game file.

$game_data array

Next up after the $game_info array is the $game_data array. This array holds the data for the game's races, classes, factions etc. The game manager only needs the $game_data array when it's attempting to install the game. When it's retrieving game information only, it will declare a variable called $get_gameinfo. As such, you should enclose the $game_data array in a conditional statement that checks for the existence of this variable:

if (!isset($get_gameinfo))
{
    $game_data = array();
}

The game data is comprised of several sections. Each section is an array itself with a specific key name. Further, each value for these arrays is a key-value pair in which the key descries the value.

The key names should only contain alphabetic characters or an underscore. This key is used for language string lookups, which will be explained further on.

armor_types

Declares the game's armor types. These armor types are used later on. Each armor type is referenced by a unique keyname (such as "cloth" or "plate"). The array holds the following information:

Key Name Data Type Required? Description
id integer yes A unique identifier for this armor type.
name string yes A (default) name for the armor type. May contain spaces, apostrophes, etc.

classes

Declares the game's classes. Each class is referenced by a unique keyname (such as "priest" or "deathknight"). The array holds the following information:

Key Name Data Type Required? Description
id integer yes A unique identifier for this class.
name string yes A (default) name for the class. May contain spaces, apostrophes, etc.
color string no An optional value that contains a hexadecimal string. This string represents an RGB colour to be used for the class.

class_armor

Declares mappings between the classes and armor types in order to tell EQdkp which classes can use what armor. Each entry is an unnamed array that holds the following information:

Key Name Data Type Required? Description
class string yes A reference to a class keyname.
armor string yes A reference to an armor type keyname.
min integer no An optional value that specifies the minimum level required for the class to be able to use the armor.
max integer no An optional value that specifies a level where the class can no longer wear the armor, or at what level to stop associating the class with that armor type (useful for filtering)

factions

Declares the factions in the game. Each faction is referenced by a unique keyname (such as "horde"). The array holds the following information:

Key Name Data Type Required? Description
id integer yes A unique identifier for this faction.
name string yes A (default) name for the class. May contain spaces, apostrophes, etc.
races array no A list of all the races that are available to the faction.

races

Declares the races that are playable in the game. Each faction is referenced by a unique keyname (such as "tauren" or "night_elf"). The array holds the following information:

Key Name Data Type Required? Description
id integer yes A unique identifier for this race.
name string yes A (default) name for the race. May contain spaces, apostrophes, etc.
faction string yes The keyname of the faction the race belongs to.
classes array no A list of all the classes that are available to the faction.

parsing

This section contains expressions that will allow parsing of game logs. These expressions have a special (and hopefully understandable) syntax. Each entry is a single string value that contains a parsing string for the game. You can specify multiple parse strings, but only the first string will be used to parse the game logs (NOTE: in a future version it will be possible to select a specific parsing string)

Everything in the string will be parsed letter for letter, with a few exceptions.

  • There are a number of special "placeholder" variables that you can use in a parse string:

Placeholder Variable Description
__name__ The character name.
__level__ The character's level.
__race__ The character's race.
__class__ The character's class.
__guild__ The character's guild.
__zone__ The zone the character was in when the log was taken.

  • Enclosing anything in-between two question-mark characters (?) denotes a part of the parse string that may not actually occur on a particular line in the log. For example, in the WoW logs a player may not be in a guild, so the player's guild is enclosed with question marks.

lang_game.php

The language file defines strings that will be used to replace the default names for game objects. It should be accessible by EQdkp. A full example can be found in our repository.

if ( !defined('EQDKP_INC') )
{
    header('HTTP/1.0 404 Not Found');
    exit;
}

The language strings are stored in an array called $lang. This array may already exist by the time this file is called upon, so you should include the following code to ensure that the new game string entries do not override anything currently included in the $lang array:

// Initialize the language array if it isn't already
if (empty($lang) || !is_array($lang))
{
    $lang = array();
}

$lang = array_merge($lang, array(
   <your values here>
));

As you may appreciate, because each game is different in terms of the class names, races etc., a game language string has an expected format. Each language key has a PREFIX_SUFFIX format (note that they're all in uppercase).

The PREFIX for a language string can be any of the following values:

  • GAME
  • ARMOR
  • CLASS
  • FACTION
  • RACE

The SUFFIX for a language string should correspond to one of the keynames specified in the $game_data array of the game_name.php file.

Here's some examples:

    'GAME_NAME'         => 'World of Warcraft',
    'GAME_ID'           => 'WoW',
    'GAME_CLASS'        => 'Class',

    'CLASS_DEATH_KNIGHT'=> 'Death Knight',
    'CLASS_DRUID'       => 'Druid',

    'RACE_BLOOD_ELF'    => 'Blood Elf',
    'RACE_DRAENEI'      => 'Draenei',

Sign in to add a comment
Powered by Google Project Hosting