0

Okay, me and a couple of friends had the idea to make a website where you can earn some credits and later on wager these credits, all fun and stuff. Everything works but now we are stuck on a gamemode we thought of.

(BustABit Solo) How the gamemode works is a player chooses a wager amount, then starts the game. When the player has clicked start on the backend there will be a 'crash number' generated on which the game will end. Then on the browser a counter will count up from 1.00x to infinite. Let's say the server decided to crash the game on 2.00x. If a player clicked the cashout button on let's say 1.50x, then he'll get 1.50x (150%) his wager.

Now where the problem lays, the server needs to keep track on what number the player cashs' out, therefor we need some sort of interval (or do we?) to keep track on what number the crash is when the player clicks the cashout button. But there could be over two hundred people at the same time playing which all would need their own interval (?), wouldn't it be a giant load on the server? How do we go about this correctly?

Martijn Ebbens
  • 253
  • 3
  • 15
  • The community has it's own rules for how downvoting is supposed to work. Please read: [When is it justifiable to downvote a question?](//meta.stackoverflow.com/a/252740) – 4castle Jul 31 '17 at 00:00
  • @4castle I never knew that, thanks a lot. I'll read it now and keep it in mind for my following questions. – Martijn Ebbens Jul 31 '17 at 00:00
  • I'm not sure what an "interval" is, but it sounds like you need to use a [session](https://stackoverflow.com/q/3737062/5743988) for each user. 200 people should be no problem for light-weight data like this. – 4castle Jul 31 '17 at 00:04
  • Interval I mean like that the counter needs to go up for each player individually, Billy might be at 3.17x and John could sit at 1.03x, the server needs to know when Billy cashes out he cashed out at 3.20x and John cashed out he cashed out on 1.10x (they each play their own game). – Martijn Ebbens Jul 31 '17 at 00:07
  • Ok, I think I understand now. This kind of game would be run on the client side (your users don't need to interact), so you really don't need anything running on the server at all except to serve HTML pages. – 4castle Jul 31 '17 at 00:09
  • @4castle well, they all have balances stored on the server, it should all be secure and no way for users to rig any of the outcomes. That's why the server will need to handle the counters because otherwise, ofcourse, the user can just use inspect element and gain himself a lot of currency. – Martijn Ebbens Jul 31 '17 at 00:11

0 Answers0