NFSAddons Forums

Main Menu

NFSHS AI basics/tutorial

Started by PomFrit, Jun 02, 2023, 1:35 PM

PomFrit

I did'nt find a track with AI made right, so here is how High Stakes AI should be done. I hope this helps make better AI.

For understanding look on the picture.



Speed - is maximum AI speed in m/s for Champion + MADLAND difficulty. Each difficulty, AI ( Ace, Gotcha, Scream - fastest, Sleepy and Bully - slowest ), weather and surface automaticaly lowers the limit. Weather + snow surface reduce speed limit a lot. For acceleration a i recommend use 111 ( it's 400km/h and easy to find ), for braking use doubled numbers reduced by 2 ( 60,60,58,58,56,56,54,54, ... ), it works best. AI can't slow faster, it's very rare when stronger braking works better.

AI lines
- 112, 128, 144, 160, 176, 192 for the right side 
- 96, 80, 64, 48, 32, 16 for the left side
- lines 16, 32, 176 and 192 may have problematic use

AI lines can be edited through "unknown data", most used are this:

Right side ( column 0 and 8 ):

80 - 1 line ( 112 )
C0 - 2 lines ( 112,128 )
E0 - 3 lines ( 112,128,144 )
60 - 3 lines with obstacle in line 112 ( 128,144 )
F0 - 4 lines ( 112,128,144,160 )
70 - 4 lines with obstacle in line 112 ( 128,144,160 )
F8 - 5 lines ( 112,128,144,160,176 )

Left side ( column 1 and 9 ):

01 - 1 line ( 96 )
03 - 2 lines ( 96,80 )
07 - 3 lines ( 96,80,64 )
06 - 3 lines with obstacle in line 96 ( 80,64 )
0F - 4 lines ( 96,80,64,48 )
0E - 4 lines with obstacle in line 96 ( 80,64,48 )
1F - 5 lines ( 96,80,64,48,32 )

I add more numbers, when i will be sure.

Float numbers - practicly Vroad Node offset. It's distance ( in meters ) from Vroad Node to point, where you want AI to go, negative numbers left side and positive numbers right side.

AI lines have limited width ( 96 and less - negative numbers, 112 and more - positive )

If line width is 4, float and AI lines are bounded like this:
- 96/112 is for 0,1 to 4
- 80/128 is for 4,1 to 7,9
- 64/144 is for 8-12
- 48/160 is for 12,1-15,9
- 32/176 is for 16-20
- 16/180 is for 20,1-23,9

If its 5
- 96/112 is for 0,1 to 5
- 80/128 is for 5,1 to 9,9
...

Thanks to JimDs T3ED update, its possible to change AI line width, but i recommend set AI line width to road width. Traffics drive on middle of AI lines.

AI lines and Float numbers are bouned, but AI lines are priority for AI if float numbers are outside defined AI line or too far! If u set Float number outside of AI line width, opponents will drive on the defined AI line, but ignore float numbers. Also you just can't set float to 0 and switch only AI lines, that didn't work. AI always try to ride the floats even if the AI lines are wrong.

VRoad Edge - dark purple lines, its limit for AI ( opponenst, trafics and cops ), AI driving between them and refuse go outside. You can have 6 AI lines defined, but if VRoad Edge is for example between 3rd and 4th line, AI wont use 4th 5th and 6th line.

Cops - they drive automaticaly and cant be controled. Cops are controlled by Vroad nodes line, existed AI lines and VRoad edge.

IMPORTANT

AI can't drift or slide like player, they need use brakes before turning. For this reason, opponents will never be fast as player, but if you are not like EAOAgent, they can be competitive.

Before testing, you need put all float numbers 2 Vroad nodes sooner than u want ( make backup ), because AI reacts too late. If you did'nt do this, AI may turn too late or crash. It works on 90% cases.

TRACK TEST
First lap around first 8 blocks AI ignore float numbers and drive only on defined AI lines !
I recomend test track with F1 and CLK-GTR ( what works for F1 may not work wor CLK-GTR ), Champion difficulty and Madland cheat for proper speed limit. Also you need test the track with SLK 230, PRO diffiulty, weather set ON and slow AI ( not ACE, SCREAM or GOTCHA ). Pro diffiulty with weather and slow AI may crash where Champion won't. This will show 90% problems.

Sorry for the grammar, I've never studied English. This is my games/movies/translator English:)

PomFrit

#1
ADVANCED TIPS AND TRICKS

LONG TURNS AND U TURNS
If you want AI to drive on the yellow line, you cant put same float number and AI line all the time. It works only on low speed, AI keeps drifting away from the intended route. Best way how to do it, is drive on the AI line edge and switch between inner and outer line. Most of the time i use 2 nodes inner line, 4 nodes outer line and constant speed ( not full throttle ). Sometimes u need more inner or outer, it depends on the turn and speed. Line switch is for AI like signal to turn, 2 nodes inner line - turn little or 4 nodes inner line - turn harder.



pete9516

Quote from: PomFrit on Jun 02, 2023,  1:35 PM
If u set float number outside of AI line width, opponents will drive on the defined AI line, but ignoring float numbers.
Now i may understand why my AI drives into the middle road pollars all the time. Very interesting topic

JimDiabolo

Good explained, but shouldn't this be better in the NFS:HS Workshop?
Get T3ED, Stock & Expansion Pack from Magenta Cloud.

pete9516

Quote from: PomFrit on Jun 02, 2023,  1:36 PM
ADVANCED TIPS AND TRICKS

CREATING NEW MAPS
If you making whole new map, i recomend use block 177 from Lost Canyons. Its propably the widest track section and it has 6 AI lines on right side and 5 on left side, witch should be enough for almost everything you want to create.
So you're saying that one can't create new AI lines with T3ED, but instead one should use a track block which has a large number of AI lines already?

PomFrit

#5
Quote from: JimDiabolo on Jun 06, 2023, 12:01 AM
Good explained, but shouldn't this be better in the NFS:HS Workshop?

Maybe, but i'm not Team RSR member.

Quote
So you're saying that one can't create new AI lines with T3ED, but instead one should use a track block which has a large number of AI lines already?

Yes, if you need more lines, you can't add, but you can replace block with block, witch has more AI lines.

I tested this on Celtic Ruins, where i try navigate AI between trees on S curve before finish, but there are no AI lines, only 3 in original track. So i replace whole section with block from Landstrase ( where i know lines exist ), remodel back vertex by vertex and now i have 6 lines on that section.

Missing lines may be problem for AI ( its like hole where AI don't want to drive ), but more lines can be simple limited by Vroad Edge, AI refuse go behind it.

pete9516

Quote from: PomFrit on Jun 08, 2023,  1:00 AM
Quote from: JimDiabolo on Jun 06, 2023, 12:01 AM
Good explained, but shouldn't this be better in the NFS:HS Workshop?

Maybe, but i'm not Team RSR member.

Quote
So you're saying that one can't create new AI lines with T3ED, but instead one should use a track block which has a large number of AI lines already?

Yes, if you need more lines, you can't add, but you can replace block with block, witch has more AI lines.

I tested this on Celtic Ruins, where i try navigate AI between trees on S curve before finish, but there are no AI lines, only 3 in original track. So i replace whole section with block from Landstrase ( where i know lines exist ), remodel back vertex by vertex and now i have 6 lines on that section.

Missing lines may be problem for AI ( its like hole where AI don't want to drive ), but more lines can be simple limited by Vroad Edge, AI refuse go behind it.
Ok so i think we can summarize that there is A LOT more hidden track data than expected? :D

pete9516

Quote from: PomFrit on Jun 08, 2023,  1:00 AM
Quote from: JimDiabolo on Jun 06, 2023, 12:01 AM
Good explained, but shouldn't this be better in the NFS:HS Workshop?

Maybe, but i'm not Team RSR member.

Quote
So you're saying that one can't create new AI lines with T3ED, but instead one should use a track block which has a large number of AI lines already?

Yes, if you need more lines, you can't add, but you can replace block with block, witch has more AI lines.

I tested this on Celtic Ruins, where i try navigate AI between trees on S curve before finish, but there are no AI lines, only 3 in original track. So i replace whole section with block from Landstrase ( where i know lines exist ), remodel back vertex by vertex and now i have 6 lines on that section.

Missing lines may be problem for AI ( its like hole where AI don't want to drive ), but more lines can be simple limited by Vroad Edge, AI refuse go behind it.
Are you really modeling each block polygon by polygon? How is this supposed to even work?
And what is the maximum width for a polygon lane? Can it be something like 25? Because there are tracks like Lake Diabolo or Monolithic Studios which need either a lot more AI lane polygons or they have to be wider because if there are only 2 on each side, those 2 have to be really wide for AI not to drive into objects placed right in the middle of the road like Redrock Ridge or Durham Road. Do you have any new findings about this?

pete9516

And i think you're wrong about the 112 AI lane selection, you show in your picture that it is the first right line, but the AI drives on the middle of the road! They drive on the virtual road points, not on the first right lane. I only wanted to be sure about that, it would be nice if you could test this on your side

PomFrit

QuoteAre you really modeling each block polygon by polygon? How is this supposed to even work?

I copy original block as new object ( call it fake object ), change belongings to block near by ( same for all object belonging to block what will be replaced or objects will be deleted ), replace intended block with new one and then merge proper vertex by vertex with fake object. After that i delete fake object. Its hard to explain, but its prety fast, problem is shadows and road lines, that is vertex hell :). I didn't do whole track, just 1 or 2 blocks.

QuoteAI not to drive into objects placed right in the middle of the road like Redrock Ridge or Durham Road.

Im not sure with this, but navigate AI between columns on original track is often impossble. Sometimes polgons on the middle have set Virtual Road Boundary, but it won't help if i uncheck this. Propably unknown polygon data.

QuoteAnd what is the maximum width for a polygon lane? Can it be something like 25?

Maximum what i tested is 15 i think, but you can't set where AI should drive if doesn't follow float numbers ( mostly on middle AI line ), its propably part of unkown data. Width 4 or 5 is best for making fast AI.

QuoteAnd i think you're wrong about the 112 AI lane selection, you show in your picture that it is the first right line, but the AI drives on the middle of the road! They drive on the virtual road points, not on the first right lane.

You have partialy right, line 112 is first on the right, but AI may act weird, if doesn't follow float numbers. I think, EA can set where AI should drive without float numbers, propably unknown polygon data too.

If you have specific problem, maybe i can help. I give up writing advanced tips, there isn't universal way how to make AI and i don't have time to write a book.

pete9516

Quote from: PomFrit on Sep 05, 2023, 11:59 AM
If you have specific problem, maybe i can help. I give up writing advanced tips, there isn't universal way how to make AI and i don't have time to write a book.
I totally agree with you. Well i just want to get the AI to drive past objects in the middle road and not drive right into them.. But i'm done with my latin. I fixed Monolithic Studio's virtual road completely and there's this one pole in the middle of the road after the star wars deathstar straight line, but i can't get traffic nor opponents to drive around it. They drive right into the pillar. And i can't even get it to work like EA did in tracks like Durham Road or Redrock Ridge, they just don't drive past the road objects.

PomFrit

I had the same problem when i was doing the Scorpio7 AI, AI just won't see the new obstacles on the tracks if they weren't in the original track. Maybe you can try rebuilding the blocks around the pillar with a block from Durham Road (or another track) with a divided section. That unknown data will be maybe transmitted.