Server Stats considerations

EQ2Emulator Development forum.

Moderator: Team Members

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Server Stats considerations

Post by John Adams » Thu Oct 18, 2007 3:14 pm

Request ;)
Can we see about including server statistics in DB form from the ground floor? The way EQEmu does it is ancient and horrible (imo) - the whole world perl thingy... I'd like to see server stats fed from a database that is updated by the world along with the player/server data.
Example: World up or down, from a web stats perspective, could be a field in a World Stats table. This might also show current, active zones, players, how long it's been running, even the OS it runs on (sound familiar? it should...:) Furthermore, the character record could have a field added to simply be a bool on/offline, or zones they are currently in, etc. I think there are data structures already in place or planned for generating some of the Leadeboard-type content SOE currently provides (most kills, most quests, etc).
The goal in all this is to provide the ability for communities to create portals with live stats so players can get a feel for the stability and popularity of a server.
I'd like to avoid the whole built-in, archaic language or hacked proprietary script approach, as well as avoiding having to use Telnet as the only way to pull info from a server remotely. That's just so 80's. :D
Thanks!

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Thu Oct 18, 2007 4:45 pm

Excellent idea. It wont be right away obviously, but that sounds like a really cool feature to have.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Post by John Adams » Thu Oct 09, 2008 10:43 am

LE,
Do we have the ability to write out to an xml from EQ2World.exe currently? If so, maybe we could adopt the server-status module concept from other Emu's where output of current server status to xml could be done every `n` seconds, with 60s being minimum (to prevent choking the server?)

XML sample:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="server_stats.xsl"?>
<serverpage>
  <status>
    <platform>OpenAscent 0.1-TRUNK r193/Release-Win-X86 (www.openascent.com)</platform>
    <uptime>0 days, 0 hours, 40 minutes, 14 seconds</uptime>
    <oplayers>6</oplayers>
    <cpu>0.05</cpu>
    <qplayers>0</qplayers>
    <ram>217.938</ram>
    <avglat>1.500</avglat>
    <threads>35</threads>
    <fthreads>6</fthreads>
    <gmcount>4</gmcount>
    <lastupdate>Thu Oct 09 10:06:46 2008
</lastupdate>
    <alliance>3</alliance>
    <horde>3</horde>
    <acceptedconns>16</acceptedconns>
    <peakcount>6</peakcount>
    <wdbquerysize>0</wdbquerysize>
    <cdbquerysize>0</cdbquerysize>
  </status>
  <statsummary>
    <human>1</human>
    <orc>1</orc>
    <dwarf>0</dwarf>
    <nightelf>0</nightelf>
    <undead>0</undead>
    <tauren>2</tauren>
    <gnome>0</gnome>
    <troll>0</troll>
    <bloodelf>0</bloodelf>
    <draenei>2</draenei>
    <warrior>1</warrior>
    <paladin>1</paladin>
    <hunter>1</hunter>
    <rogue>0</rogue>
    <priest>2</priest>
    <shaman>1</shaman>
    <mage>0</mage>
    <warlock>0</warlock>
    <druid>0</druid>
  </statsummary>
  <instances>
	<instance>
		<map>0</map>
		<maptype>0</maptype>
		<players>1</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>1</map>
		<maptype>0</maptype>
		<players>3</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>13</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>25</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>29</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>42</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>44</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>169</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>369</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>449</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>450</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>451</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>530</map>
		<maptype>0</maptype>
		<players>2</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>582</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>584</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>586</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>587</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>588</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>589</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>590</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>591</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
	<instance>
		<map>593</map>
		<maptype>0</maptype>
		<players>0</players>
		<maxplayers>0</maxplayers>
		<creationtime>N/A</creationtime>
		<expirytime>N/A</expirytime>
		<idletime>N/A</idletime>
	</instance>
  </instances>
  <gms>
    <gmplr>
      <name>John</name>
      <race>6</race>
      <class>7</class>
      <gender>0</gender>
      <pvprank>0</pvprank>
      <level>50</level>
      <map>1</map>
      <areaid>221</areaid>
      <ontime>0 hours, 35 minutes, 26 seconds</ontime>
      <latency>3</latency>
      <permissions>az</permissions>
    </gmplr>
  </gms>
  <sessions>
    <plr>
      <name>John</name>
      <race>6</race>
      <class>7</class>
      <gender>0</gender>
      <pvprank>0</pvprank>
      <level>50</level>
      <map>1</map>
      <areaid>221</areaid>
      <xpos>-2922.045898</xpos>
      <ypos>-259.049225</ypos>
      <ontime>0 hours, 35 minutes, 45 seconds</ontime>
      <latency>1</latency>
    </plr>
    <plr>
      <name>Trammel</name>
      <race>6</race>
      <class>1</class>
      <gender>0</gender>
      <pvprank>0</pvprank>
      <level>1</level>
      <map>1</map>
      <areaid>221</areaid>
      <xpos>-2918.546631</xpos>
      <ypos>-257.980011</ypos>
      <ontime>0 hours, 10 minutes, 48 seconds</ontime>
      <latency>4</latency>
    </plr>
    <plr>
      <name>Spryte</name>
      <race>11</race>
      <class>5</class>
      <gender>1</gender>
      <pvprank>0</pvprank>
      <level>1</level>
      <map>530</map>
      <areaid>3526</areaid>
      <xpos>-3959.413818</xpos>
      <ypos>-13931.200195</ypos>
      <ontime>0 hours, 1 minutes, 25 seconds</ontime>
      <latency>1</latency>
    </plr>
    <plr>
      <name>Calle</name>
      <race>1</race>
      <class>5</class>
      <gender>1</gender>
      <pvprank>0</pvprank>
      <level>1</level>
      <map>0</map>
      <areaid>9</areaid>
      <xpos>-8950.770508</xpos>
      <ypos>-132.492996</ypos>
      <ontime>0 hours, 36 minutes, 48 seconds</ontime>
      <latency>1</latency>
    </plr>
    <plr>
      <name>Orkie</name>
      <race>2</race>
      <class>3</class>
      <gender>0</gender>
      <pvprank>0</pvprank>
      <level>1</level>
      <map>1</map>
      <areaid>363</areaid>
      <xpos>-617.384033</xpos>
      <ypos>-4251.669922</ypos>
      <ontime>0 hours, 30 minutes, 46 seconds</ontime>
      <latency>1</latency>
    </plr>
    <plr>
      <name>Donnian</name>
      <race>11</race>
      <class>2</class>
      <gender>0</gender>
      <pvprank>0</pvprank>
      <level>1</level>
      <map>530</map>
      <areaid>3526</areaid>
      <xpos>-3961.639893</xpos>
      <ypos>-13931.200195</ypos>
      <ontime>0 hours, 2 minutes, 19 seconds</ontime>
      <latency>1</latency>
    </plr>
  </sessions>
</serverpage>
Granted, this is the OpenAscent(WoW) ServerStats module output, so god forbid I do not give credit to the authors ~choke~ - but something along these lines could be nice for us web portal whores.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Sat Oct 11, 2008 6:32 am

The xml code is there, I have just never used it. Remind me if I forgot after the item code is rewritten and I'll add this.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Post by John Adams » Sat Oct 11, 2008 11:17 am

Sure thing, thanks. If you get the basic system in place, it is probably something even I could take a look at enhancing as needed - provided it is something I understand heh. I've worked with other emu "stats" modules before.
Also, can you make this option configurable? Right now we're still considering using the `variables` table for config settings... but eventually we may consider an XML file for static configs. Either way, a "server_stats" with a value of 0 = off, values of 60+ = seconds to poll for server status. 1-59 are invalid (too fast?)

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Server Stats considerations

Post by John Adams » Sat May 09, 2009 11:53 am

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.
Last edited by John Adams on Thu Jun 04, 2009 6:03 pm, edited 1 time in total.
Reason: changed defines to current values
John Adams
EQ2Emulator - Project Ghost
"Everything should work now, except the stuff that doesn't" ~Xinux

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Server Stats considerations

Post by John Adams » Sat May 09, 2009 12:21 pm

PS: LE, if you are watching, I don't know if those #define names are too ridiculously long or whatever. We could come up with something less dramatic if you prefer.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: Server Stats considerations

Post by LethalEncounter » Sat May 09, 2009 12:23 pm

Heh, nah that is fine. If you need anything from me for this or you need me to get you guys started let me know and I'll try to help whenever I can :)

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Server Stats considerations

Post by Scatman » Sat May 09, 2009 7:51 pm

Instead of using MOST_KILLS, MOST_QUESTS_COMPLETED, MOST_*, shouldn't we just use KILLS, QUESTS_COMPLETED, * to keep track of player stats then find the "most" part having the website query the database and find the MAX for a given field? I'm not really sure how we'd keep track of the max in the server code? Or am I looking at this the wrong way?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Server Stats considerations

Post by John Adams » Sat May 09, 2009 8:03 pm

It is much easier on MySQL to ask for a single value from a set of data than to ask it to count, min, or max. I am not sure of the logics, but I believe min/max has to order by in some way, and order by is the worse thing you can do to a query; a necessary evil. So the less "SELECT COUNT(*)" we do, I think the better. That's just an opinion though, I could be mistaken. Finely tuned MySQL servers can probably handle the load no problem.

When it comes to MOSTs, that is something the World will decide when it writes it's update once every 'x' minutes. I imagine the MOSTs data will come from looking at the MAX stat_value for stat_id belonging to char_id or guild_id, and stuffing that value into the STAT_PLAYER or STAT_GUILD MOSTs records.

If you REALLY wanted to get fancy, the Stats Generator could be a seperate app entirely that just runs as a job on your server, taking raw history data and compiling it into nice lists. But I figure that was more of an effort, and thought World could probably do the job just fine.


Remember, we can do anything we want here as long as we can track the data. Anything that is a player stat (from Persona) can be a stat like this... so the door is totally open to ideas. My ideas are not necessarily the best, just one. I welcome other concepts.

User avatar
ilythor
Retired
Posts: 436
Joined: Sun Oct 14, 2007 3:44 am
EQ2Emu Server: TessEq2
Location: Australia, mate!
Contact:

Re: Server Stats considerations

Post by ilythor » Sun May 10, 2009 3:08 am

Sounds great, we could probably link in things like custom titles to go with those holding the most_* positions... Maybe even in game trophies?
"Everytime you pull the trigger in space, you will ruin someone's day, somewhere, and eventually, some time."

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Server Stats considerations

Post by John Adams » Wed May 13, 2009 5:12 pm

As a very(very) rough example, here is an idea of the Stats currently available on my 2 servers.

TessEQ2 - the public test server
EQ2 Project - the private dev server

(you can toggle between my 2 DB's using the top combo box)

Again, this is just thrown together, and only NPC Kills are really being tracked by the new Stats system - the rest of them are basic SQL "count" queries til we work out the details.

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Server Stats considerations

Post by Zcoretri » Wed May 13, 2009 5:18 pm

This is gonna be a cool addition for stat geeks like me :mrgreen:

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Server Stats considerations

Post by John Adams » Thu May 14, 2009 4:17 pm

Ok LE, there is one thing you can do for us in this regard.

Can you tell us if EQ2World currently supports the C++ modules needed to track stats such as these:

Code: Select all

// 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
These are not the most crucial to player stats, but may come in handy for during development for tracking performance and such. Just a thought. No hurry on this.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: Server Stats considerations

Post by LethalEncounter » Thu May 14, 2009 6:55 pm

Depends on what you consider modules :P Will you have to download a third party plugin to get the information? Almost certainly not, but you will need to include the right header files and call the right OS dependent functions. You will need to use #ifdef's around the operations as different OSs have different functions for getting the information. It won't be easy but it is doable.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests