How to do Probabilities right? | Unity Coding Tutorial

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 24

  • @r.gtz.4521
    @r.gtz.4521 2 года назад +5

    This is a very good system you came up with, it helps so much with the often-needed random generation required in game creation. Awesome job.

    • @Fadrik
      @Fadrik  2 года назад

      Thanks so much 😍

  • @lee1davis1
    @lee1davis1 3 года назад +5

    Added to my must watch unity tuts Playlist. A lot of great probabilities here. Thanks

  • @bobrocks79
    @bobrocks79 4 года назад +1

    Cool, this is a nice probability system. I'll have to play around with it. Nice work.

    • @Fadrik
      @Fadrik  4 года назад

      Thanks, it's free and open-source so please do play with it and I don't mind getting the result maybe I'll add it to the actual system if you created something that is missing here

  • @BlueGooGames
    @BlueGooGames 4 года назад +2

    Very interesting! Thanks for sharing :)

    • @Fadrik
      @Fadrik  4 года назад

      Thanks for watching

  • @firojakhter6310
    @firojakhter6310 2 года назад

    Great job mate.Thanks!👍.Removed hurdle to research on it.

    • @Fadrik
      @Fadrik  2 года назад

      you're welcome my friend

  • @Angelongamer
    @Angelongamer 3 года назад +1

    really cool video!

  • @averageenjoyer301
    @averageenjoyer301 3 года назад +1

    Hey, very cool video. I just ask myself how icall those functions and implement those. When doing something like GetItemByProbability(); in an IEnumerator or Update-Function it doesn't work. It would really like to know how that would work.

    • @Fadrik
      @Fadrik  3 года назад

      it should be as easy as declaring a new class ProbabilitiesController and then call the function, pm me on Discord if anything is still foggy I'll help you out with it - FadrikAlexander#4323

  • @a_d3mon
    @a_d3mon 2 года назад

    I hope so much that this will work with what I need... I'm making a marathon timer (2 versions really) where it can add/remove time based off a percentage chance and I could not figure out HOW to apply this type of mechanism using percentages (whether hard-coded or soft-coded)... I've dealt with SOME randomization for games/school projects but that was mainly running if-else if-else statements, random number generation, and objects themselves, all hard-coded of course.

    • @a_d3mon
      @a_d3mon 2 года назад

      Ok, after some fiddling with it to get the thing working properly, I now have 3 tables (2 of which will eventually be user based and the third for cumulative counting) and selecting the choices based on how often it should occur (.001(or is it .0001?) is happening about 10 times out of 1 million tries) using floats.
      So thank you very much for these examples Fadrik :)

  • @Jeromiiboy
    @Jeromiiboy 2 года назад

    1:18 Shouldn't you take the range of (1, 101)?
    Let's take range(1, 101), then you can get 100 values and since you test

    • @Fadrik
      @Fadrik  2 года назад

      range of (1, 101) Will get you back values from 1 to 100 as the last number is exclusive and not inclusive in the range

    • @Jeromiiboy
      @Jeromiiboy 2 года назад

      @@Fadrik right, so if you want to have a 30% chance you need the range(1, 101) because 30/100 = 30%. In your example it's the range(0, 101) so there is also a 0.
      With the 0 there are 101 Numbers {0, 1, 2 ... 100} and the 30% are in your example 31/101 ~ 30,7%

    • @Fadrik
      @Fadrik  2 года назад +1

      Oh I started the range from 0 my bad you're right

    • @blockify
      @blockify 2 года назад +1

      That explains why the first one has 1% more picks and the last has 1% less picks

    • @Stoy123
      @Stoy123 Год назад

      in case you didn't know you can do things like:
      Random.Range(minInclusive: 1, maxInclusive: 100);

  • @bochnik2623
    @bochnik2623 3 года назад +1

    u are god tnx so much!!

  • @DoomCatcher
    @DoomCatcher 2 года назад

    Good code very useful except I found your video explanation very lacking and difficult to follow.