Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nice! And irritating! I would make it a lot faster though. It takes so much time waiting for the animations to finish.


Too much time to load too (ditch the overkill 3D engine, there are lighter frameworks out there).

Cool game though. I am still puzzled by how the probabilities are arrived at. Random?


Agreed that 3D is overkill. I'm fastest at prototyping in Unity though and this was only a couple day project, so I'm unlikely to port it to anything else.

Probabilities are mostly randomized during board generation but skewed in a way to make gameplay feel a bit better. There's a cap on the likelihood of the neutral event, and a bias towards the good event rather than a bad one.


I got the die to settle on an edge in the corner of the playfield, which triggered a re-roll.

Is this actually simulating a d20 with physics?


Can you please share the specifics? I'm trying to make my own AI for this game, and would like to compare mine against random play to estimate its strength.

Also, in your listing of your ai beating the random, how are you counting drawn games?


The current code for board generation is as follows:

  var neutralChances = Random.Range(1, MaxNeutralChances + 1);
  square.GoodChances = Random.Range(MinGoodChances, 20 - neutralChances);
  square.BadChances = 20 - (square.GoodChances + neutralChances);
MaxNeutralChances and MinGoodChances are both set to 6 in the release build. Note that one chance is equal to one face of the die, so 5%. Also, this overload of Random.Range() has an inclusive min value but an exclusive max value.

I guess I didn't include ties in that little blurb I wrote up, but the real results of my 10k trials were around 5:1:11.5 (lose:tie:win) for the AI vs random actor.

Would love to see your AI when it's done! Please shoot me an email if you want. My email is in my profile / in the site footer.


Why an AI? Just for the fun of implementing it (totally valid, just curious)? Given the probabilities of the outcomes couldn't you just "solve" for the best way to play it based on expected value?

If there are 65% and 50% to complete a row in one direction, and a 35% and 20% in another direction, you don't really need AI to tell you which one would be more advantageous to go after?


Yes, I've made what is intended to be a perfect solver (Although it in some testing it's clearly making mistakes, so I have some debugging to do yet). I'm making it because I was nerd sniped into thinking through how to handle some of the trickiness with the solving. It's not an AI in the LLM or machine learning sense, but in the previously common use of the term (eg, deep blue), or in the video game sense.


Very cool! Best of luck working on it!


That's cool — use what you're comfortable with.

Myself, I am trying to create lightweight 3D code to sit on top of Canvas and HTML5. That may be why I was sensitive to the "overkill", ha ha.

https://github.com/EngineersNeedArt/Phosphor3D


Agreed. Taking the time to roll the dice is important the first few times, to fully cement the idea of the game. After that it gets annoying.

To be specific, you could probably even leave the roll time as-is, to give you that suspense, but the time it takes to move the die to the center, flash it, and flash the result, is too long and gets irritating.


That's good feedback, thanks. I've added a fast forward button to the top left.


You overdid it.

1x is right at first, but 2x is really fast.


3x is great


An extra click that would stop the animation immediately might be helpful.

Or to turn this into a different game: the d20 stops fast by default, but extra click to cheat and keep it rolling if you feel that it's about to stop on an unfavorable face.


I made some updates to speed up the UI, and improved the computer player, as I was interested in finding the optimal strategy: https://keshav.is/coding/pt3




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: