Files
Bubberstation/code/controllers/subsystem/dynamic/dynamic_logging.dm
Vekter 83e179ee21 Drastically simplifies the roundstart report (#89150)
## About The Pull Request

The roundstart report has been changed in the following ways:

- There are now only four alert levels: Yellow Star (0-65 Threat), Red
Star (66-79 Threat), Black Orbit (80-99 Threat), and Midnight Sun (100
Threat).
- The roundstart report is now 100% accurate.
- Extended rounds will still show the "No credible threat" alerts, but
this should only happen if an admin sets the round to Extended.

## Why It's Good For The Game

The current roundstart report system is too granular as it is now, which
leads to situations where players will suicide 5-10 minutes into the
round due to the threat level being too low. Making it potentially
random was meaningless, because players would just act on whatever it
said without actually giving the round a chance to do anything.

I also feel like this brings back a fair bit of paranoia to the round,
as low threat levels would often just result in people expecting nothing
to happen. That can be fun when the report is lying, but it doesn't
happen often enough to really make it worth keeping.

We tested this a few months ago and the results seemed positive. We also
had a lot of discussion about the matter and, while I'm open to changing
implementation in some ways, I'm pretty set on this being a beneficial
change, at least in the short term until we can make Dynamic more
interesting.

I kept the high threat level stuff because it's fun to know some crazy
shit might happen. I might bring back the random threat level thing to
differentiate between those but I don't really care tbh; the targeted
behavior here is people bailing on low threat rounds, not people knowing
it's a high threat round.
## Changelog
🆑 Vekter
balance: The roundstart report will now display a more broad, less
specific message about threat levels when between 0 and 80 threat.
/🆑
2025-01-21 21:45:45 -08:00

101 lines
3.0 KiB
Plaintext

/// A "snapshot" of dynamic at an important point in time.
/// Exported to JSON in the dynamic.json log file.
/datum/dynamic_snapshot
/// The remaining midround threat
var/remaining_threat
/// The world.time when the snapshot was taken
var/time
/// The total number of players in the server
var/total_players
/// The number of alive players
var/alive_players
/// The number of dead players
var/dead_players
/// The number of observers
var/observers
/// The number of alive antags
var/alive_antags
/// The rulesets chosen this snapshot
var/datum/dynamic_snapshot_ruleset/ruleset_chosen
/// The cached serialization of this snapshot
var/serialization
/// A ruleset chosen during a snapshot
/datum/dynamic_snapshot_ruleset
/// The name of the ruleset chosen
var/name
/// If it is a round start ruleset, how much it was scaled by
var/scaled
/// The number of assigned antags
var/assigned
/datum/dynamic_snapshot_ruleset/New(datum/dynamic_ruleset/ruleset)
name = ruleset.name
assigned = ruleset.assigned.len
if (istype(ruleset, /datum/dynamic_ruleset/roundstart))
scaled = ruleset.scaled_times
/// Convert the snapshot to an associative list
/datum/dynamic_snapshot/proc/to_list()
if (!isnull(serialization))
return serialization
serialization = list(
"remaining_threat" = remaining_threat,
"time" = time,
"total_players" = total_players,
"alive_players" = alive_players,
"dead_players" = dead_players,
"observers" = observers,
"alive_antags" = alive_antags,
"ruleset_chosen" = list(
"name" = ruleset_chosen.name,
"scaled" = ruleset_chosen.scaled,
"assigned" = ruleset_chosen.assigned,
),
)
return serialization
/// Updates the log for the current snapshots.
/datum/controller/subsystem/dynamic/proc/update_log()
var/list/serialized = list()
serialized["threat_level"] = threat_level
serialized["round_start_budget"] = initial_round_start_budget
serialized["mid_round_budget"] = threat_level - initial_round_start_budget
var/list/serialized_snapshots = list()
for (var/datum/dynamic_snapshot/snapshot as anything in snapshots)
serialized_snapshots += list(snapshot.to_list())
serialized["snapshots"] = serialized_snapshots
rustg_file_write(json_encode(serialized), "[GLOB.log_directory]/dynamic.json")
/// Creates a new snapshot with the given rulesets chosen, and writes to the JSON output.
/datum/controller/subsystem/dynamic/proc/new_snapshot(datum/dynamic_ruleset/ruleset_chosen)
var/datum/dynamic_snapshot/new_snapshot = new
new_snapshot.remaining_threat = mid_round_budget
new_snapshot.time = world.time
new_snapshot.alive_players = GLOB.alive_player_list.len
new_snapshot.dead_players = GLOB.dead_player_list.len
new_snapshot.observers = GLOB.current_observers_list.len
new_snapshot.total_players = new_snapshot.alive_players + new_snapshot.dead_players + new_snapshot.observers
new_snapshot.alive_antags = GLOB.current_living_antags.len
new_snapshot.ruleset_chosen = new /datum/dynamic_snapshot_ruleset(ruleset_chosen)
LAZYADD(snapshots, new_snapshot)
update_log()