Grief: Per-player event logging window
Posted: Fri Apr 14, 2017 12:29 am
(I am posting here mainly to ask, has anyone else tried this yet? I don't want to be reinventing the wheel.)
I have decided I am fed up with how crappy and basically useless the administrator user management tools are, and so I am just going to make a wild blind stab at trying to find a solution myself.
I don't really know C/C++/LUA or all the data storage methods, so my code for this will likely be an inelegant mess. Maybe this will work. Maybe not. I am just going to try, and see what happens.
Hopefully this could be implemented entirely via control.lua so anyone can use this, including on vanilla games.
Method and potential problems:
I have decided I am fed up with how crappy and basically useless the administrator user management tools are, and so I am just going to make a wild blind stab at trying to find a solution myself.
I don't really know C/C++/LUA or all the data storage methods, so my code for this will likely be an inelegant mess. Maybe this will work. Maybe not. I am just going to try, and see what happens.
Hopefully this could be implemented entirely via control.lua so anyone can use this, including on vanilla games.
Method and potential problems:
- Log all the things, in a ridiculously huge memory buffer. There is apparently no way to write these event logs to disk and then just sequentially read_file("./temp/currently-playing/logfile",linenumber) the specific small data range that we want to show at this moment.
Fine, whatever. I will try putting 10,000 to 100,000 lines of player event history in memory and just see what happens.- I have no idea what the memory limits are for indexed tables. I assume it is unbounded and really only limited by the player's local memory, and automatically saved into the savegame ZIP.
- Since this is textual data with high repetition, it will likely compress 90% or more inside a savegame ZIP, so likely won't add much to the ZIP size sent to all players.
- Tokenizing the event storage might save more memory without being verbose, though with added line display complexity. I am not worrying about this at the beginning.
- When the arbitrarily chosen event logging capacity limit is reached, either:
- Loop back to the beginning and start overwriting old events in each player's event log
- Nul each oldest event line in player's event log table, each time the table element counter adds new event lines to that table.
- Splitting this logging to be separate for each player, rather than a single combined log of all players events, would make it easier to spot grief events in these logs. I will need another window for selecting the event histories for logged-on and logged-off players, in order of most recent logon/off event.
- I also need to find a way to expire old data across these separate player eventlog tables, in a linear manner, as the memory storage limit is reached, new players join and new eventlog tables are created for those new players.
- It is currently unknown to me if a player that set fire to or has used grenades on a factory object causes them to be assigned as the owner of it, before it is destroyed. This would be needed for separate player event log windows to work for item grief tracking with flamethrower/grenade.
- Looks like I'm going to have to fake up my own resizeable, moveable GUI window, that re-paginates when the number of visible lines changes.
- I expect faking line-scrolling in a table array for every event via LUA is going to suck, so probably best to treat the logged data as pages and clear the frame when the bottom line is reached, as that eliminates scrolling refresh for every line.
- Dynamic window resizing and dragging would be useful, but currently I have no idea if "MouseDown" cursor detection events are possible.
- Buttons at the top advance by page: Go to oldest page, back 1 page, back 10, back 100, forward 100, forward 10, forward 1, Go to newest page.
- When viewing old records, the progress bar shows where we are viewing in the log, acting as a scroll indicator. It is updated and adjusts, as new data is added and old event data is removed.
- I don't yet know if a progress bar can act as an actual scroll bar, receiving clicks and reporting click position, then jumping to that log page relative to the click.
- Clicking the Show button to the left of event lines with coordinates, should have some way to highlight the affected tile or selection area.
- Allow admins to instantly undo the actions of players, or immediately Kick or Ban them via the GUI.
- Add new admin feature, Freeze, to temporarily lock suspected griefers in place and prevent any further actions, except writing messages in the console.
- Player message: "Only admins can use Undo or Freeze/Kick/Ban buttons."
- Player message: "You have been FROZEN by admin Plawerth. All actions except quit are blocked, but you can still talk."
- Pop-up admin confirmation window: "Undoing this logged event will remove item(s) 'x' currently at this position. The game will be briefly paused, the object replaced, and original owner reassigned. Players in the way of the Undo, will be moved to the map spawn. Removed objects will be logged and can be restored. Continue?"
- Allow admins to instantly undo the actions of players, or immediately Kick or Ban them via the GUI.