Show code for dice algorithm.

  • I've had multiple game lately where my opponents are winning more than one large battle where they have less than a 3% chance. I've also had multiple games where my two main countries are rolling over 3.5 and even 3.6 while the opponents countries are rolling 3.3 to 3.4 after hundreds of rolls. Also, aaa seems to be hitting my planes at a 1 in 3 to 1 in 4. Maybe I'm going through a 1 in a million bad stretch. Or, and this is speculation, maybe the dice algorithm keeps track of players and adjusts the dice somehow. I'd like to see the a post with the code for the dice algorithm, since this is open source anyway.

  • Admin

    @taplayerzz Well I've played a lot of TripleA games and have had plenty of good and bad luck. There is nothing in the code base random number generation that changes based on which player/nation/map/etc when rolling the dice. All of the random generator code is open source and you can view it here:

    For non-dice server games, the random numbers are based on the apache MersenneTwister library implementation: Info on the algorithm:

    I'd be willing to bet a pretty large amount of money that you just had a game or 2 of bad luck and tend to notice bad luck more than good luck and that there is nothing in the dice roller that is tracking players and adjusting the dice.

  • Thanks for the reply. You didn't answer my question. When I launch a game of triplea online, I want an explicit answer on the exact path the dice follow from the game to the dice server and back. I should not have to dig through the code to find this answer if you are a dev. There was at least one instance in the past where a player was able to change the dice. So, don't think it can't happen here. I think the dice might be compromised as my dice continue to be horrifically bad in key battles.

  • @taplayerzz I'll give some empathy and say almost every game I play online is full of hackers/scriptkiddies so ya maybe he has come across a scriptkiddie that can fudge his dice ... can this happen on TripleA?

  • Admin

    @taplayerzz Not really sure what you are asking for. Are you concerned about someone cheating or about the dice algorithm? Are you talking about PBF/PBEM or lobby games? If lobby games, are you playing on a bot or is someone hosting? In all these cases, the game uses a very standard random algorithm as I've already described. If you are worried about someone cheating then play PBF/PBEM as all the dice are emailed to each player and saved on the server so there is no way to cheat.

  • Admin

    @taplayerzz To give you a rough overview of the way the dice are being rolled:

    When playing PbF/PbEM

    Whenever a player needs dice rolls to determine a result of a battle, a request to is being made over a secure HTTPS connection (relatively strong encryption for web standards). On a successfull roll (i.e. a valid request) an email is being sent to each player to prevent someone to just reload an old savegame from a round ago and replay the same scenario and get different results that may favor someone elses turn. So if you get 2 emails mentioning the "same" battle, you know something's odd.

    Playing over the internet
    Private hosts

    No guarantees here, the private host has full control over his server code in theory

    'Bots' aka Official Hosts

    We host the bots ourselves and have therefore ensured that the code is unaltered.
    The actual rolling is done on the bots, so therefore no practical way of altering the code remotely.
    However the results are being sent over an unsecure connection, so in theory someone could hijack your private connection and simulate a complete game for you i.e. pretend you rolled bad although you didn't, because at some point the results become out-of-sync with the actual game, but this is really unlikely because our netcode is at the moment really compilcated to deal with, so probably not worth trying unless someone has waaay too much time (if such a person exists, feel free to join us, there's lots of code to fix ^^).

    TL;DR While it's in theory possible to play games on you by altering your connection, it's not possible to reasonably alter your dice results in a trivial way, unless of course someone found an exploit in our code or something, in which case we had a more severe issue than faked dice results.

    Additional Info:
    While online games are being played over an insecure connection, the passwords being sent for private matches are transmitted securely. (We aren't security experts, but based on our knowledge on best-practices in the recent time, we consider it secure, feel free to prove us wrong)

Log in to reply