Overview
What it does
G4S Leaderboard Addon connects one or many Construct 3 games to a leaderboard hosted on the buyer's own website. It is meant for arcade sites, educational games, casual competitions, classroom activities, and client websites that need a simple scoreboard without a heavy account system.
Package contents
What buyers receive
- G4SLeaderboard.c3addon for Construct 3.
- g4s-leaderboard-example.c3p with a basic working example.
- website-backend/ PHP/MySQL backend folder.
- website-backend.zip for easier upload.
- README, help, API, install, troubleshooting, ACE, and version documentation.
Installation
Website backend setup
- Upload `website-backend` to the buyer website, for example `public_html/g4s-leaderboard/`.
- Copy `config.php.example` to `config.php`.
- Set database host, database name, database user, and password.
- For the first test, keep `require_api_key` set to `false`.
- Open `install.php` in a browser and confirm the database table is created.
- Open `/g4s-leaderboard/api/ping.php` and confirm the response is JSON.
- Delete or protect `install.php` after setup.
https://games4studies.com/g4s-leaderboard/api/ping.php
Construct 3 plugin setup
- Install `G4SLeaderboard.c3addon` in Construct 3.
- Add one G4S Leaderboard Addon object to the project.
- Set API base to the uploaded API folder.
- Set a short unique game key, for example `snake`, `math-quiz`, or `word-match`.
- Set the readable game title shown in all-games leaderboard rows.
- Set the player name through object property or runtime action.
API base:
https://games4studies.com/g4s-leaderboard/api
Construct 3 setup
Basic event flow
Recommended event sheet pattern
On start of layout
G4SLeaderboard: Ping API
On level complete
G4SLeaderboard: Set player name TextInput.Text
G4SLeaderboard: Submit score Score, -1, "{}"
On score submitted
StatusText: Set text G4SLeaderboard.Status
BestText: Set text G4SLeaderboard.PersonalBest
BoardText: Set text G4SLeaderboard.LeaderboardRowText(0)
Game vs all-games scope
Use `game` scope for the current game only. Use `all` scope for a website-wide champions view: game name, top player, and highest score. Normalized score is useful when different games have different scoring scales.
ACE reference
Actions, conditions, and expressions
Conditions
Actions
Key expressions
Backend API
Endpoint reference
All responses return JSON with `ok` set to true or false. When API key mode is enabled, send `X-Leaderboard-Key` header or `api_key` value.
Ping
GET /api/ping.php
Returns backend version, database connection status, table readiness, and whether all-games leaderboard is enabled.
Submit score
POST /api/submit-score.php
{
"game_key": "snake",
"game_title": "Snake",
"player_name": "Alex",
"score": 1200,
"normalized_score": 82,
"meta": {"level": 3}
}
Load leaderboard
GET /api/leaderboard.php?scope=game&game_key=snake&game_slug=snake&amount=10&sort=score
GET /api/leaderboard.php?scope=all&amount=10&sort=normalized
All-games display is reduced to the highest row per game.
Load my best
GET /api/my-best.php?game_key=snake&player_name=Alex
Backend config
Important settings
Workflow
Recommended setup checklist
- Install backend and verify `ping.php` in the browser.
- Install the plugin and open the included Construct 3 example project.
- Set API base and game key in Construct.
- Submit a test score.
- Load `game` leaderboard and confirm rows display.
- Enable all-games leaderboard only if the website needs it.
- Turn on optional API key only after basic scoring works.
- Delete or protect installer files before going live.
Security
Important limits
This kit is designed for casual games, classrooms, arcade sites, and client websites. Advanced users can inspect browser requests, so high-stakes competitions need server-side verification or a custom secure scoring design.
- Use HTTPS on production websites.
- Use exact CORS origins instead of `*` when the final domains are known.
- Keep database credentials private in `config.php`.
- Use rate limiting to reduce accidental spam.
- Remember that browser-visible API keys are a light barrier, not full protection.
Troubleshooting
First checks
- Open `/api/ping.php` directly in a browser.
- Confirm `ok`, `db_connected`, and `table_ready` are true.
- In Construct 3, call `Ping API` and display `Status` or `LastError`.
- If a request fails, inspect `LastJSON` to see whether the server returned JSON or an HTML error page.
VPN, firewall, CDN, or hosting blocks
It is common for some hosting providers, CDNs, or firewalls to block shared VPN IP addresses. If the leaderboard works without VPN but fails with VPN, the usual cause is a network/server rule rather than a plugin bug.
Common errors
Version history
1.0.3.0 - 2026-05-27
- Construct 3 example rebuilt at 1920x1080.
- Output area enlarged and JSON output formatted across new lines.
- All-games output now shows each game's top player and highest score.
1.0.0.0 - 2026-05-20
- Initial saleable universal release.
- Construct 3 plugin with per-game and all-games leaderboard support.
- PHP/MySQL backend with installer and SQL files.
- Optional API key, CORS settings, and rate limiting.
- Simple Construct 3 example project.
- Release bundle with backend and documentation.