Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Weekly Developer Update #16

In-Game Rewards Validator

Current Development Focus

In this week’s dispatch, we’ll delve into a topic of great importance as we chart the course of our game’s evolution.

As anticipation builds for the implementation of game rewards in the coming months, it is crucial to ensure the integrity of our in-game economy.

Establishing robust protection mechanisms is the cornerstone for an economy that not only thrives but also endures the test of time in the long-term.

Strap in as we navigate the intricacies of game score validation algorithms.

Purpose of the Validator

Our development efforts are currently centered around ensuring fair reward distribution and safeguarding our game’s economy against exploits, hacks, and other threats. This is where the in-game validator plays a pivotal role.

Working Principle

The validator operates on an algorithm that references the core metrics of the game:

  • Time, measured in seconds, with a cap of 5 minutes.
  • Energy generation, gauged per second.
  • Energy spent throughout the game.
  • Score, measured by the damage dealt in-game.

Establishing Baselines

We’ve set baselines using average gameplay data:

  • Time ranges from 0 to 5 minutes.
  • Energy generation averages at 0.5 per second.
  • The initial energy is 30 points, which, along with the average energy generation, is expected to be fully spent by game’s end.
  • The maximum score for a well-played game lasting 5 minutes is around 550,000 points.

Understanding the Problem

Imagine a well-designed game where a perfect 5-minute session yields a maximum score of 550,000 points.

The challenge is to extrapolate this to any gameplay duration and establish checks for energy usage and score efficiency.

Derived Metrics and Validation Process

We employ derived metrics for suspicious activity detection:

  • Energy Generated: Calculated as 30+(0.5×Time in seconds)30+(0.5×Time in seconds).
  • Energy Balance Validation: We verify if the energy generated equals the energy spent. Discrepancies here may indicate irregularities.
  • Score Validation: We’ve established a maximum scoring rate based on the best possible score over time. Exceeding this rate triggers a flag.
  • Efficiency Validation: Efficiency is scored by the ratio of points to energy spent. A threshold identifies when efficiency deviates beyond expected gameplay.

Step-by-Step Solution

1. Calculate Maximum Score Rate

First, we determine how many points can be scored per second in a perfect game:

Max Score Rate = Total Points / Total Seconds
Max Score Rate = 550,000 points / (5 minutes * 60 seconds per minute)

2. Estimate Maximum Plausible Score

Next, we calculate the maximum score possible for any given time:

Max Plausible Score = Max Score Rate * Time in Seconds

3. Validate Energy Usage

Our game also involves energy as a resource. We need to ensure that the energy claimed to be spent aligns with the time played:

Energy Generated = Base Energy + (Energy per Second * Time in Seconds)
The energy balance is valid if the energy generated matches the energy reported as spent.

4. Check Efficiency

Efficiency is the ratio of the score to the energy spent. We want to catch impossible efficiencies that could indicate cheating:

Efficiency = Score / Energy Spent

Efficiency is valid if it does not exceed a certain threshold determined by analyzing legitimate gameplay data.

5. Combining Evidence

By aggregating evidence from these metrics, we develop a ‘suspicion score.’ If this score crosses a predefined limit, the session may be flagged for review.

Implementing the Validation Algorithm

While Motoko is our language of choice for Internet Computer development, our code below can be adapted to any other language:

FUNCTION maxPlausibleScore(timeInSeconds):
maxScoreRate = 550000 / (5 * 60)
RETURN maxScoreRate * timeInSeconds

FUNCTION validateEnergyBalance(timeInSeconds, energySpent):
energyGenerated = 30 + (0.5 * timeInSeconds)
RETURN energyGenerated == energySpent

FUNCTION validateEfficiency(score, energySpent, efficiencyThreshold):
efficiency = score / energySpent
RETURN efficiency <= efficiencyThreshold

FUNCTION validateGame(timeInSeconds, energySpent, score, efficiencyThreshold):
maxScore = maxPlausibleScore(timeInSeconds)
isScoreValid = score <= maxScore
isEnergyBalanceValid = validateEnergyBalance(timeInSeconds, energySpent)
isEfficiencyValid = validateEfficiency(score, energySpent, efficiencyThreshold)
RETURN isScoreValid AND isEnergyBalanceValid AND isEfficiencyValid

Continuous Improvement and Validation

Our algorithm undergoes constant refinement:

Anomaly Detection:

We’ve been implementing the use of statistical methods and machine learning to spot significant deviations from expected gameplay patterns.

Continuous Validation

We will periodically adjust our algorithm based on new data, strategies, or exploits that emerge.

Feedback Loop

Player feedback is integral to our refinement process, helping to enhance the accuracy and fairness of our validation system.

Transparency and Fairness:

We maintain an open and fair validation process, keeping player trust at the forefront of our efforts.

Wrap-up

That is it for this week, commanders.

We trust you found insight in our exploration of algorithm construction mechanisms that anchor firmly in real data and practical applications.

This isn’t mere theory; we’re actively weaving these principles into the very code that underpins our game.

Your strategic mind is invited to scrutinize and audit our code within the canisters.

Github

https://github.com/worldofunreal/cosmicrafts-motoko-backend#validation

With no further ado, let’s forge ahead in our quest to build the most immersive RTS the galaxy has ever seen!

Thank you for joining us in this journey, and until next time, keep your fleets ready and your wits sharp.


Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.