Skip to content

Fake player count ranges for licensed users #25

Description

@Devsome

Motivation

Licensed users of silkpanel‑cms may want to display a higher or more dynamic player count to create a lively community impression. This feature allows paying users to define multiple “real → fake” player count mappings via the Filament admin panel. The displayed player count will be the real count plus a randomly generated fake amount that stays consistent for a reasonable period – avoiding wild jumps on every page reload.

Proposed solution

  1. Admin configuration interface
    A new settings page (or Filament resource) inside the admin panel, available only to users with a valid license (permission‑checked). The user can:

    • Create, edit, and delete range rules.
    • Each rule defines:
      • Real player count range – minimum and maximum (e.g., 0–50).
      • Fake player count range – minimum and maximum (e.g., 15–26).
    • Rules are ordered; the first matching real‑range is used.
    • Optionally enable/disable the entire fake player overlay feature.
  2. Fake count calculation logic
    When a player count is requested (e.g., for a public API or widget):

    • The system determines the current real player count.
    • Finds the applicable range rule.
    • Generates a fake offset value within the fake range, but not purely random on every call. The value is seeded by a combination of server identity and the current time interval (e.g., changes every 10–15 minutes). This ensures that multiple rapid requests return the same fake count, avoiding obvious inconsistencies.
    • The final displayed count = real count + fake offset (capped appropriately).
  3. Stability and caching
    The generated fake offset is cached locally for a configurable interval (default e.g., 10 minutes). After the interval expires, a new fake value is calculated. This prevents drastic changes on every refresh while still allowing the count to fluctuate slowly over time.

  4. No impact on real data
    The real player count stored on the server remains untouched. Only the “public” count returned to templates, APIs, or widgets is augmented.

Acceptance criteria

  • A new admin section in that „Page Sttings“ (e.g., “Fake Player Settings”) is visible only to users whose license is active and valid.
  • The interface allows adding multiple range rules with real min/max and fake min/max (all positive integers).
  • Validation ensures real min ≤ real max and fake min ≤ fake max. Real ranges must not overlap (or the system uses a clear priority order, ideally top‑to‑bottom).
  • A global toggle enables/disables the fake player feature.
  • When enabled, the displayed player count equals real + fake_offset where fake_offset is stable for a configured time window (default 10 minutes) and then smoothly changes to a new random value within the matching fake range.
  • If no range matches the current real player count, no fake offset is added (displayed count = real count).
  • The feature introduces no breaking changes to existing player count APIs or views; it acts as a transparent layer.
  • Works reliably without affecting server performance.
  • Proper error handling: invalid ranges are rejected with clear feedback; missing rules or disabled feature simply return the unmodified real count.

Out of scope

  • Frontend implementation (how the count is displayed on the public site) – this ticket focuses on admin configuration and backend logic.
  • Tracking or analytics of fake vs. real counts.
  • Automatic adjustment of ranges based on actual player trends.

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions