Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Hit/Miss System
Author Message
Archi

Posted: 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

Dan

Posted: 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

Posted: 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:  3235 Time(s)

Dan

Posted: 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

Posted: 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: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: