Page 1 of 1

RVBot: A driving AI for Re-Volt

Posted: Fri Jun 29, 2018 8:02 pm
by Wichilie
I've recently started work on a program that would drive cars like humans would: not by going along AI nodes, but by actually looking at the track and figuring out where to go. The idea is that it gathers data from a screenshot and some scraped values, analyses it and predicts the best move.

Globally, it will have the following components:


Information scraper
While running, the program needs information to base its decisions on. This information will be supplied in the form of a screenshot of the window and some scraped values that can not be (easily) determined from said screenshot. These include whether the wheels are currently on ice, among other things.

This information is gathered from RVGL's memory by an injected .dll, which is then piped back to the main program. (You can get this information externally too, but the .dll is required later and I feel it is cleaner to have all the interaction with RVGL in one place.)

RVGL setup
Bots don't like menu's, so I'd like to avoid them where I can. This will be done by writing the necessary information (car to pick, level to load, amount of laps, etc) to RVGL's memory and calling the function that loads the level from the .dll. This way it never has to interact with the UI.

Custom shaders
While texture's and lighting make a track more interesting for humans, it (usually) does not contain any relavent information for driving the track. All this extra information might actually confuse the bot. Now that Re-Volt supports custom shaders this problem is easily solved: all this extra information can be omitted. Since we have 3 color channels to work with, the information will be saved as follows:
  • Walls: the geometry of the track.
  • Objects: the pickups, instances, cars, etc that fill the track.
  • Effects: the particle effects created by some objects and items.
The strength of the color wil indicate the distance: 255 means right in front of you, while 0 means 1000 units or farther away (or emptyness of course).

Unfortunately, there are some problems with this approach. For instance, some things like oil slicks and the zap effect on cars will not display. Transparancy and mirrors might also cause confusion. I don't have a solution for this yet, but its impact is somewhat limited.

The information returned by the scraper needs to be processed by a learning algorithm to determine the best course of action. Currently I'm planning to use Deep Reinforcement learning like Google's Deepmind. I'm not going to implement this myself: there are plenty of good existing libraries that I can combine to create what I need. Doing it all by myself would admittedly be either too complicated for me, or take me tons of time.

I'm still uncertain as to some of the details to Deep Reinforcement learning, so I might decide to go with another algorithm if I find it to be unsuitable once I fully understand it.

Finally, I of course need to inject the .dll before I can use it. This is done by a setup program, which passes the pipe handle to the intelligence after it is done.


As for my progress so far, currently the .dll is injected succesfully and communication is established:
It just sends a short message to test the connection.

As you may have seen, the shaders are also finished. Here's a lap with them:

I've also been able to read and change some values like total car count. I have yet to find all the addresses though.

That's all so far, so I'm far from finished. I'll post updates to my progress here every so often. I hope you like the project! ^^

Re: RVBot: A driving AI for Re-Volt

Posted: Sat Jun 30, 2018 7:59 am
by Pyves
Interesting project! Looking forward to see how your bot comes along. ;)

Re: RVBot: A driving AI for Re-Volt

Posted: Sat Jun 30, 2018 1:37 pm
by 607
I don't have high expectations of this getting far. Keep going if you can though, it will certainly be educational. ;)

Re: RVBot: A driving AI for Re-Volt

Posted: Sat Jun 30, 2018 1:46 pm
by Wichilie
607 wrote:
Sat Jun 30, 2018 1:37 pm
I don't have high expectations of this getting far. Keep going if you can though, it will certainly be educational. ;)
Yeah, it'll definitely be though and take a long time '^^. Hopefully I can pull through and make something cool!