๐ Script Flow
Map Creation Phase
Player initiates map creator
- Player opens the racing app in their laptop.
- Navigates to "MAP CREATOR" section.
- Fills in map configuration (name, race type: Sprint/Loop).
- Opens the map editor interface.
Map building process
- Player places start line using available props (flags, gantries).
- Player places checkpoints along the desired race route (minimum 1 required).
- Player places finish line (can be same location as start for loop races).
- Optionally places decoration props (barriers, lights, hay bales) for track aesthetics.
- Props can be rotated with
Rkey and distance adjusted with mouse scroll. - Player saves the map when complete.
Map validation
- System checks that start, finish, and at least one checkpoint are configured.
- Map is saved to database with creator information.
- If admin permissions are required, only admins can create maps.
- Maps can be verified by admins to enter official race pool.
Race Creation Phase
Player creates a race
- Player navigates to "MAPS" section in racing app.
- Selects a map from created maps.
- Clicks "Create Race" button.
- Configures race parameters:
- Entry Fee: Amount players must pay to join (cash/bank configurable).
- Start Delay: Time until race starts (1min, 5min, 30min, 1h, 5h, 24h).
- Vehicle Class: ALL, S, A, B, C, or D (restricts allowed vehicles).
- Collisions: Enable/disable player vehicle collisions.
- First Person View: Force FPV during race.
- Laps: Number of laps (for loop-type maps only).
- Race is created and becomes visible in "RACES" list and in game if it is the closest to start.
Official races (automated)
- System automatically generates official races based on
Config.OfficialRaceGenerator. - Official races are scheduled daily at configured times.
- Can use specific maps or randomly select from verified maps pool.
- Official races award MMR points and optional winner rewards.
- Discord webhook announces new official races (if configured).
Race Joining Phase
Player joins a race
- Player must be in a vehicle to join.
- System validates:
- Player has sufficient funds for entry fee (if required).
- Player's vehicle class matches race requirements.
- Player has unlocked required vehicle class skill (if skill tree enabled).
- Player is not already in another race.
- Entry fee is deducted (cash or bank based on config).
- Player enters waiting room state.
Joining restrictions
- Official races: Joining restricted to 30+ minutes before start time.
- Players can press
Eto leave waiting room before race starts. - Players who leave their vehicle are automatically removed from race.
- Vehicle class validation occurs at join time and race start time.
Pre-Race Phase
Waiting period
- Players in waiting room see countdown timer to race start.
- Players are teleported to assigned starting lanes.
- System checks vehicle class compatibility (removes invalid players).
- Race music begins playing (if enabled and not muted by player).
- Routing bucket is applied (isolates race instance if enabled).
- Local traffic is disabled (if configured).
Countdown sequence
- "Be ready!" notification displayed.
- Visual countdown on screen: 3... 2... 1... GO!
- Countdown sound effects play.
- Race officially begins.
Active Race Phase
Racing mechanics
- Checkpoint blips appear on map for navigation.
- 3D checkpoint markers visible in-game (if enabled).
- Player position syncs with other racers every 1 second (configurable).
- UI displays:
- Current checkpoint / lap information.
- Race progress (checkpoint X of Y).
- Current position in race.
- Distance to next checkpoint.
- Player rankings (sidebar).
Checkpoint progression
- Player drives through checkpoint trigger zones.
- Next checkpoint blip updates.
- Lap counter increments (loop races only).
- Client function
CheckpointPassedis triggered for custom logic.
Race validation
- Players must pass through checkpoints in order.
- Shortcuts detected by checkpoint sequencing.
- Missing checkpoints invalidate race completion.
Race Finish Phase
Individual player finish
- Player crosses finish line after completing all checkpoints/laps.
- Finish time is recorded.
- Position is determined (1st, 2nd, 3rd, etc.).
- Fireworks sound effect plays (for podium finishes).
- "RACE FINISHED" screen displays with results.
Reward calculation
- Entry fee pool: Distributed based on position (multiplied by config setting).
- Winner reward: Only for official races (if configured).
- MMR points: Awarded for official races or if
AllowMrrOnAllRacesis enabled.- 1st place: +50 MMR (base)
- 2nd place: +25 MMR (base)
- 3rd place: +10 MMR (base)
- Below 3rd: -25 MMR ร (position - 3)
- XP points: Skill tree XP awarded (if skill tree enabled).
- 1st: 100 XP
- 2nd: 50 XP
- 3rd: 25 XP
- 4th: 10 XP
- 5th: 5 XP
- Achievement progress: Tracked for milestone achievements.
Post-race cleanup
- Players teleported back to start position (if configured).
- Routing bucket removed (players return to normal dimension).
- Local traffic re-enabled.
- Race music fades out.
- Race data saved to database (history, statistics).
Leaderboard and Statistics Phase
Data tracking
- Player profile updated with race results.
- MMR history recorded (last 7 entries by default).
- Race history recorded (last 5 entries by default).
- Map statistics updated (play count, ratings).
- Global leaderboard refreshed (cached for 15 minutes).
Profile display
- Total races completed
- Total wins
- Podium finishes
- Average position
- Average race time
- MMR score and history graph
- Medals/achievements earned