The following warnings occurred:
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 94 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "lockoutexpiry" - Line: 573 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 573 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $can_access_moderationqueue - Line: 752 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 752 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $awaitingusers - Line: 34 - File: global.php(959) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(959) : eval()'d code 34 errorHandler->error
/global.php 959 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 1024 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 1024 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5308 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5308 errorHandler->error
/global.php 1024 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1474 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1474 errorHandler->error
/inc/functions.php 1429 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(257) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/printthread.php(257) : eval()'d code 2 errorHandler->error
/printthread.php 257 eval
/printthread.php 117 printthread_multipage
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Forums
AI driver - Printable Version

+- Forums (https://www.vdrift.net/Forum)
+-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4)
+--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9)
+--- Thread: AI driver (/showthread.php?tid=438)

Pages: 1 2


AI driver - rookie1 - 11-23-2006

I have implemented a rudimentary AI driver. So far it can successfully navigate through Ruudskogen, Nuerburgring, Jarama and Kyalami using a MC.

Should I post the patch here, let you guys have some test first, or should I commit to SVN? The patch is about 300 lines.


- thelusiv - 11-24-2006

I'd say go ahead and check it in, unless your changes break things. Sounds pretty good though. How did you determine how to tell the car where to go?


- rookie1 - 11-24-2006

Done. Checked in as rev 1356.

I've added an option in "practice game" screen called "Number of AI Opponents". If it's set as 0, it's the same old practice game. If you set it to 1, this will create an AI controlled car (same car as player selected but random color). You can race against the AI.

Quote:How did you determine how to tell the car where to go?

Pretty simple actually, the AI routine just steer the car towards the center of the next bezier patch. That's why it's called a 'rookie' level AI. :lol:


- thelusiv - 11-24-2006

That's a pretty good start. The MC did alright on Jarama, obviously not a good line Smile but it works. I tried the AX2 on Le Mans and this didn't work, I got lots of messages on the console about missing player car, get ready for a crash...and then when I tried to quit it crashed.


- rookie1 - 11-24-2006

Not happend to me so far, although I do encounter NaN error at certain point on Le Mans and other tracks.


- joevenzon - 11-24-2006

Not a bad start! I can do laps on Jarama with the computer and I in G4s and it's pretty enjoyable.


- rookie1 - 11-24-2006

Quote:I got lots of messages on the console about missing player car, get ready for a crash...and then when I tried to quit it crashed.

In DrawHUD(), I have some code that displays the AI car status. This causes the excessive 'missing player car' message when there is no AI car. I've commented out that. Check out rev 1357. However, I don't think that is the cause of the crash.


- reece146 - 11-24-2006

Awesome...

Got a feeling I'll be building SVN on the Mac this weekend.


- rookie1 - 11-25-2006

I've made some improvement to the AI (rev 1363). Most noticeable is the improved steering code. Instead of steer towards center of next patch, now it's steering towards some point further ahead. This has 2 effects,

1. Reduce the car wobbling (noticeable in G4)

2. The car is moving along a better line, instead of staying at the center of track


- thelusiv - 11-26-2006

This is coming along nicely. Here are a few things I've noticed/questions I have:
* the lap timer is tripped every time the player goes around as well as every time the robot goes around. We need to set up some kind of timing tables class to put lap data in for each of the robots (as well as the players...this should eventually also work into the player profile).
* Why do some tracks work and others don't? Lots of the cars seem to work alright. I haven't tried them all yet.
* I get segfaults when doing pause -> restart game, pause -> leave game, pause -> quit.
* Will this system be able to accept other robot modules? Is it compatible with TORCS robots API?
* Both cars have bounding boxes so theoretically it should not be hard to do collision. Joe, any comments there?

Sorry for so many questions, I honestly haven't had time to look over the code yet, I have been busy since you added this, and testing the code is much more fun Wink All in all the AI is a blast to play with. I like your latest improvements to the driving, they are not hard to overcome but still they can get a good bit ahead of you if you screw up.


- rookie1 - 11-26-2006

Quote:* Why do some tracks work and others don't? Lots of the cars seem to work alright. I haven't tried them all yet.
Probably due to the roads.trk and starting position of the tracks. Starting position of some tracks are in the pit lane, and there is no proper traced road leading to the main track. AI can only follow the bezier patch 1 by 1 on the traced road. I propose we should set the starting position at the starting line, not the pit lane.
Quote:* I get segfaults when doing pause -> restart game, pause -> leave game, pause -> quit.
No segfault when i do pause -> quit. No segfault at pause -> leave game either, but I do get 'NaN in origin vector' quite frequently in this case. Haven't found out why yet.

I do have segfault at pause -> restart game. From back trace, it seems after restart, somehow the AI car's drivetrain pointer is invalid (probably been deleted during restart). Couldn't figure out why though.
<edit>segfault fixed in r1372

Quote:* Will this system be able to accept other robot modules? Is it compatible with TORCS robots API?
The AI code is base on Berniw's TORCS robot tutorial. However, it's not using TORCS API. Bascially, there are 4 functions in the AI module,

updateGasBrake()
updateGear()
updateClutch()
updateSteer()

Each function handles 1 particular aspect of the input, and pass the input similar to a player controlled car, via Vamos_Body::Car::gas(), Vamos_Body::Car::brake(), etc.

There is no shared library/DLL support built in. So some more work is needed if we want to be able to add robot modules dynamically.


I'm not familiar with the collision code. But do note that the AI currently does not have the capability to avoid colliding with other cars. It also lacks the ability to return back on track once it's off.


- joevenzon - 11-26-2006

Code:
* the lap timer is tripped every time the player goes around as well as every time the robot goes around. We need to set up some kind of timing tables class to put lap data in for each of the robots (as well as the players...this should eventually also work into the player profile).

The timer class (see timer.h) could be easily extended to do this.


- thelusiv - 11-27-2006

rookie1 Wrote:Probably due to the roads.trk and starting position of the tracks. Starting position of some tracks are in the pit lane, and there is no proper traced road leading to the main track. AI can only follow the bezier patch 1 by 1 on the traced road. I propose we should set the starting position at the starting line, not the pit lane.
This seems like a good idea. Anybody want to work on this?

rookie1 Wrote:No segfault when i do pause -> quit. No segfault at pause -> leave game either, but I do get 'NaN in origin vector' quite frequently in this case. Haven't found out why yet.
OK, on some cars it does segfault, on others it doesn't. I'll do a little more testing and let you know which ones do/don't.

rookie1 Wrote:<edit>segfault fixed in r1372
Good work, thanks Smile

rookie1 Wrote:The AI code is base on Berniw's TORCS robot tutorial. However, it's not using TORCS API. Bascially, there are 4 functions in the AI module,

updateGasBrake()
updateGear()
updateClutch()
updateSteer()

Each function handles 1 particular aspect of the input, and pass the input similar to a player controlled car, via Vamos_Body::Car::gas(), Vamos_Body::Car::brake(), etc.
I see, I have been investigating the TORCS robot system and I'll start a new thread about it soon...

rookie1 Wrote:I'm not familiar with the collision code. But do note that the AI currently does not have the capability to avoid colliding with other cars. It also lacks the ability to return back on track once it's off.
I've noticed that some of the cars can get back on the track (XS for example, but since your last updates it doesn't go off-track anymore on Jarama at least), on others it can't. This is probably the fault of it being very hard to get out of the sand traps in some cars (probably due to clutch force or tire friction problems, for instance the 3S).

joevenzon Wrote:The timer class (see timer.h) could be easily extended to do this.
If we could have a timer object associated with each robot that is triggered when the robot crosses the finish line, that would work well... I'm guessing this should go in vamosworld.cc somewhere.


- thelusiv - 11-27-2006

Playing with the AI is very hard because the robot gets a head start every time. This reiterates the need for multiple starting positions support in our tracks.


- rookie1 - 11-27-2006

Well, I guess this is more because AI gives input to the car immediately when the simulation starts, while human player has to wait for the screen to show. If we can introduce a proper start sequence, like the traffic light thing at the start of the race (sorry, don't know what it's called in racing terms), we should even out.

Of course, we should still have proper start positions. Currently both the player car and AI car starts at the exact same position. I'm interested to know what will happen if we introduce collision between cars :lol: