Jump to content
Maynard_G_Krebs

CPU Logic for Play Selection?

Recommended Posts

This question is directed at the coding gurus (or anyone who might have information about the subject):

What do we know about how the CPU selects offensive and defensive plays? Are these bytes editable to streamline the logic to which the CPU selects offensive / defensive plays? Is it based purely on what offensive / defensive pattern the player selects, or is it situational?

[Example]

I've been scanning over my knowledge base and trying to pinpoint any future edits I'm still interested to make for Tecmo Super Coach. This is the last 'topic of interest' that I know nothing about, and could go a long way into making playing the computer more interesting / challenging.

Bueno for any education provided.

Share this post


Link to post
Share on other sites

if anyone knows it's jstout.

CPU play calling logic is one thing that is very bad. TSB Ultra was trying to implement something like that back in the day where you could set play tendencies for each team. TSB Ultra was basically a modification of on of the emulators that would implement most hacks via RAM and a separate GUI interface.

viewtopic.php?f=37&t=1937&hilit=TSB+ultra

I wish that coder had gotten farther along as that is really the best way to hack tecmo rather than to try and hard code everything where you are so limited by the NES architecture. Not to say that what has been accomplished by cxrom, jstout, and you isn't anything short of amazing.

Even some very basic logic on offense and defense would go a long way.

The CPU logic is probably pretty close to completely random but I've never looked into it.

Share this post


Link to post
Share on other sites
if anyone knows it's jstout.

CPU play calling logic is one thing that is very bad. TSB Ultra was trying to implement something like that back in the day where you could set play tendencies for each team. TSB Ultra was basically a modification of on of the emulators that would implement most hacks via RAM and a separate GUI interface.

http://www.tecmobowl.org/forum/viewtopic. ... =TSB+ultra

I wish that coder had gotten farther along as that is really the best way to hack tecmo rather than to try and hard code everything where you are so limited by the NES architecture. Not to say that what has been accomplished by cxrom, jstout, and you isn't anything short of amazing.

Even some very basic logic on offense and defense would go a long way.

The CPU logic is probably pretty close to completely random but I've never looked into it.

That's the thing; I'm not totally sure if it is random. Now that this ROM I've edited has universally specific defensive reactions, I'm beginning to notice some tendancies by the CPU. I don't know enough about the game engine itself, regarding CPU play selection, to create any sort of educated theories however, so I'm going to have to hope that Jstout or the other coding homies here have a better understanding of what's going on.

That is an interesting link, though, for sure.

Share this post


Link to post
Share on other sites

I'm inclined to agree with YM here that the CPU logic's play selection might be considerably less than random. When I altered the CPU logic in TSB3 for 4th down decision-making, I had to adjust factors that the CPU takes into account like yards-to-go, ball location and time on the clock.

It's certainly possible that the CPU goes through similar 'scenario' logic on 2nd and 3rd down (1st down being 100% random would seem very plausible), but given the more primitive assembly language for TSB, a mostly random CPU playcalling logic wouldn't shock me...

amrush

Share this post


Link to post
Share on other sites

For the most part, the offensive and defensive play calling is totally random but there are a few situational logic calls like right near the goal line it will call run more than pass. There is a lot of logic on whether to kick a field goal, punt, or go for it. I attached all the relevent game code (it is quite long and goes every which way).

I'm quite sure code can be written to adjust the computer to whatever you wanted. On a side note, I wrote some defensive code that works in the same way as TSB Ultra that actually is on the CIFL rom.

*Code now has notes to help follow along

tsb_play_call.zip

Share this post


Link to post
Share on other sites
That is some fascinating stuff right there. I wouldn't even know where to begin with the questions in my brain. Looks a little like Hebrew to me right now, but maybe in time...

I updated the file above with some notes so it is somewhat easier to follow along.

A test scenario (also can help learn to follow the code):

Offense is down by 3 in the 4th quarter (10 seconds remaining). 2nd down and 7 to go on the 15 yard line. Clock is running and offense has no timeouts.

Computer Path:

Offense - Loop1, 4th Quarter - Loop2, 4th Quarter - Loop3, Out of Timeouts - Loop10, 15 yard line - Loop50, 4th Quarter - Loop51, Defense is ahead - Loop52, 3 point difference - Loop29, Field Goal Play Call - Loop4 then Returns to Game.

Computer will kick a field goal =)

Share this post


Link to post
Share on other sites

The CPU logic that always annoyed me the most was when a team is trailing by 8-10 (in FG range on 4th down) they ALWAYS go for it, instead of kicking the FG and trying an onside kick...

Share this post


Link to post
Share on other sites
The CPU logic that always annoyed me the most was when a team is trailing by 8-10 (in FG range on 4th down) they ALWAYS go for it, instead of kicking the FG and trying an onside kick...

Yeah I fixed that last year for TSB3. Makes the games vs COM much more fun and tense.

Don't know if anyone here's done that for the older versions...

amrush

Share this post


Link to post
Share on other sites
The CPU logic that always annoyed me the most was when a team is trailing by 8-10 (in FG range on 4th down) they ALWAYS go for it, instead of kicking the FG and trying an onside kick...

Yeah I fixed that last year for TSB3. Makes the games vs COM much more fun and tense.

Don't know if anyone here's done that for the older versions...

amrush

If you ever see this amrush (or the other leaderboard science-droppers), what's the chance you can tinker with the NES TSB and scout this out?

Share this post


Link to post
Share on other sites

RE: jstout text file


 

speaking of which....I can read this and translate into opcodes - but I simply can't find it in the rom...could you tell me where the actual rom location of this shizz begins?  Once you point me to the right place, I can sort through the rest I bet.

 

here is a snip for example....where does the code for "LOOP 1" begin as a hex location in the rom?

L_12_9000:	JMP L_12_A6F3L_12_A6F3:	LDA #$00	STA $40 ; PLAY CALL	STA $41 ; BYTE HOLDER	STA $3E ; BYTE HOLDER	STA $3F ; BYTE HOLDER	LDA OFFENSE_DEFENSE_TOGGLE	BPL @Loop1 ; Go if Offense	JMP @Loop74 ; Go if Defense; Offensive Code@Loop1:	LDA QUARTER	CMP FIRST_QUARTER	BNE @Loop2 ; Go if not First Quarter	JMP @Loop16 ; Go if First Quarter
Edited by buck

Share this post


Link to post
Share on other sites

Im not near my notes so... if you can translate opcodes you can figure out where it starts. The L_12_A6F3. Search for the first 4 -5 commands as a long byte string. You'll know you are at the right spot when you are at address is xx703. 6f3+ 0x10 ines header offset.

Then its all linear...loop 1 is 3 bytes after the jump command.

Share this post


Link to post
Share on other sites

I believe it L_12_A6F3 corresponds to 0x170F3 but double check me.

 

I just did a quick search translating the first few opcodes (A90085408541853E853F) and found it sitting at 0x18703.  I'm pretty sure this is it here...Will be digging.

Edited by buck

Share this post


Link to post
Share on other sites

ok, been through it all and wrote down locations of all the loops and actually copied every damn byte in a spreadsheet.  most of it is straight forward.  I'm working on making an outline or flow, but we'll see how far that goes.


 


Essentially, this code is how the COM determines what play it will call (uses offensive preference, score, field location, yards to go, time on clock, down, quarter, etc to decide) or if COM will attempt FG or Punt.  Also, COM defensive play calling is in here, too, starts at Loop 74.


 


NOTE - there is nothing about Onsides kicks in this, that I can see!  


 


 


now, as a side note, I'm also looking at jstout CIFL (base for my TSB "street") ROM and all this code is different.....so it looks like I'm really gonna have to learn it now.


Edited by buck

Share this post


Link to post
Share on other sites

now, as a side note, I'm also looking at jstout CIFL (base for my TSB "street") ROM and all this code is different.....so it looks like I'm really gonna have to learn it now.

 

What exactly is different?  Was the logic moved to different locations or completely rewritten?

Share this post


Link to post
Share on other sites

What exactly is different?  Was the logic moved to different locations or completely rewritten?

 

it's not as different as I initially thought, defense is the same, general outline looks the same.  but I didn't get to comb all the way through CIFL, yet.  

Share this post


Link to post
Share on other sites

Compared my notes vs jstouts original work on this. 

 

COM DEF Timeout logic: 

1. Not 4th qtr or OT= don't take timeout  

2.  Tied or leading = don't take timeout

3.  More than 3 minutes left = don't take timeout

 

4th or OT and COM is trailing

1. 2-3 minutes left = 75% chance of timeout

2. < 2min left = 93% chance of timeout

 

COM DEF Playcall  logic:

1.  Not 3rd or 4th Down = completely random play call

3rd or 4th down 

1.  yards to go <3 = 80% run, 20% pass 

2.  yards to go between 3-7 = random play call

3.  yards to go >7 = 80% pass, 20% run

 

 Onside Kick Logic:

1. Not 4th Qtr or OT = do normal kick

 

2. 4th qtr < 2min and trailing = do onsides 

 

3. >=2 min left in OT = do normal kick

4. <2 min left = 75% chance of onsides

Share this post


Link to post
Share on other sites
On 5/28/2014 at 1:13 PM, buck said:

ok, been through it all and wrote down locations of all the loops and actually copied every damn byte in a spreadsheet.  most of it is straight forward.  I'm working on making an outline or flow, but we'll see how far that goes.

 

 

 

 

Essentially, this code is how the COM determines what play it will call (uses offensive preference, score, field location, yards to go, time on clock, down, quarter, etc to decide) or if COM will attempt FG or Punt.  Also, COM defensive play calling is in here, too, starts at Loop 74.

 

 

 

 

 

NOTE - there is nothing about Onsides kicks in this, that I can see!  

 

 

 

 

 

 

 

 

now, as a side note, I'm also looking at jstout CIFL (base for my TSB "street") ROM and all this code is different.....so it looks like I'm really gonna have to learn it now.

 

Did something get lost in this post when the site changed their backend?

 

I hate when a team goes for it on 4th down by three late in a game when in FG range or when they go for it deep in their territory setting up a b.s. win. How can I begin to understand what to edit in the game from the file jstout posted? And can this be used with a set command?

Share this post


Link to post
Share on other sites

jstouts original file can still be downloaded. It's at the beginning of this post. 

 

Its a convoluted mess of jumps and compares but ya it could be edited.

 

The com going for it on 4th only sets up an easy win because it's the COM. Ha ha.

Share this post


Link to post
Share on other sites

So it's like setting if conditionals in code, is that right? I just don't know how to decipher what he posted. What should I be searching for to be able to edit this? I see from buck's post that the code to edit starts at 0x18703. After that I am a deer in headlights.

Share this post


Link to post
Share on other sites

Ya its not easy to explain because its a mess of conditionals. By the time I explain what needs to be done I might as well just do it because it would take just as long. Sorry.

 

I'm probably not going to work on it anytime. This is ONE section of conditionals that would need to be adjusted. 

 

image.thumb.png.478bab9232081d753b3979ee7b38533d.png

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×