Server Features

From Hack/Mine Wiki
(Difference between revisions)
Jump to: navigation, search
(New Server Commands)
(New Server Commands)
Line 4: Line 4:
 
If chunkX and chunkZ aren't specified, the player's current chunk is assumed.  Dimensions may be -1, 0, 1, or 10 for the Nether, the surface, the End, and the mystery dimension respectively.  The surface is assumed when not specified.
 
If chunkX and chunkZ aren't specified, the player's current chunk is assumed.  Dimensions may be -1, 0, 1, or 10 for the Nether, the surface, the End, and the mystery dimension respectively.  The surface is assumed when not specified.
  
Chunk coordinates may be calculated from block coordinates if they're divided by 16 and floored (e.g. block coords of (26, -113) are inside chunk (1, -8)).  Your current position in block coords can be found by opening the debug menu with F3 and taking "x" and "z" (your height being "y").
+
Chunk coordinates can be calculated from block coordinates if they're divided by 16 and floored (e.g. block coords of (26, -113) are inside chunk (1, -8)).  Your current position in block coords can be found by opening the debug menu with F3 and taking "x" and "z" (your height being "y").
  
 
{|border=1
 
{|border=1

Revision as of 22:04, 25 May 2012

New Server Commands

These commands are new to Hack/Mine as of version 0.6 (not officially released yet.) Smart name matching has been added as well, so players can be searched for via the first few letters of their name, both case and 1337 insensitively.

If chunkX and chunkZ aren't specified, the player's current chunk is assumed. Dimensions may be -1, 0, 1, or 10 for the Nether, the surface, the End, and the mystery dimension respectively. The surface is assumed when not specified.

Chunk coordinates can be calculated from block coordinates if they're divided by 16 and floored (e.g. block coords of (26, -113) are inside chunk (1, -8)). Your current position in block coords can be found by opening the debug menu with F3 and taking "x" and "z" (your height being "y").

Player Commands
Command Description
spawn Teleports the player to spawn
who [player] Gives the name, class, race, and level of the specified player (or yourself if the player isn't specified).
flags [<chunkX> <chunkZ> [dim]] Spits out all flags on the chunk (pvp enabling/disabling, block protection)
roll | rand | random [die size] Spits out a random number in chat from 1 - <die size> (100 if none is given).


Console/Op Commands
Command Description
reward <player> (<amount> <cur> | mobdrop <mult>) Gives some currency to the player. If "mobdrop" is specified, it gives them a typical amount of gold from a monster of the player's level, times <mult>. Otherwise, it gives the player <amount> of <cur>, where <cur> is p, g, s, c, platinum, plat, gold, silver, or copper.
penalize <player> (<amount> <cur> | mobdrop <mult>) Removes currency from the player (will report amount actually removed if they have less).
setspawn <x> <z> Sets the spawn point to the given block coordinates.
<flag> [<chunkX> <chunkZ> [dim]] <flag> may be protect-blocks, unprotect-blocks, prohibit-pvp, allow-pvp, default-pvp. Block protection prevents blocks from being dug, placed, or explodinated by non-ops, whereas prohibit-pvp and allow-pvp override the server's default pvp settings for that chunk. Using unprotect-blocks and default-pvp will clear their respective effects.
clear-all <flag> Removes the flag from all chunks; <flag> may be protect-blocks, prohibit-pvp, allow-pvp, pvp, flags
resize-ac [newsize] Resizes the area cache (to the size in areaCache.properties if not specified). If shrinking, an area size higher than the number of players is recommended.
reset-ac [newsize] Entirely cleans the area cache and resizes it (to the size in areaCache.properties if not specified). May fix lag if the server's acting up. Again, if shrinking, an area size higher than the number of players is recommended.

Flagged chunk data is saved to "flaggedChunks.txt" and can be edited while the server is off for quick flagging. Possible flags are protect-blocks, allow-pvp, and prohibit-pvp.

The Area Cache

"areaCache.properties" contains advanced settings for Hack/Mine's area cache, and fine-tuning them may improve performance and stability for your H/M server. Also, Frizzil needs people to mess with it in hopes of finding better numbers (if you screw it up or aren't sure about your changes, just delete the file and H/M will generate a new one for you.) Fine-tuning is really only necessary if your server is at 20+ people. However, the larger your server is, the more significant fine-tuning your area cache will become. You'll want to enable "verboseLogging" when experimenting and disable it otherwise, to avoid console clutter. If you find settings that work, post them along with your system and server specs on the discussion page!

Things to consider when tuning, from most to least important: How fast is my file I/O? What's the speed on my CPU? How much RAM do I have?

Basically, the area cache is a place in memory where Areas are stored for quick access. A "cache miss" is when a request is made for an area that isn't in the cache, resulting in it being loaded from disk and into the cache-- you're trying to minimize these as much as possible, since file I/O is VERY expensive (unless you've got SSD like a boss!) Obviously, areas must be loaded at least once, but the trick is storing areas that will likely be used again and removing those that won't to make room. More recently referenced areas are kept, whereas less recently referenced ones are removed. A larger cache helps, but results in slower "victim selection", and at extreme sizes results in general lag and high RAM consumption.

Each tick, the ratio of cache queries that were misses is calculated and stored in "pctMiss." This number is extremely small (generally peaking in E-4), but is still significant given that a cache miss can be over 1000 times slower than a cache hit. The exponential average of this number is stored in "avgPctMiss." I.e. avgPctMiss is set to avgPctMiss * w + (1-w) * pctMiss each tick, where w is "avgPctMissPastWeight" This gives three important numbers for you to tweak-- avgPctMissThreshold and pctMissThreshold, which "grow" the cache when exceeded, and "avgPctMissPastWeight", which is "how significant are recent values?" and effectively smooths out avgPctMiss as it approaches 1.00 (at 20 ticks/second, slight variations of this number from the default make dramatic differences.) If your past weight is too low, your cache will be too sensitive to minor fluctuations and grow too frequently, eventually crashing your server from RAM consumption or massive lag. If your past weight is too high, your cache will be too resilient to fluctuations, resulting in "area thrashing" as the need for areas exceeds the size of the cache, causing needed areas to be saved and loaded with each tick (This will cause massive lag and may also crash your server.) Basically, fine tune these numbers to get the perfect amount of responsiveness to cache misses, only growing when necessary to support the increased needs of players.

When the cache "grows", it takes a moment to copy it's data into a new, larger location in memory. "growthFactor" determines how much larger this location should be than the last location. Larger values result in less copying and hence lag, but more poorly associate the right cache size with your needs. E.g. a factor of 2 makes for little copying but potentially twice the resources consumed than needed if you just barely trigger a resizing. Values closer to 1 may result in good matching of resources, but will result in excessive copying (and even slow response to needs), especially at larger cache sizes.

For you fellow computer science geeks, this is an aging page replacement algorithm (except not pages), using a 64-bit "age" for each cache entry, shifting once every tick (about 20 times a second) further reading. The "growthFactor" tradeoffs are directly associated with that of a dynamic array's.


Property Default Value Description
startingCacheSize 16 The size to initialize the area cache at. Not bad to set it higher if you have a large server, to avoid the lag of resizing. Each player will need at least one area at any time, but players also frequently inhabit the same area, resulting in overlap.
verboseLogging false If set to true, will spit info out to the console whenever there's a "cache miss" or a cache resizing. Specifically, the number of misses, pctMisses, and avgPctMisses at that tick.
pctMissThreshold 1.0 Triggers a "grow" when exceeded by "pctMiss" (set to 100% by default, basically not used. Almost like an emergency "GROW MY DANG CACHE NOW" threshold, which may be ill-advised)
avgPctMissThreshold 1.0E-4 Triggers a "grow" when exceeded by "avgPctMiss"
growthFactor 2.0 The relative amount to increase the cache's resources by when a "grow" occurs.
avgPctMissPastWeight 0.96 The weight to give to the past "avgPctMiss" when calculating the exponential average. Should be between .85 and 1.0. Too low and your cache will grow too frequently, eventually crashing your server-- too high and your cache never grows in response to cache misses, causing lag of Biblical proportions and also potentially crashing your server.

Remember to test this stuff out! If you're testing with a large player base, gradually make changes and see how they go so you don't piss everyone off. Take notes even-- save old "areaCache.properties" and write notes at the bottom of it, so you can go back to good settings once you've found them. Finally, good settings on one machine aren't necessarily good another, especially if the system specs are drastically different (SSD vs Harddisk, low-end CPU vs monster CPUs, etc)

And most importantly, enjoy speeding up your server and improving its stability!

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox