Created: 05/08/2026
By: Slotgen
Email: contact@slotgen.com
Thank you for purchasing my code. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!
Cocktail Beach is an HTML5 slot machine game built with Construct 3, shipped together with an optional Node.js + MongoDB backend for server-side game logic. It is a 5-reel, 3-row video slot with 20 fixed paylines, a scatter-triggered free spins feature, cascading (drop) symbols, and Big Win / Mega Win / Super Mega Win celebration sequences.
Out of the box the game runs 100% in the browser (all logic client-side) — just upload the HTML5 export and play. For operators who want server-authoritative gameplay, the included backend moves spin outcomes, balances, RTP control and history onto your own server with persistent MongoDB storage.
Game (frontend):
Node.js backend (optional, included):
Cocktail Beach.c3p — the complete, editable Construct 3 source project (all layouts, event sheets, graphics and sounds). Included for all buyers.HTML file/Cocktail Beach.zip — a ready-to-upload HTML5 export of the game (runs standalone, no backend needed).CocktailBeach_Backend.zip — the Node.js + MongoDB backend: Express server, slot engine, API routes, database models, integration helper scripts and two in-depth guides (CONSTRUCT3_INTEGRATION.md and GAMEAPI_INTEGRATION_GUIDE.md).documentation/ — this documentation.To play / host the game (HTML5 export, standalone):
file:// (see Troubleshooting)..webm, .json and .ttf files with correct MIME types (see Troubleshooting if not).To run the Node.js backend (optional):
npm install): Express 4, Mongoose 8, cors, dotenv, body-parser, express-validator.To edit the game (.c3p source):
Construct 3 project (.c3p):
| Item | Description |
|---|---|
Layouts → main | The game screen. Contains the reel grid, buttons (spin, turbo, auto spin, bet +/−), paytable, history panel, free-spin choice screen and menu. |
Layouts → obs | An off-screen “object bank” layout that holds object instances so they can be created at runtime. |
Event sheets → Main / BigWin / History | All game logic — see section F. |
Object types | All sprites, texts and UI objects, organised in folders (BigWin, History). Families are used for symbols, buttons and big-win effects. |
Sounds / Music / Fonts | All audio as .webm (opus) and the Carre-JWja.ttf display font. |
HTML5 export (inside HTML file/Cocktail Beach.zip):
| File / folder | Description |
|---|---|
index.html, data.json, style.css | Entry point, exported project data and page styling. |
scripts/ | Engine and loader scripts generated by the Construct 3 exporter (c3runtime.js, main.js, workers, support checks). |
sw.js, offline.json, appmanifest.json | Service worker, offline cache list and web app manifest (PWA/offline support). |
images/, media/, fonts/, icons/ | Sprite sheets, audio/music, font and app icons. |
Node.js backend (inside CocktailBeach_Backend.zip):
| File / folder | Description |
|---|---|
server.js | Express server entry point. |
services/slotEngine.js | The slot engine: reels, paylines, payouts, cascade multipliers (x1–x40) and free-spin packages. |
services/gameService.js | Business logic: sessions, balances, transactions, free-spin state. |
routes/gameRoutes.js | REST API endpoints — see section I. |
models/ | Mongoose models: User, GameSession, GameConfig. |
config/database.js | MongoDB connection. |
public/scripts/gameAPI.js, c3-gameapi-helper.js | Client-side helpers for calling the API from Construct 3. |
public/test-api.html, debug-viewer.html | API test page and spin-log debug viewer. |
CONSTRUCT3_INTEGRATION.md, GAMEAPI_INTEGRATION_GUIDE.md | Step-by-step integration guides. |
.env.example, package.json | Environment template and dependencies. |
A note on the exported scripts: the files in the HTML export’s scripts/ folder plus sw.js are machine-generated by Construct 3’s official exporter and are not hand-written code. The original, readable source of the game is the included Cocktail Beach.c3p project (visual event sheets), and the backend ships as plain, readable Node.js source files.
All game logic is implemented visually in three event sheets, organised into named groups:
Main (core gameplay):
BigWin: win/bet ratio check against PerBW/PerMG/PerSMG thresholds, then the celebration sequence (darkened background, coin shower, animated counters, timed tier transitions).
History: records every spin (time, transaction id, bet, win, profit) into arrays, renders the paged history list and the per-spin detail view.
There is also a small amount of JavaScript inside events (exported as scripts/project/javaScriptInEvents.js), used for helper calculations; it is readable in the export and editable inside the event sheets.
Open the .c3p in Construct 3, open the Main event sheet, and edit the global variables at the top of the sheet (right-click a variable → Edit). The most useful ones:
| Variable | Default | What it does |
|---|---|---|
balance | 1000 | Player’s starting credit (standalone mode; in backend mode the server owns the balance). |
BaseBet | 20 | Base bet amount. Total bet = BaseBet × BetLevel. |
BetLevel | 1 | Starting bet level (changed in-game with the +/− buttons). |
PayoutA … PayoutH | e.g. 3|10|50 | Payout table per symbol, formatted 3-of-a-kind|4-of-a-kind|5-of-a-kind. A is the lowest symbol, H the highest (e.g. PayoutH = 50|250|2500). The in-game paytable updates automatically. |
lines | 20 patterns | The paylines. Each payline is 5 grid positions (1–15, reading the 5×3 grid) separated by commas; paylines are separated by |. |
ReelSpeed | 1500 | How fast symbols fall (pixels/second). Higher = faster spins. |
Turbo / DropMulti | 1 / 1 | Turbo speed multiplier and starting cascade multiplier. |
distanceV / distanceH | 140 | Symbol spacing — only change if you resize the symbol art. |
xTop, yTop, yBot | 77 / 420 / 980 | Reel grid geometry (left edge, top row Y, bottom row Y). |
In the BigWin event sheet: PerBW (20), PerMG (35), PerSMG (50) are the win÷bet thresholds for Big / Mega / Super Mega Win, and timechange (8,5,6) controls the timing of the tier transitions.
When running with the backend, the equivalent settings (paytables, RTP, bet limits, free-spin packages) live in the GameConfig MongoDB collection and .env — see the backend’s README.md.
The backend is optional — the game plays fully client-side without it. Set it up when you want server-authoritative spins, real balances and persistent history.
Step 1 — Install prerequisites. Install Node.js 18+ and either local MongoDB Community Server or create a free MongoDB Atlas cluster.
Step 2 — Unzip and install dependencies.
unzip CocktailBeach_Backend.zip -d cocktailbeach-backend cd cocktailbeach-backend npm install
Step 3 — Configure environment. Copy .env.example to .env and edit:
MONGODB_URI=mongodb://localhost:27017/cocktailbeach PORT=3000 NODE_ENV=development INITIAL_BALANCE=10000 MIN_BET=1 MAX_BET=1000
Step 4 — Start the server.
npm start # production npm run dev # development (auto-restart with nodemon)
The API is now available at http://localhost:3000. Open public/test-api.html to try every endpoint from the browser, and public/debug-viewer.html to inspect logged spins (enable with DEBUG_SPINS=true in .env).
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/game/init | Create/load a user session and return starting balance and config. |
| POST | /api/game/spin | Execute a spin server-side; returns the symbol grid, wins and new balance. |
| POST | /api/game/spin-cascade | Resolve the next cascade/drop step with its multiplier. |
| GET | /api/game/balance/:userId | Current balance for a user. |
| GET | /api/game/config | Active game configuration (symbols, paylines, RTP, bet limits). |
| GET | /api/game/free-spin-packages | List the free-spin packages (20 spins × up to x5, 10 × up to x20, 5 × up to x40). |
| POST | /api/game/select-package | Choose a free-spin package when scatters hit. |
| GET | /api/game/free-spin-session/:userId | State of the current free-spin session. |
| POST | /api/game/end-free-spin-session | Close the free-spin session and credit winnings. |
| GET | /api/game/history/:userId | Paged spin/transaction history. |
| GET | /api/game/stats/:userId | Aggregate statistics for a user. |
| GET | /api/game/debug/* | Debug endpoints: latest spin log, log by transaction id, log list. |
Exact request/response payloads with examples are documented in GAMEAPI_INTEGRATION_GUIDE.md inside the backend zip.
The shipped Cocktail Beach.c3p runs standalone (client-side logic). To drive it from the backend:
public/scripts/gameAPI.js and c3-gameapi-helper.js from the backend zip to your Construct 3 project (Project → Scripts).gameAPI.js at your server (e.g. https://yourdomain.com:3000)./api/game/spin and /api/game/spin-cascade, and read balances from the server instead of the balance variable.CONSTRUCT3_INTEGRATION.md in the backend zip — it walks through this step by step with event-sheet examples and covers session init, spins, cascades, free-spin packages and history.Remember to enable CORS for your game’s domain (the backend ships with the cors middleware enabled) and to serve both game and API over HTTPS in production.
First, you open the .c3p file and determine the object to change the graphics.
Then follow the instructions below:
Select the image to replace stored in your folder.
Tip: keep replacement images close to the original dimensions (symbols are spaced 140px apart on a 720×1280 layout). If you change symbol sizes, adjust distanceV, distanceH, xTop, yTop and yBot in section G.
You need hosting to upload it and share the link with your friend to play.
Some free hosting:
You can unzip HTML file/Cocktail Beach.zip and upload its contents directly to your website. I would suggest using FileZilla for that.
Login to your FTP account of your domain, create a new folder for the game and move all exported files onto the server in FileZilla.
Step 1: (Only if re-exporting yourself) From the Construct 3 window, click on the "Menu" button then select "Export" or press F6. Then select "Web".
Step 2: After the file has been downloaded, extract it.
Step 3: Open the FileZilla window and log in. You need to have the following information: Host, Username, Password; in the Port section type 21. Then right click and select Create Directory.
Finally, you proceed to import the previously extracted files. Then go to your server link and add the path "/game-name" after it.
Note: static hosting is enough for the standalone game. The Node.js backend needs a host that can run Node processes (VPS, Render, Railway, etc.) — see section H.
The Construct 3 file (.c3p) contains all sources and game mechanics and is included in this package for all buyers. Open it in the editor at https://editor.construct.net/ (install the free “Better Outline” addon first — see Technical Requirements).
In order to export your game, you are required to get a Construct 3 license. You can get the license here: https://www.construct.net/en/make-games/buy-construct
Step 1.
Open the .c3p in the editor.
Step 2.
Go to Menu -> Project -> Export
Step 3.
Choose Android (Cordova), iOS (Cordova) or Web (HTML5) according to which platform you want to export to.
Using the Embed HTML5 Game plugin, you can easily embed your HTML5 game into your WordPress post, page, or widget. Embed HTML5 Game can make your HTML5 game fit on any screen size.
Shortcode output is based on iframe, so your embedded content will be supported on any modern browser.
Installation:
Screenshots:
1. Black screen / nothing loads when I double-click index.html.
Construct 3 games cannot run from the file:// protocol — browsers block the game’s data requests for security reasons. Always run the game from a web server. For quick local testing use one of these in the game folder:
# Python python -m http.server 8000 # then open http://localhost:8000 # Node npx http-server -p 8000
or use XAMPP/WAMP, or the “Live Server” extension in VS Code.
2. CORS errors in the browser console (“blocked by CORS policy”).
This happens when the game files are loaded from a different origin (domain/port) than the page, or from file://. Fixes: serve all game files from the same domain as the page; if the game calls the backend on another domain/port, keep the backend’s cors middleware enabled and set the allowed origin to your game’s domain; when embedding with an iframe, point the iframe directly at the game’s own index.html URL.
3. Audio or fonts don’t load (404 or MIME-type errors).
Some servers don’t know the correct MIME types. For Apache, add this to your .htaccess:
AddType video/webm .webm AddType application/json .json AddType font/ttf .ttf
For Nginx, add the equivalent entries to your mime.types. For IIS, add the MIME mappings in the site settings.
4. No sound until I tap/click.
This is normal: browsers block autoplaying audio. Sound starts after the first user interaction — a browser policy, not a bug.
5. I replaced files on my server but the old version still shows.
The service worker (sw.js) caches the game for offline play. Do a hard refresh (Ctrl+F5) or clear site data (DevTools → Application → Clear storage).
6. Offline / “install app” features don’t work.
Service workers require HTTPS (or localhost).
7. Construct 3 says an addon is missing when opening the .c3p.
Install the free Better Outline addon by skymen (see Technical Requirements) and use Construct 3 r466 or newer.
8. Backend won’t start / “MongooseServerSelectionError”.
MongoDB isn’t running or MONGODB_URI in .env is wrong. Start your local MongoDB service, or check your Atlas connection string and IP allow-list. Also make sure you ran npm install and are on Node.js 18+.
9. The game plays but ignores the backend.
The shipped game is standalone by design — backend integration is a manual step. Follow section J and CONSTRUCT3_INTEGRATION.md.
If you bought the Extended License I will reskin the game (use your graphics, create a new logo) for free.
Once again, thank you so much for purchasing this code. As I said at the beginning, I'd be glad to help you if you have any questions relating to this code. If you have a more general question relating to the code on Codecanyon, you might consider visiting the forums and asking your question in the "Item Discussion" section.
Slotgen