How do I modify odds in a gambling game?

0 favourites
  • 5 posts
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • This might not be specific to C2 but I still want to ask about it. If a moderator feels this topic fits better elsewhere, please move it.

    So, I'm about to get a deal with a client (if it's a deal) about making a gambling game.

    In this game, the client wants to be able to modify the odds of winning every once in a while (maybe every session, or something else). Imagine a keno where players can pick numbers between 1 and 50, and let's say that I want to make the odds of winning to be 1 in 100. How do I make a random number generator to pick numbers in a mathematical way to ensure that every player playing has a 1% chance of winning.

    thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Simply set a number random(0,1000) when selecting the odds of the next card/chip/number/whatever

    and use the condition If Number <= 10 'winning' card/chip/number/whatever appears.

  • Exactly as MpplantOfficial says above:

    IF you want a chance of something, you'd have a variable and then modify it using "random(FIRST,SECOND)"

    So, say you want a 50% chance of an event happening,

    Global Variable XXXX
    
    Event -- SomeTrigger -> Set Variable XXXX to Random(0,100)
    
    Event -- if XXXX <= 50  -> Do Action and reset XXXX to 0
    Event -- if XXXX > 50  -> Do Action different action and reset XXXX to 0
    [/code:1rs6ji49]
    So what's happening above is that the variable XXXX is set to a random value between 0 and 100
    the other 2 events then check if it is greater than, equal to or less than 50 (giving you a 50% chance since it's between 0 and 100).
    
    Always best to reset the Variable to 0 after you've triggered the event just to be sure it doesn't get triggered twice.
    
    Be aware that when using "random" the number it generates is a float, so can have decimal points.
    To counter that you can either round the number up or floor it down using the following.
    [code:1rs6ji49]
    set XXXX to Round(random(0,100))
    OR
    set XXXX to floor(random(0,100))
    [/code:1rs6ji49]
  • Wow!

    I just have to say if that is a gambling game that actually accepts money what you are describing is highly illegal and any Casino caught changing odds would be under some serious legal action. That is called fixing the game.

    I would suggest you check the laws in your country before getting involved in any such activity!

  • Thanks a lot for your answers! I'll try to use them in the game when it's time to implement it.

    lamar: honestly, I'm not sure if it's illegal or not since I don't know laws about gambling specifically. I'll keep what you said in mind and ask the client. I hope it's just a case of misunderstanding.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)