Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Hit/Miss System
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Archi




PostPosted: Sun Jul 27, 2003 11:20 pm   Post subject: Hit/Miss System

I need some assistance with part of my game. The current hit/miss system I'm using is a piece of junk because the random integers are never completely random and are more likely to be higher than they are lower.
My current hit/miss system looks this this:
hitchance := round ((acc * 3) + (eqhitrate * 2) div 2.5)
Where Acc=Accuracy and the beginning stats are anywhere from 20-40 and the eqhitrate=Equipped Hit Rate which ranges from 25-35.
What I do next to determine whether the player hits or misses is gets a random number between 1-200( allowing hopefully better chances to hit) and if the hitchance is greater or equal to the random number, than the player hits..if not, he misses.
Now, not only does the lack of true randomization cause a problem but also the fact that I want the original equipment to have roughly a 75% chance to hit while the 2nd best weapon has only a 95%...I've yet to figure out a good way to do this...Maybe you people could assist me?
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Mon Jul 28, 2003 12:06 am   Post subject: (No subject)

well the simple way whoud be to get an random number betwen 1 and x

now you could do it so if it is 1 then it is a hit or if it is not one then it is a hit.

to chage the % of cahce of hit just incres or lower x depending on if you are using 1 as a hit or a miss.

ie. if you use not 1 as a hit then a random number from 1 to 3 whould hav 66.7% chase of hit.

1-2 = 50%
1-3 = 66.7%
1-4 = 75%
1-5 = 80%

and so on.

doing it the other way:

1-2 = 50%
1-3 = 33%
1-4 = 25%
1-5 = 20%

and so on.

now if you combiden both of thess using if's you could easy get a wide rang of difren % base on a sats of chater or what ever.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Archi




PostPosted: Mon Jul 28, 2003 1:14 am   Post subject: (No subject)

The attached picture shows the lvl of the weapon, the total of the accuracy and hit chance of the player (at each lvl for that weapon), the desired % hit chance, what the formula must equal to get the desired % and then just the individual acc (player) and hit chance(weapon).

IF possible, maybe you could assist me in making a formula for this?



hit&miss.jpg
 Description:
 Filesize:  29.95 KB
 Viewed:  2909 Time(s)

hit&miss.jpg


Dan




PostPosted: Wed Jul 30, 2003 10:47 am   Post subject: (No subject)

if there are only 9 difrent lvls where it gose up why not just use a logic stament like an if.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Archi




PostPosted: Wed Jul 30, 2003 11:27 am   Post subject: (No subject)

Well I did it a different way. I created a formula for each weapon, which if their ACC is at the top of the list (gets randomly set at beginning of game), then would give them the desired hit rate. Then when the players buy a new weapon I assign a variable a new number which will correlate with that of the formulas. it works out nicely. Only problem I have now is for determining the formula for the workshop items I create.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: