Driver Randomizer anyone? Random Game and Track Reset Tools

Useful programs to help you create stuff for GeneRally.
Post Reply
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Driver Randomizer anyone? Random Game and Track Reset Tools

Post by Motormann »

I'm not sure if anybody has thought of this before, but one thing I've often thought would improve generally is if the driver ai strength had some variance each time you start a race. If the ai setting is the same on all the cars, they tend to run in a tight pack. If you set some with higher and some lower, they tend to sift out the same for most races. This tendency is more obvious with certain cars (I'm seeing it with my R/C set I'm working where I have to create a pretty big AI difference in order for the cars not to bunch up too much).

I think what might work is a utility that lets you set a high and low ai range for each driver, and every time you launch generally with the utility it randomizes between those numbers. It would be better if it was built into the game, but that's not happening any time soon :weep:

Just to be clear I'm not talking about the ai setting in the car itself, but the driver setting that you adjust in-game.

Anyone up to the task?
User avatar
Quklis
Posts: 694
Joined: Fri Jan 08, 2010 10:38 pm
Location: Finland

Re: Driver Randomizer anyone?

Post by Quklis »

This probably would need creating a whole new driver file and possibly change the exe :eyes:

Good idea and would be great to see this happening, though.
User avatar
Paw
Posts: 1193
Joined: Sun Dec 27, 2009 3:03 pm
Location: Poland

Re: Driver Randomizer anyone?

Post by Paw »

I don't think that was made before, but it shouldn't be that hard to creators of other GR-related software. Lets say, that before starting GR you run a program, which randomizes ai-value in given range of selected drivers. It would open, read, change and save the driver file.
User avatar
The lost Ninja
Posts: 442
Joined: Sun Dec 27, 2009 2:18 pm
Location: Geldern

Re: Driver Randomizer anyone?

Post by The lost Ninja »

Nice Idea, maybe Rich Nagel is able to do this (but only in DOS :flip: ), or Majortom.
User avatar
thegreatfalcon
Posts: 1117
Joined: Mon Dec 28, 2009 10:26 am
Contact:

Re: Driver Randomizer anyone?

Post by thegreatfalcon »

The thing is to know when GR reads the driver files. If he read them every time before the race, while loading the track, then it would be easy to do a prog that generate random values for the files every 2minutes so that when GR loads the driver, it is randomized and remains in the memory until the next loading screen...

Otherwise, you would have to restart GR for a prog like that to work...

Unless you use CheatEngine or something in the kind to modify values of variables to put the random values for the colors and other things. Actually, I have to test out if it is possible to modify the PoV with C.E. (in example) while GR is running...

Hope this is somekind helpfull :bg:
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: Driver Randomizer anyone?

Post by Motormann »

Well, I did realize that you would need to re-start GeneRally every race if you want it to re-set the random values. It's a worthwhile trade-off for the added feature in my opinion. What would be nice is a custom GeneRally launcher that could initialize the track and drivers, with the randomized ai settings. Then when it launches the game you could just hit race. I don't know if that's possible though because every time I start GeneRally I have to pick my driver and track.
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

I have tested this with a little program that changes the KI-Value of
a certain driver file every 15 sec. While GeneRally is running and the program
in background, no changes are recognized, because GeneRally loads the
driver files only once at the beginning.

Before starting GR it is no problem to change some KI values randomly.
For a new setting you must leave GR again and again.

Another way could be, to change the values in a Savedgame for starting order
in background. In this case you have different KI values when loading, but always
the same starting order and track.
User avatar
thegreatfalcon
Posts: 1117
Joined: Mon Dec 28, 2009 10:26 am
Contact:

Re: Driver Randomizer anyone?

Post by thegreatfalcon »

majortom wrote:I have tested this with a little program that changes the KI-Value of
a certain driver file every 15 sec. While GeneRally is running and the program
in background, no changes are recognized, because GeneRally loads the
driver files only once at the beginning.
So it does work? I mean, when you change track, the AIs are changing? Color changes are do-able?
User avatar
Quklis
Posts: 694
Joined: Fri Jan 08, 2010 10:38 pm
Location: Finland

Re: Driver Randomizer anyone?

Post by Quklis »

Could car changes too be possible mid-championship :scratch:

Championship starting with formula and then changing to rallycar mid-season for an example.
User avatar
Paw
Posts: 1193
Joined: Sun Dec 27, 2009 3:03 pm
Location: Poland

Re: Driver Randomizer anyone?

Post by Paw »

Hmmm, maybe editing saved game?
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: Driver Randomizer anyone?

Post by Motormann »

Okay, here's my thoughts on what I would like to see, with the info from Major Tom:

Gui GeneRally launcher which allows you to choose your palette, a driver set, and set up an ai range for each computer driver from that driver set. The program would store driver sets within a sub folder, then copy those files into the driver folder when it launches the game, randomizing the ai (KI?) value for those drivers.

In addition, it would store save game sets within sub folders (and copy them in and out of the GeneRally saves folder as necessary), each of which would represent 1 race out of a series, using the driver set you specified. Either these would have to be created by the user and saved manually, or maybe the program could do that as long as you choose the track and car, etc.. Not sure how much can be done to create the save file or modify it externally. If possible, the saves would need to be modified with a randomizing of the start order. It would be nice if the program could track points and allow start order based on that.

Now, here's the interesting part. The program would be active in the background, and would monitor a certain key press. When it detects the key press, it ALT-F4's out of GeneRally, and automatically re-launches the game, allowing you to then load the next race in the series from the save games list, with a new randomized KI for the drivers.

If the program could somehow keep track of points from race finishes (perhaps extract them when you hit the key that resets the game) that would allow you an external way to run championship series, and maybe even save the results, etc...

Sounds good no? I wish I had the knowledge to program this myself, but it's beyond my abilities.
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: Driver Randomizer anyone?

Post by Motormann »

Just a quick update. I did some tests with driver edits and save files. Here's what I observed:

Changing the ai value of a computer driver is not reflected upon loading up the save file, it keeps the original ai value it was saved with

Changing the driver's color values is reflected when loading the save file

Deleting the driver does not remove him from the save file, it reverts to the original colors it was saved under

Changing the driver's car doesn't affect the save file.

Creating a new driver with the same name as the original driver in the save file allows you to change the colors

*****If you delete the human driver file, then create a new one as a computer driver with the same name, you can then edit that driver's ai value, and it will be reflected when you load the game (this is big!)

These observations lead me to some conclusions. First, if the drivers themselves and their ai values are contained within the save file, as they must be, we should be able to edit them. If so, then it would not require restarting the game to randomize the ai value, just loading up the save file after the program has modified them (key press).

If it's not possible to edit the ai values in the save file, for whatever reason, the work around would be to create human drivers for all the drivers in a race. Create the save files for all the tracks in your series with these drivers. Then either manually, or with the program, delete those human drivers (all except yourself), and replace them with computer drivers using the same names. Now the program, when it resets can modify the driver ai values and they'll be reflected with each loading of the save game.
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

Hmm, I think, I would be able to change KI value, colors and reaction time in a save game.
Starting order is more complicated.

One way is, to run a proggi in background to do these changes every 2-3 minutes.
If you load the save game next time you have different settings.

Or I can generate a set of a few copys of a save game (1 click) before starting GR.
These copys can be raced one after another and you will have different values in each race.

Give me one week and I will make a little test proggi ...

I can't neglect my training for NBR :)
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: Driver Randomizer anyone?

Post by Motormann »

Can you clarify what KI is? And Reaction Time? As for starting order, is it complicated because of trying to do it by points? Or is random start order hard too? I thought in your prior post you said that was possible. Maybe one way would be to modify the driver names and colors and re-organizing the ai values accordingly. That way it seems like you're getting a new starting grid, when actually it's just the driver values which are being changed. Mixed races with different cars would be the problem with this idea, unless you can set the car in the save file as well.

Of the two scenarios you describe, I like the first idea better. What about using a keyboard key to update the values? This way you could do it manually when you start a new race (just before loading the save). Maybe you could do both the key press, and the timed reset, that way it would work with or without the key press, but you could press the key just to be sure it's updated, in case you restart the race right away.

How about changing the track itself in the save file? I know, I'm getting carried away, but if you could do that then you would just need one save that you load every time you want to race, and the external program would update the track to the next in the series (you set this in the program), or it could choose a random track from those in a specified folder. Obviously, like changing the driver settings, it would only update this by time, or key press (if that's do-able).
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

KI=AI, you are right. I have forgotten to translate. KI in German is 'Künstliche Intelligenz'
Reaction is, what you can change here in Savegame Reader:

Image

Define a HotKey is possible in normal Windows, but I have not tested it in DirectX.

For changing AI-Values, you must simple change some bytes in the save game.
Changing Starting Order is more complicated. You must change more data and arrange it new.
For changing the track, you must have an algorithm that calculates a 16byte hash string.
The savegame is locked to a track with this hash string. The algorithm might be a secret
of GR-Builder.
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: Driver Randomizer anyone?

Post by Motormann »

I'm still confused about KI/AI and reaction time. Are they the same thing under different name? In GeneRally you have two AI settings you can adjust that affect the performance of the driver, that I'm aware of. The driver's ai slider, and the ai value in the car file. Is the first one the KI/AI and the 2nd one the reaction time? I'm surprised if you could vary the car value within the save file, but if so, that's another interesting tool to use in this program for further randomizing the ai drivers performance.

So it looks like one save that changes tracks automatically is out of the question, that's not really a surprise though. How about changing the cars each driver is using?

Also, where is this savegame reader you talk about? I'd be interested in checking it out.

Sorry for being a pest with all my questions, but I like this idea, and I can make better suggestions if I understand what's possible and what isn't.
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

You can change the AI-level of the car only in careditor. This is part of
the car like horsepower or downforce. Changing it, changes the car.

The AI value in GR Menu describes, how the AI-Driver follows the AI-Line you
can see in TrackEditor. Results a good or bad AI-Driver.

Reaction Time is the time of starting, when the traffic light goes out.

You will find the Savegame Reader in mostly ervery Competitionpack on this site.
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

I tested a Hot-Key in GR-Menu - and it worked.
Here is a little tool, using F5 in GR.

track_reset.zip

Select a track in the tool window and start GR.
By pressing F5 in GR Menu the selected track will be reseted.
This could be useful in a competition, if you must drive
your race on a reseted track. See help file in zip.

And now I will try it with a savegame ...
User avatar
The lost Ninja
Posts: 442
Joined: Sun Dec 27, 2009 2:18 pm
Location: Geldern

Re: Driver Randomizer anyone?

Post by The lost Ninja »

Nice work Majortom, please go on like this! :D
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

Here is little beta tool for changing the AI values in a saved game.
Random_game.zip (see help text for install)

Make a save game with starting order and load it in the tool.
By preesing F5 in GR menu as a Hotkey, you get a random game out of your startgame
named _random_yourgame.gam with different values for the AIs.
So you get a different race after ervery F5 and reload.

Please test it and comment.
If someone find it usefull, I can work on it ...
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: Driver Randomizer anyone?

Post by Motormann »

I checked this out, and it does work very nicely. An enhancement I would suggest is to allow you to set parameters for all the drivers you've created, allowing you to set a random range for each driver individually. This way you can create some drivers who are very consistent, and others who are not. It would need to identify the drivers in the save, and match those to the parameters you've established, I don't know how hard this is to do. Another idea would be for the game to be able to randomize which drivers are in the race out of all available (this would be best as an option you could select, rather than the default behavior). Perhaps you could put a check mark beside all drivers you want to include as randomly available, then if you check just 6 drivers, they would always be in the race, but if you check more, it would randomize the field between those that you check. You could also put a mark by a driver to be certain they are always included (player cars for example)

Great job, this is a terrific utility. I would love to be able to include it as part of my GR/C "mod" when its finished, if you're okay with that, credit given of course.
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

I had the idea with the different settings for each AI too.
That is no problem. I will build a better looking Prog-Window.

To select the drivers from list randomly is difficult. However, it makes little sense.
Principle the drivers differ only in the AI value (apart from name, color and
of course the car). If driver A receives the value of driver B, it is driver B.

Changing the basic AI value and give a different range for each one is possible.

Note: When you race a _random_game with different settings, make a new savegame after
you have finished and load this game in SaveGameReader, you will not see the different
values. You see the original values as they are stored in the drv.file.
The AI Value is stored twice in savegame and SaveGameReader only looks for the first one.
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: Driver Randomizer anyone?

Post by Motormann »

I'll try to clarify. Lets say I create a set of ai drivers to match the F1 roster, each with a base ai value and an individual random value which represents strength and consistency. I then would like to be able to select say 10 of those drivers, and when I run a race, have the field be a random mix of any of those 10, plus myself. Each driver has his name and color which I can identify him by, and his performance will match with expectation, but because of the random ai value will not be completely predictable. The process here is that you actually have only 5 ai drivers that are being used, but the parameters of color, name, base ai value and random ai range for all drivers is stored by the program and randomly given to those 5 generic ai so that the field changes according to the randomization. Unfortunately I don't think it's possible to change what cars are used by the drivers in the save file, but if so that would be even better.

Another thing occurred to me as well. Let's say I want to run a series of 10 races. I'll create 10 save games, one for each of these tracks. Currently, when I hit F5 to randomize the AI, it will only randomize the one save file that I've identified in the program, which only handles a single track. I have to exit the program and choose another save file to be able to randomize the next race in my series. Or alternatively I need to randomize all 10 saves/tracks prior to starting GeneRally. Ideally it would be good if you could select a group of saves, or if the program identified save files which have a particular prefix such as RAI_ (random AI), then when I hit F5, it would randomize the ai in all the selected saves, or all those with the RAI_ in the name.
User avatar
majortom
GeneRally Wizard
Posts: 316
Joined: Mon Dec 28, 2009 8:03 pm

Re: Driver Randomizer anyone?

Post by majortom »

hmm, I will try, takes some time .... :coffee:
Post Reply