News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

On corner signs

Started by Cas, March 12, 2019, 07:38:00 AM

Previous topic - Next topic

Cas

So... several times, while racing, I noticed how signs appear before some corners, but not always and I was puzzled, because there didn't seem to be a rule. I had already promised myself I'd do some research on the topic. Not that it's very useful, but you know, I don't like just going through life not understanding why things are the way they are, so here's what I found out:

1 - Stunts places corner signs only before open corners, but not before banked corners. All three materials work (this I actually didn't verify, but seems obvious) and even open splits. The sign is placed shortly after the beginning of the previous tile (at about 1/20th of the way).
2 - The previous tile doesn't have to be an empty path. It could also be a crossway, a slalom or even a ramp. The end of a boulevard also works. Some tiles can't have the sign, but not because of incompatibility with it, but before of rule number 3.
3 - The sign is only placed if there is a straightway four or more tiles long. Some tiles are not considered straightways, so they break the count and you have to start counting again from one after them. These include the tunnel, all corners (of course), the open split (though notably not the closed split) and all objects that are larger than one tile with the notable exception of up/down corkscrews.
4 - The start/finish line does count as straightway, but if it is located in the middle of a longer straigthway, only the tiles starting from the start/finish line itself will count.
5 - In the event that the sign is to be placed at a ramp tile, it is rised to the height of the ramp at that point and it is brought immediately by the road instead of separated and on the grass as it happens with other tiles. This ensures it's visible. In all cases, it's placed on the right side of the road.


Some things I have not tested yet:

1 - I have not verified that all materials do the same, although I'm quite certain they do
2 - Whether disconnected tracks also exhibit these signs, I don't know, but my guess is they don't because Stunts has to tell in which direction a road is to be driven in order to place the signs. This wouldn't be possible on disconnected tracks
3 - Not yet checked what happens if the sign is to be rendered on water. I guess they do get placed
4 - On this test, I didn't try the case in which the sign appears on a slope, but I remember having seen such signs many times while playing Stunts

If anyone is curious about this or has something to say, it'd be interesting to discuss it! :)
Earth is my country. Science is my religion.

dreadnaut

This is a brilliant, yet somehow hilarious analysis. I've looked at those signs a few times, puzzled when they looked perched on top of a ramp, but too see the rules so simply exposed is brilliant!

Should we have a "Road signs" page on the wiki? :D

Cas

#2
I figure I could make a few more tests and create such page. Actually, there should be some hub in the wiki or here in the forum that leads to topics on research, the internal workings of Stunts, etc. Many aspects of it are a lot more useful than this one and several have already been exposed, only separately.

Actually, there is a reason why I made this research that gives it a tiny bit of usefulness. I wanted to make something that could render tracks in 3D. On one side, it could be a 45-degree isometric view. With more work, it could also be a completely 3D rendition from any random point. I'm still far from this. I tried in the past and would have to rewrite that code, but whatever I do, I would like to include the signs.

Other research already made that could be grouped with this could be that of how penalty time is calculated, the internal file formats (tracks, replays, cars, etc.), how different parameters affect the way cars behave, etc. Research that has not been made yet (I think) and could be done too, for example, is how Stunts decides the best path for the opponent. Bliss does a part of this, but when more than one path have the same tile-length, it's unable to tell which Stunts will pick for the opponent.

UPDATE:
1 - Verified: all three materials work the same. However, banked and elevated corners are not advertised
2 - Verified: disconnected paths do NOT exhibit signs
3 - Verified: signs do show up on water, just like on grass
4 - Verified: if the sign is to be populated on a slope, it does, both going up or down, even though going down, it doesn't help much
Earth is my country. Science is my religion.

Duplode

Quote from: Cas on March 13, 2019, 12:28:09 AM
I figure I could make a few more tests and create such page. Actually, there should be some hub in the wiki or here in the forum that leads to topics on research, the internal workings of Stunts, etc. Many aspects of it are a lot more useful than this one and several have already been exposed, only separately.

Thanks for adding it to the Wiki, and also for the other edits -- that article about the replay file format had been a glaring omission! About the hub/category, though the Modding caegory had been created with that in mind, "Internals" is probably a better name for this sort of thing.

(By the way, I'm thinking about moving this topic to the "Stunts Code Extraction" subforum, so that it is easier to find.)

dreadnaut

Quote from: Duplode on March 20, 2019, 05:30:50 AM
(By the way, I'm thinking about moving this topic to the "Stunts Code Extraction" subforum, so that it is easier to find.)

Maybe it could be renamed to "Stunts Reverse Engineering" to cover all these interesting efforts :)

Cas

#5
I forgot to post here that I had created the article in the wiki.

And yes, when I created "Internals", it took me some time to think of a name for it. I knew what I wanted it to mean, but couldn't find a simple name. Then, I made up my mind for "internals", although I wasn't supper happy about that name. Later, I saw there was "modding", but it's kind of not the same, so I wasn't sure whether to move everything there or not.

I think "reverse-engineering" is more appropiate, yes. What should I do then?  Or if you want, feel free to do the moving and renaming :)

Oh, and yes, moving this to the other forum... that's a good idea too!
Earth is my country. Science is my religion.

Duplode

#6
Corner sign positions for Default:



These positions were extracted with a debugger from memory, more specifically from trackdata10 (see this Wiki article for an overview of what Trackdata is).

By the way, remember the wrong theory about opponent paths and checkpoints I mentioned a while ago? Back in 2016, I looked at trackdata10 and estimated the position of a few points straight off the debugger. My mistake was not doing it carefully enough to notice the points were next to the track rather than on it, which allowed the checkpoint flight of fancy to take hold. Note that, misleading theory aside, there is pseudo-RNG use by game code that reads trackdata10. My current hypothesis is that the randomness has to do with the sign-breaking visual effects. (If you reload a replay in which a sign is broken, the fragments of the sign will fly in different directions.)   

(See also: the companion post about trackdata09.)

Cas

Uhm... if there is some PRNG calculation there, in a way, that suggests something affecting the placement because, in my opinion, the random calculation of debris position should happen in some "crash" or "explode" routine somewhere else, as it's the same used for cars. But I don't know. Hopefully, I'm wrong, because sign placement appears to be very predictable, yet being so similar in track data to camera placement, I can't help but feeling they have to have similarities.

Default is a good canonical example, but it's an "easy" track for sign placement, because there are no objects preventing signs to form. It would be interesting to test whether signs at positions where they couldn't be drawn are still represented in trackdata or not. I'd like to get Restunts tools and learn to use them to further analyse these things.
Earth is my country. Science is my religion.

Duplode

Quote from: Cas on February 23, 2021, 07:03:54 PM
Uhm... if there is some PRNG calculation there, in a way, that suggests something affecting the placement because, in my opinion, the random calculation of debris position should happen in some "crash" or "explode" routine somewhere else, as it's the same used for cars. But I don't know.

I think we don't need to worry about that. The PRNG is used after the sign position has been read and used for collision detection. As for the separate routines issue, it might be the case that the routines communicate by some field of the game state, so that the collision detection has side effects over the explosion rendering.

Cas

Yes, we can only speculate on these things. With the engine, I can't help finding how many things are done differently in Stunts from what I would do and those differences will inevitably show. If this is already happening with rendering, it's no surprise I'll have to do things differently for things like this as well!
Earth is my country. Science is my religion.