November 21, 2024, 01:10:02 PM

Author Topic: External playbook editor  (Read 74480 times)

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #15 on: May 24, 2016, 05:36:00 PM »
Hi Jake,

So in the play editor when creating a new offensive play, it goes through two menus:

First menu: 1) normal 2) Fake Punt

If you choose normal, the second menu with preset offensive schemes:

Second menu:
  • Side I
  • Tightends
  • 2 plus 1
  • 1 plus 1 plus 1
  • trips
  • 1 WR 2 Backs
  • 4 linemen

I assume you want the starting x,y for each position for these preset schemes? I will get them and post here (as well as the default fake punt positions).

I think I got the dimensions screwed up so I will list the max/min values for each direction in hex here:

The farthest left a player can go is 0x01, farthest right is 0x27 (39 decimal). The farthest to the bottom is 0x01, farthest to the top is 0x2B (43 decimal). In decimal for lateral dimensions: 39 - 01 = 38; vertical: 42.

So the field is actually 38 x 42 (40 x 44, but I assume the extra 2 on each dimension are the boundaries for out of bounds). Sorry for the confusion, I must have converted the vertical but not the lateral dimensions.
« Last Edit: May 24, 2016, 05:39:40 PM by blitzmaster5000 »

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #16 on: May 24, 2016, 07:32:42 PM »
Here are all the addresses for the first playbook first play with the scheme "side I". All the coordinates for the players are listed.

Code: [Select]
Playbook 1 addresses - scheme is side I; values for players are for this scheme

0x31D8 //playbook name, 6 characters
0x31DE //pin number, 4 characters
0x31E2 //play 1 name line 1, 8 characters
0x31EA //0x00
0x31EB //play 1 name line 2, 8 characters
0x31F3 //0x00
0x31F4 //0x04
0x31F5 //0x03
play data
x y ? action
0x31f6 11 08 00 80 // left lineman
0x31FA 00 00 00 00 //
0x31FE 00 00 00 00 //
0x3202 00 00 00 00 //
0x3206 00 00 00 00 //
0x320A 00 00 00 00 //
0x320E 00 00 00 00 //
0x3212 00 00 00 00 //
0x3216 14 08 00 80 //center lineman
0x321A 00 00 00 00 //
0x321E      00 00 00 00 //
0x3222 00 00 00 00 //
0x3226      00 00 00 00 //
0x322A 00 00 00 00 //
0x322E 00 00 00 00 //
0x3232 00 00 00 00 //
0x3236 17 08 00 80 //right lineman
0x323A 00 00 00 00 //
0x323E      00 00 00 00 //
0x3242 00 00 00 00 //
0x3246      00 00 00 00 //
0x324A 00 00 00 00 //
0x324E 00 00 00 00 //
0x3252 00 00 00 00 //
0x3256 14 05 00 80 //QB
0x325A 00 00 00 00 //
0x325E 00 00 00 00 //
0x3262 00 00 00 00 //
0x3266      00 00 00 00 //
0x326A 00 00 00 00 //
0x326E      00 00 00 00 //
0x3272 00 00 00 00 //
0x3276 19 04 00 80 //WR1
0x327A 00 00 00 00 //
0x327E 00 00 00 00 //
0x3282 00 00 00 00 //
0x3286      00 00 00 00 //
0x328A 00 00 00 00 //
0x328E      00 00 00 00 //
0x3292 00 00 00 00 //
0x3296 1C 08 00 80 //WR2
0x329A 00 00 00 00 //
0x329E 00 00 00 00 //
0x32A2  00 00 00 00 //
0x32A6      00 00 00 00 //
0x32AA  00 00 00 00 //
0x32AE      00 00 00 00 //
0x32B2    00 00 00 00 //
0x32B6 1C 06 00 80 //WR3
0x32BA 00 00 00 00 //
0x32BE 00 00 00 00 //
0x32C2  00 00 00 00 //
0x32C6      00 00 00 00 //
0x32CA  00 00 00 00 //
0x32CE      00 00 00 00 //
0x32D2    00 00 00 00 //
0x32D6 00 00 00 00 //?? all plays have similar code at end
0x32DA 00 00 00 08 //??
0x32DE    01 14 00 02 //??
0x32E2 00 01 02 02 //??
0x32E6 02 04 06 06 //??
0x32EA 06 00 01 00 //??
0x32EE 02 03 03 03 //??
0x32F2 00 00 //??

« Last Edit: May 24, 2016, 07:38:56 PM by blitzmaster5000 »

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #17 on: May 26, 2016, 12:12:45 PM »
Thanks! Pretty much just need to add a QB toggle for regular set, shotgun, and fake punt and the first phase of the play maker control should be complete.... Just will need to add reading, writing, and saving plays along with adding the preset plays... Also note the editor is currently only build out to handle offense plays. defense plays I'll have to refactor the code and probably wont get to it until offensive play making is fully built out...

Anyways here is a preview screen shot of whats in the works:



Still hoping to get the code added to GitHub shortly, keep in mind the code isn't that clean looking ATM.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #18 on: May 26, 2016, 01:12:15 PM »
This looks fantastic!! I can get you the values for the QB sets too if you need them. Do you want the other starting positions for the various schemes as well? If so, I could just post those instead of the whole playbook.

How exactly do you have the program write hexidecimal to a file? I've never seen (or needed) to do this before and I'm curious about how you do it. Another thing that would be cool is if there is an "export play image" button that saves the play made in the editor. That way if you're playing with a friend and they want to know the play, you could have the images of the various plays in the playbook on a phone or something to look at the routes. Additionally, it would be awesome if we could actually get the image to show like the default ones, but thay maybe a bit tricky.

Great progress regardless!

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #19 on: May 26, 2016, 02:41:15 PM »
Um, probably could hold off on the on the other starting positions for now. Yeah if you have time I could sue the 3 QB locations and I can add the toggle feature to it.

Here is an example of writing some text to a file, you'd just set the base to 16 for hex in the Convert.ToByte method.
Quote
using (var fs = new FileStream(filePath,
FileMode.Open,
FileAccess.ReadWrite))
            {
                fs.Position = offset;
                foreach (char letter in toBeWritten)
                {
                    fs.WriteByte(Convert.ToByte(letter));
                }

The Blitz Play Maker Control I'm making is actually just a custom PictureBox control so exporting the image would be super easy. To get the image to show exactly like they do in Blitz would be pretty hard. I'm going to guess they were all drawn by a human since they are actual image files in the game. Exporting some kind of picture based off of the play drawn in the editor could be possible down the road,  just would be scaling the grid down. First we need to figure out if its possible to add additional plays to the game. Have you had any luck finding the data in the game? I'd imagine Zoinkity would know since he moved the playbook pointers.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #20 on: May 26, 2016, 05:22:57 PM »
It looks like the y-coordinates for the QB are:

regular: 0x07
shotgun: 0x05
fake punt: 0x02

some of the other schemes such as trips actually have the QB position slightly different from the two regular or shotgun options. But really I think all that is necessary are the regular, fake punt, and shotgun. The preset schemes (trips, tight ends, etc) are really not necessary either, as the user can create all their own formations.

I am still looking at some of the other areas Zoinkity mentioned. Interestingly, so far the code I think maybe the plays looks entirely different than that made in the play editor. I guess they probably have more detailed routes, so the code looks different. Anyway, I will see what I can find out and let you know hopefully soon.

One other thing I thought about that would be pretty sweet: increase the playbook from 3 pages to 4 or maybe even 5. I think this would be especially useful for defense as I find the default plays not varied enough when playing against other people. If we could do that, we could not only include all of the default plays (including the ones not normally found unless "use team plays" cheat is used), but maybe figure out how to also include our own ones. That way we wouldn't have to load up a memory pak every time. But first things first - just finding the original plays!

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #21 on: May 26, 2016, 05:48:28 PM »
Definitely figured out where the play data is... Zoinkity's pointers are all correct. I don't have a lot of experience with pointers (didn't realize you basically just look at the values stored at the pointer address). The reason I was confused is the "play data" is all more pointers to the actual routes and what not. I'll append this post with more things I find out.

So like Zoinkity said, the play data is definitely non-trivial. Each play has pointers to data that sets the various routes. But I'm not sure how exactly it choses them... It's not intuitive like the playmaker data is.

For instance, starting at 80290A68 is the code for WR1:
00000001
00000002
FFFFFFF80
00000004
0000000A
0000000E

Each of these are different pre-defined routes. I copied FFFFFF80 over 6 of the neibhoring addresses and he did the same route each time - go straight, wave, go left, run back, go up field.

If I copy any of the others, it will do different routes. Still trying to figure out what's going on with these various values.
« Last Edit: May 26, 2016, 07:04:15 PM by blitzmaster5000 »

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #22 on: June 02, 2016, 08:58:18 AM »
Any updates on the team plays?

Also could you send me the memory pack file.

Will be uploading to github tomorrow.

Thanks!

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #23 on: June 02, 2016, 12:03:41 PM »
Haven't been able to do much over the last few days. I'll send the mpk file tonight.

I figured out what some of the code near the end (addresses 0x32D6 - 0x32F2 for the first play in first playbook) of each play does - it has to do with what "position" each player is, in regards to their AI.

For instance, all receivers have a value of 0x06 while linemen are 0x02:

Code: [Select]
0x32E2 00 01 02 02 // 02 values = tells player to be lineman
0x32E6 02 04 06 06 // 06 values = tells player to be receiver
0x32EA 06 00 01 00 // 3 of each, for the 3 receivers and 3 linemen

So if you change any of the 0x06 to 0x02, it will change the respective receiver to behave like a lineman. I'm still working out what each value represents - I'll post what I find soon.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #24 on: June 02, 2016, 11:04:47 PM »
I've figured out a tiny bit of the data for the default plays.. it's definitely not the same format as the custom plays generated by the play editor. I think this means incorporating our plays as default ones is ruled out unfortunately as the code is so different. I have mapped out a bit of the default play data, but it's not intuitive - I haven't found any logical changes besides a few things.

Unfortunately I think editing the default plays will be too difficult. I think we could copy+paste some of the default plays from 2001 to 2000, but beyond that, I don't see being able to do much.

Nonetheless, here are some things I've found:

Any sort of value of FFFFFFXX where XX = 00 - FF dictates the angle of the route at that given time. So FFFFFF00 will make the route horizontal (90 degrees to the viewer), FFFFFFFF will make it vertical (180 degrees; upfield). Anything in between will be some angle between them.

An example:

switchup data for the first WR starts at 80290A68:
80290A68 00000001
80290A68 00000002
80290A68 FFFFFF80 <--- this sets the angle of the first leg of the route for WR1. closer to FFFFFFF0 is a vertical route; FFFFFF00 is a completely horizontal route

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #25 on: June 03, 2016, 09:00:05 AM »
Thats the location in memory I take it? Could you explain it a bit more? if we just need to create some hex values that say the angle at X time of the route I feel like that wouldn't be that hard.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #26 on: June 03, 2016, 03:15:05 PM »
Yea this is the play data for 1 player in switchup in memory. You're right - editing this route angle would be easy, however the other addresses surrounding these seem totally nonsensical. The address before has a value of 00000002. Changing this to most other values makes the player not move at all - if I change it to certain other values (can't remember what they were), he would do a route, but it's completely different than what he's supposed to do. Changing other values near this address sometimes does nothing, othertimes does something.

The trick would be mapping out what all these individual values mean. I'm still going to play around with it and see if I can figure it out, but so far it's been pretty tough.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #27 on: June 05, 2016, 08:23:02 PM »
I've been figuring out how the game reads the playlist to be loaded into the playbook for default, team plays, and custom plays. They all appear to be loaded and written to by the same function. We should be able to modify the default playlist in the ROM if we wanted to without loading a custom playbook. But really what I want to try and do is see if we can increase the number of pages in the playbook.. If we could do that, we wouldn't have to chose which plays to have, as we would have all of them at all times. I will post more details tomorrow hopefully.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #28 on: June 06, 2016, 11:08:28 PM »
Found how to increase the number of pages in a playbook! It was way easier than I thought. Basically just had to find the register that was being compared to to see if it needs to go back to page 1.
8032E540   ADDIU V0,R0,0x0008 <--- the last value sets the # of pages. As is with a value of 8, it will have 8 pages.

Here's an example where I just dumped some random play values:


The nice thing about this change is that it looks like we will be able to add the values for each play right after the previous ones that are loaded in. The play data is located at 802AF270, and has each play in-line. so the default playlist is just
00010203 04050607 etc..

This is the first step, next step if actually writing the values to this area. As I mentioned previously, I know the function that sets the playlist whether for a custom playbook, team plays, or just default. I think it would be just a matter of writing all the bits for the other plays in-line after the data there for the first 3 pages.

I did notice that for some reason the 4th page (which is actually trying to pull data from where the defensive and/or audible values are) was identical to the 3rd, however the 5th and on were all exactly how I would expect if I  input some custom values. I think what will need to happen is once the register hits 3, have the function reading in the plays jump down to a new area that we can put our code. That way we aren't messing with where the defensive/audibles are.

The last thing is I didn't mess with this while using a custom playbook (or on defense), so I'm not sure how that will work. Nonetheless, this should be pretty awesome once we get it all worked out, along with the external playbook editor! I think it means we maybe able to increase the amount of pages of custom plays as well!

Edit: Found the address to change to allow more pages when using a custom playbook:
8032E580   SLTI   V0,S3,0x0004   //sets the number of playbook pages when having custom plays;default 4   
« Last Edit: June 07, 2016, 05:52:56 PM by blitzmaster5000 »

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #29 on: June 09, 2016, 09:47:58 AM »
Great news!

 As for myself, I haven't been doing much work lately on this. Been pretty busy. hope to dive back into it some more next week after I get a home remodel project done..