11 KiB
Server.cfg Style Standards (Draft)
Scope
This draft defines style and section-order standards for .cfg files that follow server.cfg conventions in this repository.
Primary references used for this draft:
Additional pilot samples used to validate cross-family behavior:
Style Rules
1) File Preamble
- Use a visible file header block at top of file.
- Header must include game name, file name, and version/date.
- Prefer the template border style from template/server.cfg.template.
- Keep one blank line after header.
2) Section Headings
- Group settings in named sections.
- Preferred heading style:
- // ............................. Section Name ............................ //
- Use one blank line before each section heading.
- Keep heading names short, stable, and semantic (Basic, Logging, Network, Security, Gameplay, Rotation, Exec).
3) Setting Documentation
- Each configurable setting should be documented immediately above the setting.
- Preferred description line format:
- // cvar_name - Short purpose statement.
- Optional lines:
- // Default: cvar_name value
- // Recommended: cvar_name value
- // Example: cvar_name "value"
- Keep comments objective and avoid conversational phrasing.
4) Assignment Style
- Use the native command style of the family and do not mix styles in one file:
- Source/GoldSrc: direct cvar assignment (example: sv_lan 0)
- id Tech/Quake/Jedi: set or seta (example: set sv_hostname "SERVERNAME")
- CoD/CoD4X: set or sets for metadata
- One setting per line.
- Inline comments are allowed only when concise and not a substitute for full setting docs.
5) Quoting and Value Conventions
- Quote string values.
- Do not quote numeric values unless the engine style in that family consistently uses quotes.
- Keep placeholders uppercase for user-provided secrets or names (SERVERNAME, ADMINPASSWORD).
6) Spacing and Layout
- Keep one blank line between logical setting groups.
- Avoid repeated blank lines.
- No trailing whitespace.
- Keep lines readable; long map rotations may remain on one line only when engine syntax requires it.
7) Includes and Runtime Commands
- Keep includes/exec directives in a dedicated Exec or Ban section near end of configuration sections.
- Final startup actions (for example map or rotation start commands) should be placed in final section.
8) Comment Language and Tone
- Use clear technical English.
- Avoid jokes, uncertainty comments, or subjective wording in standards-conforming files.
Recommended Baseline Cvars to Add to the Standard
These are high-value cvars that should be explicitly tracked in the standard, but are not currently required as a baseline list.
Source and GoldSrc Baseline Candidates
sv_setsteamaccount- Required for modern server token registration on many Source deployments.sv_pure(ormp_consistencyfor older GoldSrc variants) - Asset consistency and anti-cheat hardening.sv_minrate,sv_maxrate- Network throughput guardrails.sv_minupdaterate,sv_maxupdaterate- Tick/update policy consistency.sv_mincmdrate,sv_maxcmdrate- Client command rate policy consistency.sv_timeout- Connection timeout stability baseline.sv_contact- Admin contact traceability.logaddress_add(if remote logging is used) - Centralized moderation/audit logging.sv_tags- Discoverability and server browser clarity.
Cross-Family Candidates
sv_region(or family equivalent) - Predictable regional listing.- Explicit startup command (
map,map_rotate,vstr, or family equivalent) - deterministic boot behavior. - Explicit ban include/write commands (
exec banned*.cfg,writeid,writeip, or family equivalent) - ban persistence.
Note: Not all candidates apply to every engine family. Standards should tag each cvar as required, recommended, or not-applicable per family.
Style Conformance Checklist
Use this checklist for each file.
- Header block exists and contains game + file + version/date.
- Section headings are present and consistently formatted.
- Every critical setting has a preceding purpose comment.
- Default/recommended/example lines are used consistently where needed.
- Assignment style is consistent with config family.
- Quote usage is consistent with family norms.
- Blank-line spacing is consistent and minimal.
- Includes/exec commands grouped in a dedicated section.
- Startup commands (map/map_rotate/vstr) located at end section.
- Comment tone is technical and neutral.
Section-Order Models by Config Family
Model A: Source and GoldSrc Family
Applies to files like csgo/server.cfg, cs/server.cfg, ins/server.cfg.
Recommended order:
- Basic identity and access (hostname, rcon, server password, contact, region)
- Security and trust (sv_lan, sv_cheats, anti-cheat, upload/download)
- Logging and diagnostics
- Network and rates
- Voice/chat/social rules
- Gameplay and mode rules
- Matchmaking/playlists and mapcycle
- Voting/admin controls
- Banlist and exec include files
- Startup map/rotation trigger
Model B: id Tech and Quake-Derived Family
Applies to files like q3/server.cfg, jk2/server.cfg.
Recommended order:
- Server identity and access
- Master server registration and visibility
- Network and player limits
- Core gameplay limits (timelimit, fraglimit, gametype)
- Advanced gameplay cvars
- Logging
- Map rotation variable chain
- Final rotation start command (vstr or map)
Model C: CoD and CoD4X Family
Applies to files like cod4/server.cfg.
Recommended order:
- Metadata (sets _Admin, _Website, etc.)
- Basics (hostname, dedicated, passwords)
- Logging/status files
- Networking and connection controls
- Protected or fixed engine variables section
- Gameplay shared settings
- Per-gamemode settings blocks
- Custom download/mod support
- Steam/platform toggles
- Startup map command (map_rotate or map)
Section-Order Checklist
Use this checklist to audit ordering independent of style details.
- File has identifiable sections.
- Section sequence matches one family model (A, B, or C).
- Identity/access appears before gameplay details.
- Logging appears before or near network diagnostics.
- Map cycle definitions appear near end of file.
- Final startup command appears in final section.
- Ban/exec includes appear in dedicated near-end section.
- No major section appears twice unless intentionally split and labeled.
Pilot Audit (No Bulk Edits Applied)
Pilot Coverage
- Template baseline: template/server.cfg.template
- Source family sample: csgo/server.cfg
- id Tech sample: q3/server.cfg
- CoD sample: cod4/server.cfg
- Extra checks: ins/server.cfg, jk2/server.cfg, cs/server.cfg
Style Violations Found
- Mixed heading widths and punctuation style.
- Some settings are grouped without full comment metadata (for example hibernation/query block).
- No explicit startup map/rotation terminal section.
- Missing standardized header block and explicit section headings.
- Frequent inline comments instead of preceding documentation lines.
- Section boundaries implied, not explicit.
- Comment tone includes subjective and conversational text.
- Section separators are inconsistent (different slash and hash divider styles).
- Very large gameplay block with weak sub-section boundaries.
- Non-standard top heading style and mixed separator conventions.
- Post-line comments often placed below with uneven style.
- Mixed density of documentation across related cvars.
- Minimal sectioning and partial comment coverage.
- Logging/admin sections not isolated as dedicated named sections.
- Mostly conforms, but header border and heading density differ from template style.
- Very long section with many voting settings would benefit from sub-sections.
Ordering Audit Results
- Family model: A (Source/GoldSrc)
- Result: Partial pass
- Ordering violations:
- Ban list appears early relative to broader gameplay/network model.
- No explicit terminal startup trigger section.
- Family model: B (id Tech)
- Result: Partial pass
- Ordering violations:
- No explicit section order markers, making audit and maintenance harder.
- Logging section absent as explicit block.
- Family model: C (CoD)
- Result: Pass with structural risk
- Ordering violations:
- Protected engine variables mixed into broader stream without strict section identity.
- Startup and platform toggles are near end but not wrapped in a final startup section.
- Family model: A (Source/GoldSrc)
- Result: Pass
- Ordering note:
- Strong sectioning already present; only normalization needed.
Proposed Fix Batches (Before Any Bulk Edits)
Batch 1: Header and section normalization
- Add template-style file header and stable section heading format.
- Target first: q3/server.cfg, jk2/server.cfg, cs/server.cfg.
- Risk: low.
Batch 2: Comment and setting doc normalization
- Convert conversational/mixed comments to neutral format.
- Add missing cvar purpose lines for critical settings.
- Target first: cod4/server.cfg, csgo/server.cfg.
- Risk: low to medium (human review needed to preserve intent).
Batch 3: Section-order realignment by family model
- Reorder blocks to Model A/B/C while preserving values.
- Introduce explicit final startup section.
- Target first: q3/server.cfg, cs/server.cfg, csgo/server.cfg.
- Risk: medium (ordering can impact load behavior if commands have dependencies).
Batch 4: Large-block decomposition
- Split long gameplay and vote blocks into labeled sub-sections.
- Target first: cod4/server.cfg, ins/server.cfg.
- Risk: medium (requires careful grouping review).
Notes
- This is a draft standard for review.
- No bulk edits were applied to configuration files in this pass.