![]() |
Infinite probabillities
Well.. I'm trying to create a type of infinite probabillity, in which say... lets use basketball as an example, a player can be good, but no one, can ever, score ALL the baskets they take. Begginners will be able to score some baskets, 1 in 10 chance say, Amateurs will be able to score say 6 in 10, and Pros, say 9 in 10, but no matter how good they will get they won't ever score 10 in 10.. (Though some people will but, just imagine they cant ;D)
At first to tackle this I thought, half lives! e.g... 10, 5, 2.5, 1.25, 0.625..... etc etc.. Always halves the number, but never reaches 0... That is great and all.. But i cant think how to apply this to my problem. x.x And besides the leap from level 1, 10, to level 2, 5, thats huge. :X Thats a whole 5 units :O. Yeah. NPC Code: What would ? be substituted for, even if half lives were used to calculate the probabillity?.. It's confusing. :(! I either need help with this, or a brand new concept. x.x |
There are several ways you can accomplish this. One would be to set up a levels system based upon the amount of baskets. You could do something like:
NPC Code:level = int(baskets / arbitrary number); And then calculate probability based on level. ------------------------- However, If you want their probability to steadily increase over time (without a level type system), that's where exponents would come into play. You could apply it several ways; perhaps the simplest would be to calculate the chance to miss, and use that to figure out if the player made the shot or not. NPC Code:misschance = basemisschance * e ^ -(constant*numberofbaskets); For example: Say you want them to start off missing about 50% of their shots. You'd set the basemisschance to 50 (keep in mind we're dealing with percents). NPC Code:misschance = 50 * e ^ -(constant*numberofbaskets); We still have one constant left in there: What does that do? It controls just how much chance to miss is lost per basket (how much chance to hit is gained per basket). Vary the constant to vary how fast people improve. Then, you can add a check if the miss chance ends up below 10%, and if so, then set it to 10%. :) Now you've got a percent chance to miss. From here, it's a simple matter of comparing a random number between 1 and 100 to the miss chance; if it's greater than the miss chance then it will hit, else it will fail. Hope this helps! |
Mmmmm.. Yeep. All I have to do.. is figure out a way to make its leaps smaller.... 10-5-2.5... 10-5 thats a BIG probabillity leap, from crap scoring to good scoring.
|
YYEEES :D I got it, make const val < 0.1! :D!! That makes the half life, very slow, which is what I want. <3!!!!!!
|
(As I said on AIM to clarify, but for the benefit of future people with the same problem:) You can vary the constant and the base to achieve the effect which you desire.
|
| All times are GMT +2. The time now is 06:20 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.