Stunts Forum

Stunts - the Game => Stunts Reverse Engineering => Topic started by: Daniel3D on July 09, 2020, 02:55:56 PM

Title: OPP files (opponents)
Post by: Daniel3D on July 09, 2020, 02:55:56 PM
There is a lot known about the oponents. Mainly because of Oponent blaster.
and some new insights with sterssed.

I read in the wiki page conserning the Pre/res file the folowing.
QuoteIn addition to sped, opp?.pre also contains path, a much larger (186 bytes) numerical data resource which function is not yet understood.
I have some ideas about that and i'm about to do some testing (mostly breaking stuff until it works again)

Usually you don't see your opponent because its so damn slow. But i have studied oponent behavior in the past so i could make personal tracks for them that were better than the base game tracks.

I notised that the have a prefered path on the track. On banked roads and in pipes i notised that especially.
Like the useage blocks in pipes because the Oponents always drive like the are there. They don't seem to see the difference.
Quotethe above statment is from a memory long ago, needs validation and could be based on Stunts 1.0

I also would like to try to add opponents if possible. (i don't want to alter the base opponents, nostalgia)
maybe portraid by people that have kept the game alive like Nailwood, Riebisch, Dstien, duplode and CAS to name a few  8)
in de same sense that the original opponents were portraid by employees of IDS.

Just keeping my mind busy...
Title: Re: OPP files (oponents)
Post by: Cas on July 09, 2020, 08:25:54 PM
Well, I have to say that, while I've been very active in recent years, especially building Bliss, for half the life of Stunts community, I have been pretty absent. What I mean is, surely other folks deserve the honour of appearing in Stunts better than I, ha, ha.

On the technical aspect, I think that the reason why opponents have not been put much attention on as have cars and tracks is that they're so easy to beat. Of course, we could tweak the files and create personalities, but I'm under the impression that Skid's profile is the base for the other opponents and that each of the other ones has one or more "shortcomings" activated that are all off for Skid. If this is so, what it means would be that Skid is the best possible opponent that can be created for Stunts engine. Disappointing, but I'd be surprised if it weren't so. I mean, if it is possible to make a better opponent, why wouldn't DSI include such opponent?

So, while new opponents likely won't be competitive, I still do find the idea of creating them very interesting and would like to see that happen :)  I can't blame DSI, really. If I were to create an AI for a game like Stunts, I really wouldn't know how to start facing the problem :P
Title: Re: OPP files (oponents)
Post by: Overdrijf on July 09, 2020, 11:36:16 PM
Quote from: Cas on July 09, 2020, 08:25:54 PMOn the technical aspect, I think that the reason why opponents have not been put much attention on as have cars and tracks is that they're so easy to beat. Of course, we could tweak the files and create personalities, but I'm under the impression that Skid's profile is the base for the other opponents and that each of the other ones has one or more "shortcomings" activated that are all off for Skid. If this is so, what it means would be that Skid is the best possible opponent that can be created for Stunts engine. Disappointing, but I'd be surprised if it weren't so. I mean, if it is possible to make a better opponent, why wouldn't DSI include such opponent?

This is basically the story I heard, for instance from the big Kevin Pickell interview (http://zak.stunts.hu/articles/interview-with-kevin-pickell-lead-programmer-of-stunts):
"We already know about who the opponents are in real life. Why are them so weak and dumb in the game?

They wanted them to be vastly different, originally they were only slightly dumber and slower but the company wanted to make them more different and the only way was to make them even slower and dumber."

In other words: they started with a single weak opponent, and the only way to add personality on the track was to make them worse.



I don't think technically Skid is the best possible opponent, at least not on all possible tracks. I think all the opponents operate on maximum speeds they will drive at for different types of element. Skid goes flat out on the straights and slow enough that he usually won't crash in the corners. But by allowing a bit more speed in corners you could make an opponent that sets faster times, if he makes it through in one piece at all, while a slower opponent would have a higher chance to finish (unless the problem is that they don't make a jump somewhere because they're moving too slow).

And no, I don't actually know if the car the opponent is driving has any influence on this, if for instance you could make a faster version of skid that just flies out of all corners unless you give him at least a Jaguar.
Title: Re: OPP files (oponents)
Post by: Daniel3D on July 10, 2020, 05:38:31 PM
I've been thinking.
I think that the opponents driving is done in a similar way as how replays are stored and replayed.

Each track piece has a speed value and a pathway. That gives direction and magnitude.
I don't know how far the 'ai' can see ahead. But I think it is one tile. (Same distance as the placement of corner signs)

The path itself is (I think) based on coordinate like checkpoints.
Stressed can't view this data (I couldn't at least)
So tis is purely speculation on my part.

  8)
EDIT.
After some digging in the file data I have altered my view a little bit. The path is set per tile and stored per tile (combined with collision data?)

The opponent file only contains diffirations from the path. Sid has none, the others have some (based on their weaknesses) and or speed variations.
Title: Re: OPP files (oponents)
Post by: Daniel3D on July 16, 2020, 01:46:28 PM
I've been looking at the hex path data in the opp#.res (or .pre) files and have been comparing the different opponents.
I noticed that none have the same component with a value. and that there are always groups of 2 or 4 with the same value. (although bernie claims to have problems with all elements, he does not have the ones claimed by the others)
I think therefore that each of the 186 component correspond with a track element and have separate for each orientation.
EDIT:
Quote from: Duplode on May 06, 2008, 04:08:13 AM
186 text IDs associated with individual track pieces.

this are deviations of the path with a max value of 0A (a.k.a. 10 dec.)

considering this, it is not possible to make a much better opponent than Sid (save a speed alteration)
but fun stuff is possible, like a opponent that is afraid of the finish line.

Also it seems that the number of opponents is set somewhere or not all values are known. Its easy to replace a opponent but it seems impossible to add a 7th one.
Title: Re: OPP files (oponents)
Post by: Cas on July 17, 2020, 12:56:36 AM
Maybe the path to be followed per track element and the maximum/optimal speed at which it should be taken is something fixed that's compiled with the game and the opponents only have information on whether to slowdown on certain track elements. As you say, it'd be super funny to see an opponent slowing down just before the finish line :P  I think I can start exploring and testing to see what happens.

I think very long ago I made a test copying OPP6 files to OPP7 and nothing happened, meaning the game menu is hardwired to give you six different opponents, but... it has happened to me while researching on replay files that, changing the opponent ID number can lead to "file not found", meaning one could make a replay point to extra opponents somehow (perhaps exactly as I did that time, but I don't know because I haven't tested it). This is akin to what happens with the background landscape. Ingame, you can only pick one of the available ones, but in a track file, you can set it to a higher number, which goes chaotic and unstable, suggesting it's reading past some point in memory where landscapes are stored one after the other. Of course it could also be that opponents are identified in memory, but the "file not found" error message hints otherwise.
Title: Re: OPP files (oponents)
Post by: Daniel3D on July 18, 2020, 12:18:26 AM
As far as I can determine I think that the speed data is only set in the opp#.res file since all speeds are given for all opponents.
The path data is verry limited (skid and helen have no data set in Path)

I've made a overview of the values per opp and the groups if data I see. the are groups of 2, 4 or 6 times the same value.
the groups of 2 are elements with 2 orientations like strait road, the tunnel or the slalom.
the groups of 4 are elements that can be rotated like corners.
There are 2 groups of 6. one on line 0040 and one on line 0060.
I think the first is the pipe (start - mid - end in 2 orientations)
and the second is the bridge. (up - mid - down in 2 orientations)
All the pink groups are probably corners.
Purple elevated roads.
green could be  normal road, dirt and ice.
this is speculation based on very little,

CAS, I hope you can dig a little deeper.
Title: Re: OPP files (oponents)
Post by: Daniel3D on December 10, 2020, 01:56:17 PM
O my..
Somebody did a AI Investigation on Stunts 2 months ago  ???

thats surprising, but also exactly what i didn't get around to do...
https://www.youtube.com/watch?v=kmP0uAxz8Dc (https://www.youtube.com/watch?v=kmP0uAxz8Dc)
Title: Re: OPP files (oponents)
Post by: Cas on December 10, 2020, 10:48:58 PM
Ah!  I saw that video, I've already been watching it!  From what it says, it's Cherry who's always last because of how slow she's taking curves. The order is completely unlike what one would guess from opponents' order number.

Again, I didn't see your previous message when it came out. Is there a way I can choose which topics to follow or to clearly see when there's something new?  I think I need to flag everything as read so that I can begin to make real use of the "new" marks in this forum!  Any recommendations?  How do you guys do it?
Title: Re: OPP files (oponents)
Post by: Daniel3D on December 11, 2020, 06:55:39 AM
Quote from: Cas on December 10, 2020, 10:48:58 PM
  I think I need to flag everything as read so that I can begin to make real use of the "new" marks in this forum!
I do just that occasionally for the sections of interest.  8)
Title: Re: OPP files (oponents)
Post by: KyLiE on December 11, 2020, 01:08:45 PM
Quote from: Cas on December 10, 2020, 10:48:58 PM
Is there a way I can choose which topics to follow or to clearly see when there's something new?

I make frequent use of the "Show unread posts since last visit" feature.
Title: Re: OPP files (oponents)
Post by: Daniel3D on December 11, 2020, 02:16:28 PM
Back on topic  :P
I still think that the 186 Hex values in the matrix are path deviations, Gemini said something like that in his video as well although it doesn't really impact the time .
I think that may also be because the values are very low and the deviation therefore small, except for one case with Bernie of a 0A (aka 10) and 05, only he and cherry have 04. All others have lower or nothing.
Finding out what value is for what track piece can be useful, maybe we can make Sid a bit more careful on some track pieces.

I have a feeling that Bernie has the 0A on the slalom.. But that's just a hunch.

We could tweak the opponents so that they actually drive as stated. (aka lose if their weakness is there and be good on tracks with their strength)
Title: Re: OPP files (oponents)
Post by: Daniel3D on December 11, 2020, 02:32:13 PM
Quote from: Daniel3D on December 11, 2020, 02:16:28 PM
I have a feeling that Bernie has the 0A on the slalom.. But that's just a hunch.

Yes, I know. I'm quoting myself...
But I figured it out  ;D

The values correspond with track file data.
http://wiki.stunts.hu/index.php?title=Track_file (http://wiki.stunts.hu/index.php?title=Track_file)

Most corners point to Cherri and the 0A of Bernie point to the LOOP.

:D
Title: Re: OPP files (oponents)
Post by: Cas on December 11, 2020, 06:33:00 PM
Oh!  That is a discovery!  But... you say 0Ah corresponds to the loop, yet in the Track file article, the loop is 40h or 41h. So what did you mean by that?   It'd be great to be able to produce other combinations for opponents. :)
Title: Re: OPP files (oponents)
Post by: Daniel3D on December 11, 2020, 09:54:47 PM
Quote from: Cas on December 11, 2020, 06:33:00 PM
Oh!  That is a discovery!  But... you say 0Ah corresponds to the loop, yet in the Track file article, the loop is 40h or 41h. So what did you mean by that?   It'd be great to be able to produce other combinations for opponents. :)

Indeed, row 40 : position 0 and 1 are 40 and 41
The variable for that path is 0A in Bernie's path data.
8)
Title: Re: OPP files (oponents)
Post by: Cas on December 12, 2020, 12:53:52 AM
Ah!  I understand now. So the position in the file indicates the stunt and the value indicates how much of a slowdown for that stunt. Right?  This is super easy!  We can begin experimenting :D

The curious thing is that, while it makes a lot of sense, it seems to overlap with the function of the other section. See here: http://wiki.stunts.hu/index.php?title=Opponent_files

The sped section is very brief. What you are describing, I understand, is the path section, which happens to be as long as the number of track elements. However, the function of these two sections is then very similar, in a way. I wonder how the two interact.
Title: Re: OPP files (oponents)
Post by: Daniel3D on December 12, 2020, 07:07:55 AM
Sped is purely speed data per tile type. Path is directional left / right.

Based on memory of strange ai behaviour I believe the path variable makes the opponent deviate from the ideal path by a factor. Measured from the centre of the road.

On slalom the ai should take the corner's wider.
EDIT: I see now that none of the opponents have a modifier for the slalom (row 7 variable 3 and 4).
Same for the cork u/d and the highway.
I wonder why.. could be interesting to give those high values....
/Edit

I can't test though. All testing programs and data is in storage at the moment.  :-\

The ideal path I believe is set in the track tile data with the collision data. (Maybe that combination makes it so difficult to find)
Title: Re: OPP files (opponents)
Post by: Daniel3D on December 12, 2020, 08:14:39 PM
Nice visual (taken from Gemini)
(http://www.pixelships.com/adg/files/stuntstileshexsheet.png)

(The isometric tiles are a unrelated bonus)

In the YouTube video (link in a post about track files) Gemini maps all tile numbers in a grid (see blurred image in attachment)
Curiously that stops at b5, but the opponent path file goes to b9...
[B6 -> B9 - Paved slopes]
Those four can have path data. Dirt and ice slopes can't... Apparently..
Title: Re: OPP files (opponents)
Post by: Cas on December 12, 2020, 09:04:35 PM
I should take a look and update the Wiki with that info :)
Title: Re: OPP files (opponents)
Post by: Daniel3D on December 12, 2020, 10:04:03 PM
You know,..
I actually feel honoured to have found something significant enough to be added to the wiki.
Title: Re: OPP files (opponents)
Post by: Cas on December 13, 2020, 03:10:01 AM
And you surely should be mentioned there!   But before editing, we should test this thoroughly. You might find this useful:

http://www.raceforkicks.com/downloads/fodix04.zip (http://www.raceforkicks.com/downloads/fodix04.zip)

It's a program I made years ago. I should be rewriting the whole of it because it's not optimal (the window is small and while it's GUI-based, you have to call it from the command line with a file name as a parameter), but it works and it's very useful for viewing and editing binary files. It should make it very easy to edit the opponent files.

EDIT: Updated link. 23-02-2021
Title: Re: OPP files (opponents)
Post by: Daniel3D on December 13, 2020, 10:50:50 AM
 8)
Thanks for the tool. Still have my laptop in storage, but I will look into this asap.
Title: Re: OPP files (opponents)
Post by: Daniel3D on December 13, 2020, 04:15:20 PM
I've watched Skid and Bernie go through the loop (because Bernie has the largest value there in path)

But I see nothing... Besides the speed.
The path is the same for both...

Bernie dit some weird driving when I was following, Skid didn't seem to be bothered, but maybe I was closer to Bernie.

When I make a false start Bernie just does his lap.

Not an easy one ...  :-\
Title: Re: OPP files (opponents)
Post by: Cas on December 13, 2020, 09:01:37 PM
Probably, testing "actively" will yield clearer results. I mean, not just observing the current settings, but altering them while leaving everything else the same and looking at what's different