Scatman and I discussed this add-on feature as something we could do in our spare time, when we need a break from data/scripts. Scat has a lot more knowledge of C++ and how the emulator "thinks" than I do, but I can at least design stuff!
The goal of this post is to come up with as many "#defines" as we can to layout a good stats system. Again, this is low-priority, stuff
LethalEncounter is NOT involved in (unless he wants to be heh), so it will not be something you see immediately. We're just talkin here
So here's the current plan. Our server should offer a kind of "World Stats" functionality for those stats freaks out there (like me) so Admins can build fancy web portals for their servers and what-not. Trying to emulate EQ2Players in a way, I am going to come up with what I think are a list of "stats" we need to mimic EQ2 Server/Players stats output - and from there, we can literally add anything we want - it's our world.
There are two flavors to Server Statistics we are considering.
- 1) Server "Right-Now" Stats:
These stats are those that track what is happening on the server right this moment, ie., memory/cpu usage, server up-time, current players/gm's, whatever.
2) Server "Over-Time" Stats:
These stats are for things like Player Total Kills, total kills of a specific type of monster, KVD Ratios, Highest Melee hit, and stat trends for Server and Guilds, arenas, any leaderboards EQ2Players shows us - and more we haven't thought of yet.
The output for the Right-Now stats could be sent to XML(al la the WoW Ascent-like emulators ServerStatusPlugin.dll). You would have parent elements for <Server>, <Player>, <Guilds>, etc, and on a timer, EQ2World would update this XML with the current happenings on the server - which would then be used on Server Web Portals.
The output for the Over-Time stats are pumped into a table in the DB similar to this design:
CREATE TABLE `statistics` (
`id` int(10) unsigned NOT NULL auto_increment,
`char_id` int(10) unsigned NOT NULL default '0',
`guild_id` int(10) unsigned NOT NULL default '0',
`stat_id` int(10) unsigned NOT NULL default '0',
`stat_value` int(10) unsigned NOT NULL default '0',
`stat_date` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `characterIDX` (`char_id`,`guild_id`,`stat_id`)
) ENGINE=InnoDB;
In this table, there is 1 row for every character's "stat_id", which are the defines we will be coming up with. And of course, the stat_value is the value of the statistic.
An example would be:
Code: Select all
#define STAT_SERVER_UPTIME = 2;
#define STAT_PLAYER_TOTAL_KILLS = 1000;
#define STAT_GUILD_MOST_MEMBERS = 2000;
So in our server_stats table, we'd have entries like:
Code: Select all
id: 1
char_id: 0
guild_id: 0
stat_id: 2
stat_value: 1234567890 (unix timestamp)
stat_date: 1234567890 (unix timestamp)
This entry would be for internal Server-only stats (char_id 0), showing that "STAT_SERVER_UPTIME", this server started on the date in stat_value, and stat_date tracks the last time this value was updated (so you can calc how long the server has been running)
Code: Select all
id: 2
char_id: 1
guild_id: 1
stat_id: 1000
stat_value: 193
stat_date: 1234567890 (unix timestamp)
This entry shows Character ID 1 having 193 "STAT_PLAYER_TOTAL_KILLS" racked up, and the most recent kill being on date <stat_date>.
Code: Select all
id: 3
char_id: 0
guild_id: 1
stat_id: 2000
stat_value: 502
stat_date: 1234567890 (unix timestamp)
This entry would show that guild_id 1 has 502 members as of <stat_date> -- etc etc...
World would look for an existing stat_id to update, and if it doesn't exist, insert the record - this way we're not flooding the table with unused stats fields (ie., a player that has never killed anything has no stat record for most kills, etc). Otherwise, World just updates the existing value. I am pretty sure a "replace into" would be the solution here, but we'll work that out on the back-end.
My list of constants:
// Server Utilization
#define STAT_SERVER_OS_TYPE 1 // what OS this server is running on
#define STAT_SERVER_CPU_TYPE 2 // cpu type/speed (ie., Intel P4 3.0GHz)
#define STAT_SERVER_CPU_CURRENT 3 // current CPU usage by EQ2World.exe process
#define STAT_SERVER_CPU_PEAK 4 // highest CPU usage by EQ2World.exe this session
#define STAT_SERVER_PHYSICAL_RAM_TOTAL 5 // total RAM in server
#define STAT_SERVER_PHYSICAL_RAM_CURRENT 6 // current RAM usage by EQ2World.exe
#define STAT_SERVER_PHYSICAL_RAM_PEAK 7 // highest RAM usage by EQ2World.exe this session
#define STAT_SERVER_VIRTUAL_RAM_TOTAL 8 // total vRAM in server
#define STAT_SERVER_VIRTUAL_RAM_CURRENT 9 // current vRAM usage by EQ2World.exe
#define STAT_SERVER_VIRTUAL_RAM_PEAK 10 // highest vRAM usage by EQ2World.exe this session
#define STAT_SERVER_DISK_USAGE 11 // size of /eq2emulator folder and contents
#define STAT_SERVER_THREAD_COUNT 12 // thread count of EQ2World.exe process
#define STAT_SERVER_AVG_LATENCY 13 // network latency between world and loginserver
// Server Stats
#define STAT_SERVER_CREATED 100 // unix_timestamp of date server first came online
#define STAT_SERVER_START_TIME 101 // unix_timestamp of date/time server booted up
#define STAT_SERVER_ACCEPTED_CONNECTION 102 // successful connections since server startup
#define STAT_SERVER_MOST_CONNECTIONS 103 // most players online in history of server
#define STAT_SERVER_NUM_ACCOUNTS 104 // total number of unique accounts
#define STAT_SERVER_NUM_CHARACTERS 105 // total number of player characters
#define STAT_SERVER_AVG_CHAR_LEVEL 106 // average level of player characters
#define STAT_SERVER_NUM_ACTIVE_ZONES 107 // number of currently running/loaded zones
#define STAT_SERVER_NUM_ACTIVE_INSTANCES 108 // number of active zones that are "instances"
// Player PvE counters
#define STAT_PLAYER_TOTAL_NPC_KILLS 1000 // total NPC kills by player
#define STAT_PLAYER_TOTAL_DEATHS 1001 // total non-PvP deaths of player
#define STAT_PLAYER_KVD_RATIO 1002 // kill-versus-death ratio of player
#define STAT_PLAYER_HIGHEST_MELEE_HIT 1003 // players highest melee hit to date
#define STAT_PLAYER_HIGHEST_MAGIC_HIT 1004 // players highest magic hit to date
#define STAT_PLAYER_HIGHEST_HO_HIT 1005 // players highest heroic opportunity hit
#define STAT_PLAYER_TOTAL_STATUS 1006 // player total status
#define STAT_PLAYER_TOTAL_WEALTH 1007 // player total wealth
#define STAT_PLAYER_QUESTS_COMPLETED 1008 // total quests completed
#define STAT_PLAYER_RECIPES_KNOWN 1009 // total recipes player knows
#define STAT_PLAYER_TOTAL_CRAFTED_ITEMS 1010 // total items crafted by player
#define STAT_PLAYER_ITEMS_DISCOVERED 1011 // total items discovered by player
#define STAT_PLAYER_RARES_HARVESTED 1012 // total rare harvests by player
#define STAT_PLAYER_MASTER_ABILITIES 1013 // total master abilities player has
// Player PvP counters
#define STAT_PLAYER_TOTAL_PVP_KILLS 1100 // total PVP kills by player
#define STAT_PLAYER_PVP_KILL_STREAK 1101 // longest PVP kill streak of player
#define STAT_PLAYER_TOTAL_PVP_DEATHS 1102 // total PVP deaths of player
#define STAT_PLAYER_PVP_DEATH_STREAK 1103 // longest PVP death streak of player
#define STAT_PLAYER_PVP_KVD_RATIO 1104 // PVP kill-versus-death ratio of player
#define STAT_PLAYER_TOTAL_ARENA_KILLS 1105 // total Arena kills of player
// MOST stats for players
#define STAT_PLAYER_MOST_NPC_KILLS 1200 // IPvP: Player with most NPC kills
#define STAT_PLAYER_MOST_NPC_DEATHS 1201 // IPvP: Player with most non-PVP deaths
#define STAT_PLAYER_MOST_PVP_KILLS 1202 // IPvP: Player with most PvP kills
#define STAT_PLAYER_MOST_PVP_DEATHS 1203 // IPvP: Player with most PvP deaths
#define STAT_PLAYER_MOST_ARENA_KILLS 1204 // IPvP: Player with most Arena kills
#define STAT_PLAYER_MOST_STATUS 1205 // IPvP: Player with most Status
#define STAT_PLAYER_MOST_WEALTH 1206 // IPvP: Player with most Wealth
// HIGHEST stats for players
#define STAT_PLAYER_HIGHEST_NPC_KVD_RATIO 1300 // IPvP: Player with highest NPC kill-versus-death ratio
#define STAT_PLAYER_HIGHEST_PVP_KILL_STREAK 1301 // IPvP: Player with longest PvP kill streak
#define STAT_PLAYER_HIGHEST_PVP_DEATH_STREAK 1302 // IPvP: Player with longest PvP death streak
#define STAT_PLAYER_HIGHEST_PVP_KVD_RATIO 1303 // IPvP: Player with highest PvP kill-versus-death ratio
#define STAT_PLAYER_HIGHEST_HP 1304 // IPvP: Player with highest HP on server
#define STAT_PLAYER_HIGHEST_POWER 1305 // IPvP: Player with highest Power on server
#define STAT_PLAYER_HIGHEST_RESISTS 1306 // IPvP: Player with highest Resists on server
// JA: Next set of STAT_* defines will be Guild - but no need for those yet
This is just a start... I went through EQ2Players.com Leaderboards, Best of the Best, and Best Guilds. If you can think of any more, feel free to add to this thread.