All Projects → Danziger → slotjs

Danziger / slotjs

Licence: MIT license
🎰 Circular slot machine mobile-first SPA built using JavaScript, CSS variables and Emojis!

Programming Languages

javascript
184084 projects - #8 most used programming language
SCSS
7915 projects
EJS
674 projects
HTML
75241 projects

Projects that are alternatives of or similar to slotjs

ChineseChessOnline
一款canvas版中国象棋游戏,支持高清图像/canvas响应式设计/ 实时对战/棋谱功能/在线聊天。A Canvas version of the Chinese chess game, supporting high-definition images / Canvas responsive design / real-time combat / chess spectrum function / online chat
Stars: ✭ 25 (-72.22%)
Mutual labels:  javascript-game
zeros-dice
Simple game in blockchain with solidity. Contract address: https://rinkeby.etherscan.io/address/0xa2184acf2607964b8f3fd7e23434519304440cdf
Stars: ✭ 17 (-81.11%)
Mutual labels:  casino
uot
🦁 A tiny setTimeout alternative with progress.
Stars: ✭ 43 (-52.22%)
Mutual labels:  requestanimationframe
Expo-Nitro-Roll
A cross-platform video game built with Expo and three.js!
Stars: ✭ 16 (-82.22%)
Mutual labels:  javascript-game
Rigley2-FlappyBug
The awaited sequel sees our Rigley friend jumping through firewalls "Flappy Bird" style
Stars: ✭ 27 (-70%)
Mutual labels:  javascript-game
doppelkopf
A "Doppelkopf" card game - in your browser ♣️♠️♥️♦️
Stars: ✭ 39 (-56.67%)
Mutual labels:  javascript-game
bullethell
A bullet hell game programmed using HTML5 and JS.
Stars: ✭ 30 (-66.67%)
Mutual labels:  javascript-game
polycash
The ultimate open source betting protocol. PolyCash is a P2P blockchain platform for wallets, asset issuance, bonds & gaming.
Stars: ✭ 24 (-73.33%)
Mutual labels:  gambling
programming-crypto-contracts
Programming Crypto Blockchain Contracts Step-by-Step Book / Guide. Let's Start with Ponzi & Pyramid Schemes. Run Your Own Lotteries, Gambling Casinos and more on the Blockchain World Computer...
Stars: ✭ 54 (-40%)
Mutual labels:  casino
RetroGamingWorkshop
Retro Gaming Workshop (first offered Winter 2018)
Stars: ✭ 15 (-83.33%)
Mutual labels:  javascript-game
guess-game
The classic guess the number game with some extra features.Try it
Stars: ✭ 28 (-68.89%)
Mutual labels:  javascript-game
VitonBet
VitonBet is an Android betting application that allows users to place bets on eSports events and to gamble on user created events. Casino mode also available to gamble and sending cash to other users available too.
Stars: ✭ 24 (-73.33%)
Mutual labels:  gambling
AutoTrimps
Automation for the idle incremental game 'Trimps'
Stars: ✭ 32 (-64.44%)
Mutual labels:  javascript-game
AutoTrimps
AutoTrimps - Zek
Stars: ✭ 37 (-58.89%)
Mutual labels:  javascript-game
raf-interval
setRafInterval and clearRafInterval with requestAnimationFrame - 40行代码实现的高性能动画定时器
Stars: ✭ 77 (-14.44%)
Mutual labels:  requestanimationframe
Mage
Mage is a 3D Game Engine, built on top of THREE.js. It features Unity-like scripting, AMMO.js powered physics workers, an Infernojs powered UI and a clean API. Under (very) active development.
Stars: ✭ 76 (-15.56%)
Mutual labels:  javascript-game
Five-Nights-at-Freddys-Web
Five Nights at Freddy's - Web: https://wellsousaaa.github.io/Five-Nights-at-Freddys-Web/
Stars: ✭ 79 (-12.22%)
Mutual labels:  javascript-game
blitz-tactics
Fast-paced chess tactics trainer
Stars: ✭ 137 (+52.22%)
Mutual labels:  javascript-game
Phaser3.Boilerplate
Phaser 3 Boilerplate project for rapid development.
Stars: ✭ 15 (-83.33%)
Mutual labels:  javascript-game
nypsi
the best discord bot
Stars: ✭ 41 (-54.44%)
Mutual labels:  gambling

SlotJS

🎰 Circular slot machine mobile-first SPA built using JavaScript, CSS variables and Emojis!

🚀 Try it out at danziger.github.io/slotjs!

🔊 Better with sound & vibration on.

💩 No IE or Edge. Get the f**k off my property!



Running it

Take a look at package.json, the scripts are self-explanatory.


Reporting a problem

Don't hesitate to report any issue you find in this website/project by opening a new issue in this repository, but please make sure that problem hasn't been reported before by another user as an Issue or already appears in the TODO file.


Implementation Details, Limitations & Possible Improvements

Not Random

Instead of generating random numbers to decide whether or not the slot machine is going to give a price, this one works in a more predictable way, where the ability of an user to stop it at the right spot actually influences their ability to get a prize, which I think is also more engaging and fair for them. Imagine, for example, the tension when having just one symbol left to get the jackpot, it's all on you:

Homer Simpson playing roulette

Group Rotation

We could rotate the reels container (.sm__reelsContainer) instead of the reels themselves (.sm__reel) so that we only need to rotate a single element with JS + another one with a CSS animation (the one that is stopping, if any) at a time:

Homer Simpson spinning chair

The main advantage of this approach is that the main update rotation action will have the same work to do no matter how many reels we have, potentially producing lower and more predictable execution times for the tick method.

However, its drawbacks are that we have less control over the rotation, while with the current approach we could have different speeds and even accelerations for each reel and, most importantly, that when we stop a reel we have to move it outside the container, changing the DOM, which would make the stop action slower.

As rotating the reels is currently performing better (running at around 60 fps even with a 6x CPU slowdown) than stopping it (usually taking around 2 frames), mainly due to the costly Recalculate Style operation that the dynamically created animations trigger when a reel is stopped, I have decided not to implement this other approach. You know, if it ain't broke...

If this game had to run with a higher number of reels and that caused performance issues on some devices, we could do a performance test to compare both approaches.

Rotate with Animations

A rotation animation could be used instead of manually calculating the rotation, which might be slightly more performant than the current approach.

However, when we stop a reel we would need to find out its angle from a rotation matrix and make sure the transition between the rotation and the stopping animations is smooth, while now we always know the current angle of all the reels. Also, we would have less control over the rotation, while with the current approach we could have different speeds and even accelerations for each reel.

Zoom Effect

The zoom effect is a bit slow on Firefox and blurry on some iOS devices, while on Chrome the performance impact is there but it is not so noticeable. It would be simpler and way more performant in all browsers to show a bigger view of the current combination above the slot machine.

Anyway, I suspect the issue on iOS is because the scaling is done with GPU but no reflow is done after that, so we get a scaled up bitmap instead of a new one generated using the scaled up application, which should look sharper, as it does in other browsers.

This might be fixable using the filter: none or -webkit-filter: blur(0px) trick, but as I don' have an iOS device to test it, I didn't implement any fix.

Blur Effect

Each cell in a reel is repeated a number of times, depending on the available space between one cell and the next one, with a blur effect and decreasing opacity, so that the animation looks smoother and without gaps between one cell and the next one but still makes it as obvious as possible where the real cell (the non-faded one) is.

However, it looks like filter: blur(Npx) is not using the GPU on Firefox, so it causes major performance issues. Therefore, this effect is not used on Firefox, where only opacity is changed.


Other ideas

Special Symbols

We could have special symbols that give a random bonus: immediate prize, multipliers, slow-motion, wildcard symbol... and use the center of the slot machine to show that.

Virtual Rooms

We could group players in "virtual rooms" according to some parameters like the time the spend to stop a reel, their recent average hit rate..., making sure they are on a similar skill level, and most of the money the spend will go to that room's jackpot, while a small percentage will go for fees.

Also, we could use WebSockets to make them all aware of the prices others on that room are getting to keep them more engaged in the game / competition.


Ongoing work

This is just a weekend project I built a while back, so it won't be updated often. However, there's some ongoing work you can find in the TODO file.


Author

Dani Gámez Franco

Dani Gámez Franco

LinkedIn: https://www.linkedin.com/in/danigamezfranco/

Stack Overflow: https://stackoverflow.com/users/3723993/danziger

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].