Temple Games
New York, New York, USA
This document contains information subject to the confidentiality and ownership rights of Rory Garton-Smith / Temple Games.
Video demonstration of the deterministic physics engine in action
Background
This invention relates to computer-implemented gaming systems, specifically to methods and systems for creating deterministic physics-based games of chance with controlled Return to Player (RTP) percentages through pre-computed physics simulations and probability distribution modeling.
Traditional online games of chance rely on random number generators (RNGs) to determine outcomes, which can lead to unpredictable variance in RTP percentages over time. While these systems can achieve target RTPs over very large sample sizes, they cannot guarantee precise RTP control for smaller gaming sessions or specific time periods.
Physics-based games of chance, such as Plinko, roulette, or ball-drop games, typically use real-time physics engines to simulate realistic ball movement and collision dynamics. However, these real-time simulations are computationally expensive and cannot guarantee specific outcome distributions required for precise RTP control.
Existing systems either sacrifice realistic physics for RTP control (using pure RNG with predetermined outcomes) or sacrifice RTP precision for realistic physics (using real-time physics engines with unpredictable outcomes).
There exists a need for a system that combines realistic physics-based gameplay with precise RTP control while maintaining computational efficiency and provable fairness.
Summary
The present invention provides a novel method and system for creating deterministic physics-based games of chance with precise RTP control through pre-computed physics simulations and probability distribution modeling.
The system comprises:
- A physics simulation engine that pre-computes realistic game outcomes using accurate physics modeling.
- An RTP calculation and adjustment algorithm that modifies natural probability distributions to achieve target RTP percentages.
- A drop generation system that creates the exact number of physics simulations needed for each outcome bin according to the adjusted probability distribution.
- A storage and retrieval system for managing large datasets of pre-computed physics simulations.
- A runtime selection system that chooses appropriate pre-computed simulations during gameplay while maintaining the appearance of real-time physics.
The invention enables precise RTP control (within 1–3% of target values) while maintaining realistic physics-based animations and ensuring provable fairness through auditable pre-computed outcomes.
Detailed Description
System Architecture
The deterministic physics engine system consists of several interconnected components:
- Physics Simulation Engine. Utilizes a high-fidelity physics library (e.g., Matter.js, Box2D) to create realistic simulations. For Plinko-style games, this includes:
- Ball physics with realistic mass, velocity, and collision properties.
- Peg collision detection and response with appropriate restitution coefficients.
- Gravity simulation and air resistance modeling.
- Bin detection and outcome recording.
- RTP Calculation and Adjustment Algorithm. Determines the required probability distribution for each game configuration to achieve target RTP:
- Calculate natural probability distribution using binomial theory or empirical testing.
- Compute natural RTP: Natural RTP = Σi Pnatural,i × Multiplieri.
- Determine adjustment factor: Adjustment_factor = Target_RTP / Natural RTP.
- Apply bin-specific adjustment function f(Adjustment_factor, i).
- Calculate drop counts: Total_drops × Adjusted_probabilities[i].
- Drop Generation System. Generates the required number of simulations per outcome bin:
- Adaptive initial positioning based on target bin probability.
- Multi-attempt persistence with increasing position variance.
- Extreme positioning strategies for rare outcomes.
- Duplication algorithms as fallback for unachievable targets.
- Validation and storage of trajectory data for each simulation.
- Storage and Retrieval System. Manages large datasets of pre-computed simulations:
- Hierarchical file organization by configuration and risk level.
- JSON format with compressed trajectory data and metadata (timestamps, achieved RTP, checksums).
- File naming convention:
drops-{configuration}-{risk_level}.json.
- Runtime Selection System. Selects and plays back simulations during gameplay:
- Determine target outcome bin from adjusted distribution.
- Load the appropriate simulation file.
- Randomly select a pre-computed trajectory.
- Play back trajectory for smooth, real-time animation.
- Optimize performance via smart caching, background preloading, and memory management.
Implementation Examples
The following TypeScript code examples demonstrate the core patentable algorithms and methods of the deterministic physics engine system.
RTP Calculation and Adjustment Algorithm
The mathematical foundation of the patent lies in the RTP calculation and probability adjustment algorithm:
interface BinDistribution {
binIndex: number;
naturalProbability: number;
adjustedProbability: number;
dropCount: number;
multiplier: number;
}
export const TARGET_RTP = {
[RiskLevel.LOW]: 0.9, // 90% RTP
[RiskLevel.MEDIUM]: 0.85, // 85% RTP
[RiskLevel.HIGH]: 0.8, // 80% RTP
} as const;
/**
* Core RTP adjustment algorithm - the heart of the patent
*/
export function adjustProbabilitiesForTargetRTP(
rowCount: number,
riskLevel: RiskLevel,
totalDrops: number = 5000
): BinDistribution[] {
const naturalProbs = calculateNaturalProbabilities(rowCount);
const multipliers = binPayouts[rowCount][riskLevel];
const targetRTP = TARGET_RTP[riskLevel];
const naturalRTP = calculateNaturalRTP(naturalProbs, multipliers);
const adjustmentFactor = targetRTP / naturalRTP;
// Apply bin-specific adjustment function
const adjustedProbs = naturalProbs.map((prob, binIndex) => {
return prob * getBinAdjustmentFactor(adjustmentFactor, binIndex, naturalProbs.length);
});
// Normalize probabilities to sum to 1
const probSum = adjustedProbs.reduce((sum, prob) => sum + prob, 0);
const normalizedProbs = adjustedProbs.map(prob => prob / probSum);
// Calculate exact drop counts
return normalizedProbs.map((prob, binIndex) => ({
binIndex,
naturalProbability: naturalProbs[binIndex],
adjustedProbability: prob,
dropCount: Math.round(totalDrops * prob),
multiplier: multipliers[binIndex]
}));
}Physics Simulation Engine with Trajectory Capture
The physics simulation engine captures complete trajectory data for pre-computation:
interface DropTrajectory {
id: string;
targetBin: number;
actualBin: number;
frames: TrajectoryFrame[];
collisions: CollisionEvent[];
duration: number;
isValid: boolean;
}
export class DeterministicDropGenerator {
private engine: Matter.Engine;
private world: Matter.World;
/**
* Generate physics simulation for specific target bin
* Core method for creating deterministic outcomes
*/
async generateDropForBin(
targetBin: number,
maxAttempts: number = 1000
): Promise<DropTrajectory | null> {
for (let attempt = 0; attempt < maxAttempts; attempt++) {
const trajectory = await this.simulateSingleDrop(targetBin, attempt);
if (trajectory && trajectory.actualBin === targetBin && trajectory.isValid) {
return trajectory;
}
}
// Apply extreme positioning strategy for difficult bins
return await this.generateWithExtremePositioning(targetBin);
}
/**
* Simulate single drop with trajectory capture
*/
private async simulateSingleDrop(
targetBin: number,
attempt: number
): Promise<DropTrajectory> {
// Adaptive initial positioning based on target bin
const initialX = this.calculateInitialPosition(targetBin, attempt);
const ball = this.createBall(initialX);
const trajectory: DropTrajectory = {
id: `drop_${targetBin}_${attempt}_${Date.now()}`,
targetBin,
actualBin: -1,
frames: [],
collisions: [],
duration: 0,
isValid: true
};
// Simulation loop with frame capture
let frameCount = 0;
const maxFrames = 300; // 5 seconds at 60fps
while (frameCount < maxFrames) {
Matter.Engine.update(this.engine, 1000 / 60);
// Capture frame data
trajectory.frames.push({
timestamp: frameCount * (1000 / 60),
position: { x: ball.position.x, y: ball.position.y },
velocity: { x: ball.velocity.x, y: ball.velocity.y },
rotation: ball.angle
});
// Check if ball reached bottom
if (ball.position.y > this.getBinLevel()) {
trajectory.actualBin = this.determineBin(ball.position.x);
break;
}
frameCount++;
}
// Validate trajectory realism
trajectory.isValid = this.validateTrajectory(trajectory);
return trajectory;
}Deterministic Runtime Selection System
The runtime system selects pre-computed simulations while maintaining unpredictability:
export class DeterministicPlinkoEngine {
private dropDatabase: PrecomputedDropDatabase = {};
private binDistribution: BinDistribution[] = [];
/**
* Core deterministic selection method
* Uses RTP-adjusted probabilities to select target bin, then chooses simulation
*/
selectDeterministicDrop(): DropTrajectory {
// Step 1: Determine target bin using RTP-adjusted probabilities
const targetBin = this.selectTargetBinWithRTPControl();
// Step 2: Select random simulation from target bin
const availableDrops = this.getDropsForBin(targetBin);
if (availableDrops.length === 0) {
throw new Error(`No drops available for bin ${targetBin}`);
}
const randomIndex = Math.floor(Math.random() * availableDrops.length);
return availableDrops[randomIndex];
}
/**
* RTP-controlled target bin selection
* Maintains unpredictability while ensuring RTP adherence
*/
private selectTargetBinWithRTPControl(): number {
const random = Math.random();
let cumulativeProbability = 0;
for (const binData of this.binDistribution) {
cumulativeProbability += binData.adjustedProbability;
if (random <= cumulativeProbability) {
return binData.binIndex;
}
}
// Fallback to last bin
return this.binDistribution[this.binDistribution.length - 1].binIndex;
}
}Adaptive Generation with Persistence Algorithms
Advanced generation techniques for difficult-to-achieve outcomes:
export class AdaptiveDropGenerator extends DeterministicDropGenerator {
/**
* Generate drops with persistence for difficult bins
*/
async generateDropsForBinWithPersistence(
targetBin: number,
requiredCount: number
): Promise<DropTrajectory[]> {
const generatedDrops: DropTrajectory[] = [];
const maxAttemptsPerDrop = this.calculateMaxAttempts(targetBin);
for (let i = 0; i < requiredCount; i++) {
let drop: DropTrajectory | null = null;
let attempts = 0;
// Standard generation attempts
while (!drop && attempts < maxAttemptsPerDrop) {
drop = await this.generateDropForBin(targetBin, 100);
attempts += 100;
}
// Extreme positioning if standard fails
if (!drop) {
drop = await this.generateWithExtremePositioning(targetBin);
}
// Duplication with variation as last resort
if (!drop && generatedDrops.length > 0) {
drop = this.duplicateWithVariation(generatedDrops[0], targetBin);
}
if (drop) {
generatedDrops.push(drop);
}
}
return generatedDrops;
}
/**
* Calculate maximum attempts based on bin difficulty
*/
private calculateMaxAttempts(targetBin: number): number {
const binCount = this.rowCount + 1;
const centerBin = (binCount - 1) / 2;
const distanceFromCenter = Math.abs(targetBin - centerBin);
// Edge bins are exponentially more difficult
const difficultyMultiplier = Math.pow(2, distanceFromCenter);
return Math.min(100000, 1000 * difficultyMultiplier);
}
}Trajectory Validation and Quality Control
Validation algorithms ensure physics realism and prevent exploitation:
export class TrajectoryValidator {
/**
* Comprehensive trajectory validation
*/
static validateTrajectory(trajectory: DropTrajectory): boolean {
return (
this.validatePhysicsRealism(trajectory) &&
this.validateTemporalConsistency(trajectory) &&
this.validateCollisionLogic(trajectory) &&
this.validateOutcomePlausibility(trajectory)
);
}
/**
* Validate physics realism (velocity, acceleration constraints)
*/
private static validatePhysicsRealism(trajectory: DropTrajectory): boolean {
const maxVelocity = 1000; // pixels per second
const maxAcceleration = 2000; // pixels per second squared
for (let i = 1; i < trajectory.frames.length; i++) {
const frame = trajectory.frames[i];
const prevFrame = trajectory.frames[i - 1];
const dt = (frame.timestamp - prevFrame.timestamp) / 1000;
// Check velocity constraints
const velocityMagnitude = Math.sqrt(
frame.velocity.x ** 2 + frame.velocity.y ** 2
);
if (velocityMagnitude > maxVelocity) {
return false;
}
// Check acceleration constraints
const acceleration = {
x: (frame.velocity.x - prevFrame.velocity.x) / dt,
y: (frame.velocity.y - prevFrame.velocity.y) / dt
};
const accelerationMagnitude = Math.sqrt(
acceleration.x ** 2 + acceleration.y ** 2
);
if (accelerationMagnitude > maxAcceleration) {
return false;
}
}
return true;
}
}Claims
- A computer-implemented method for generating deterministic physics-based game outcomes with controlled Return to Player (RTP) percentages, comprising:
- Calculating a natural probability distribution for game outcomes using physics simulation;
- Determining adjustment factors to modify said natural probability distribution to achieve a target RTP percentage;
- Generating a predetermined quantity of physics simulations for each possible outcome according to said adjusted probability distribution;
- Storing said physics simulations in a retrievable data structure organized by game configuration and outcome.
- The method of claim 1, wherein the physics simulations comprise frame-by-frame trajectory data including position coordinates, velocity vectors, and collision events.
- The method of claim 1, wherein generating physics simulations includes persistence algorithms for achieving low-probability outcomes through multiple generation attempts with varied initial conditions.
- The method of claim 1, further comprising implementing extreme positioning strategies and trajectory duplication for outcomes that cannot be achieved through normal physics simulation.
- A computer-implemented method for executing deterministic physics-based games with controlled RTP, comprising:
- Receiving user selection of game configuration and risk level;
- Loading pre-computed physics simulation data corresponding to said configuration;
- Determining a target outcome using RTP-adjusted probability distribution;
- Selecting a physics simulation from said pre-computed data corresponding to said target outcome;
- Playing back said selected physics simulation as real-time animation.
- The method of claim 5, further comprising caching simulation data and preloading related configurations to optimize performance.
- The method of claim 5, wherein the target outcome determination maintains unpredictability while ensuring adherence to predetermined RTP percentages.
- A system for deterministic physics-based gaming with RTP control, comprising:
- A physics simulation engine for generating realistic game outcome trajectories;
- An RTP calculation module for determining required outcome distributions;
- A data storage system for organizing pre-computed simulation data;
- A runtime selection engine for choosing appropriate simulations during gameplay.
- The system of claim 8, wherein the physics simulation engine supports multiple game types including Plinko, roulette, dice games, and ball drop games.
- The system of claim 8, further comprising validation algorithms to ensure physics realism and prevent exploitation of the deterministic system.