Dee-Nee Forums

General => RBI Baseball => Topic started by: nightwulf on 08/14/04, 04:44:30 AM

Title: Pitcher speeds
Post by: nightwulf on 08/14/04, 04:44:30 AM
The recent discussion about the slowest possible speed got me interested in looking into the pitching engine. I think I've got the algorithm that determines the speed of each pitch nailed down.

http://nightwulf.rbicentral.com/speedmatrix.txt

This file is a matrix (yeah, hah hah) showing the possible speeds for each type of pitch for each pitcher, based on their starting stats. For example, under Fastball on the N.Ryan line, you see "95-102". This means that with his starting stats (before stamina is depleted and pitches start to slow down), any fastball thrown by Ryan will fall between 95 and 102mph.

Take a glance at the file and see if the numbers listed match your own experiences in game. I'm fairly sure I've got the formulas down, but I thought I'd post this up to see what the community thinks. Plus, it's kinda fun to see the different speeds. Well maybe that's just me.

Also, has anyone seen a pitch speed ending in 4 or 9? If I have this formula correct, it's impossible.

Nightwulf
Title: Re:Pitcher speeds
Post by: Gantry on 08/14/04, 04:50:17 AM
Good stuff nightwulf.  I was chatting with nightwulf while this was all going down and did some pitcher testing.  Low and behold, you can't throw a pitch that ends in a "4" or "9" - can't believe nobody has noticed this before...

PS nightwulf - Post the pitcher speed algorithm if it's too much work...
Title: Re:Pitcher speeds
Post by: nightwulf on 08/14/04, 04:56:21 AM
It totally makes no sense. The script that generated that file is attached. I haven't "decimalized" all of it yet, so I'll have to do that before really trying to explain it. I don't understand it fully yet myself.

But read away if you'd like. :)

Nightwulf
Title: Re:Pitcher speeds
Post by: capt_taco on 08/14/04, 05:35:45 AM
This lines up almost exactly with what I've expected the pitchers to throw... I did a little testing on some of the ones I questioned, and lo! It still works, though I still have trouble believing that Saberhagen never threw above 90 for all these years. But when I tried it, he really doesn't.

I also could've sworn I once threw 102 with Clemens and 103 with Ryan, but now I'm not so sure. I may be mixing the 103 number up with Ryan's fastest pitch in real life.

And come to think of it, I honestly don't remember throwing anything that ended in a 4 or a 9. Question, though: What makes it impossible to do that? It'd be interesting to know.

Overall, Nightwulf's analysis once again looks like it's right on, and a damn fine job as well, if you want my personal opinion.
Title: Re:Pitcher speeds
Post by: nightwulf on 08/14/04, 03:30:04 PM
Quote from: capt_taco on 08/14/04, 05:35:45 AM
I also could've sworn I once threw 102 with Clemens and 103 with Ryan, but now I'm not so sure. I may be mixing the 103 number up with Ryan's fastest pitch in real life.

See, that's exactly what was happening to me. I also thought I'd hit 103 with Ryan, but now I'm fairly sure 102 is his max.

Quote from: capt_taco on 08/14/04, 05:35:45 AM
And come to think of it, I honestly don't remember throwing anything that ended in a 4 or a 9. Question, though: What makes it impossible to do that? It'd be interesting to know.

It's a long, long story, that I really can't put into english yet. Stay tuned. :)

Nightwulf
Title: Re:Pitcher speeds
Post by: Medwck on 08/14/04, 09:02:06 PM
Juan Berenguer had 103 blasts. No-look Ryan had 101 (102 very rarely.) ;)
Title: Re:Pitcher speeds
Post by: nightwulf on 08/16/04, 04:22:34 AM
Ok, I think I've "englishized" the algorithm. Taking binary math operations and explaining them is ... odd at best.

Let's take the legendary John Tudor and throw a fastball. Tudor's fastball speed "rating" is 189. Here's the pitch:

- Divide the rating by 32.
189 / 32 = 5R29 (5 remainder 29)

- Multiply the quotient by 256, multiply the remainder by 8, and add them together
(5 * 256) + (29 * 8) = 1280 + 232 = 1512

- Subtract 64
1512 - 64 = 1448

- Add a random number (0 - 127) ... Tudor's on fire, so let's add 127
1448 + 127 = 1575

1575 is, internally, the speed of this pitch. Note that for this particular pitch (with a speed rating of 189) it could be anywhere from 1448 to 1575.

Next, we go from 1575 to a speed in miles per hour.

- Divide the speed by 256
1575 / 256 = 6R39

- Multiply the quotient by 15
6 * 15 = 90 ... hang on to this number

- Divide the remainder by 16
39 / 16 = 2R7

- Take the quotient and apply it as follows:
If the quotient is:
0- add 0 to speed above (the number I told you to hang on to)
1- add 0
2- add 1
3- add 2
4- add 3
5- add 3
6- add 5
7- add 6
8- add 7
9- add 7
10- add 8
11- add 10
12- add 11
13- add 11
14- add 12
15- add 13

-So take the "90" we hung on to earlier, and since the quotient of the last calculation was 2, according to the table above we add 1.
90 + 1 = 91

There it is. 91 mph. Aren't you sorry you asked?

I'll stare at this longer some other time and see if I can't try to simplify it, but this works. Note that in the last table, 4, 9, and 14 are never added, which is why a pitch can never end in 4 or 9. Why was it done this way? No damn idea.

The formula also holds up when calculating the slowest and fastest possible pitches. The fastest speed rating in the game is Berenguer's fastball rating (216). Run 216 through the calculations above, and when the game would calculate a random number (0-127), use 127. You'll end up with 103 miles per hour.

Any pitcher in the game will eventually end up with a 62 sinker rating once their stamina is depleted, and that's the "floor." So, run 62 through all the bullshit, and use 0 as the random number. This will give you a 25 mph pitch, which is the slowest possible pitch in the game.

Why the hell did I bother looking at all this? Good question. In another thread about the Japanese games, someone asked if it was possible to convert the km/h speeds those games show to mph. Well, if the pitching engine is similar (and I'm betting it is), it's possible that the routine that converts the internal pitch speed to km/h can be replaced with a routine to convert to mph. Plus I enjoy plowing through code and figuring shit like this out. Yeah, I'm that boring.

Nightwulf
Title: Re:Pitcher speeds
Post by: Dryden on 08/16/04, 01:04:04 PM
For those that are calculator impaired, I have attached an excel sheet that will do this calculation for you (might be helpful for those creating ROMs).

Thanks again to Nightwulf, awesome work!
Title: Re:Pitcher speeds
Post by: Dryden on 08/16/04, 01:22:56 PM
And this is a table that lists the min and max speed for all (reasonable) pitcher speed values.
Title: Re:Pitcher speeds
Post by: nightwulf on 08/16/04, 06:54:11 PM
Great table, Dryden. That brings me to another question though. If I can find a way to do it that doesn't look like complete ass, should pitcher speeds in the editor be selectable by speed?

That is, I could have a drop down box that allows the user to select pitcher speeds by a range of mph. For example, you'd choose from "97-103", "96-103", "96-102" etc. Or the user could enter minimum and maximum speeds, and the editor could find the closest match. Or you could specify an average speed and have the editor find the closest match that way.

Any thoughts?

Nightwulf
Title: Re:Pitcher speeds
Post by: Gantry on 08/17/04, 10:20:43 AM
I think a range would be nice...  User selectable is good but just knowing how fast a pitcher is going to throw when you set that cryptic speed rating would be very hand indeed...
Title: Re:Pitcher speeds
Post by: Dryden on 08/17/04, 10:23:36 AM
I like the range idea as well.

On a side note, any progress towards knowing what the 2 unknown pitcher values are for?