yanpanlau / DDPG-Keras-Torcs

Using Keras and Deep Deterministic Policy Gradient to play TORCS
717 stars 267 forks source link

How to switch torcs from GUI mode to text mode to accelerate the training process #36

Open wswdx opened 6 years ago

wswdx commented 6 years ago

If you assign "False" to the "vision" variable in the "ddpg.py" file, you may want to disable the GUI mode during training process. But it doesn't work if you only change the "vision" variable. Here I find a way to significantly switch torcs to text mode when training: Modify the 33rd line in "gym_torcs.py" like this: os.system('torcs -T -nofuel -nolaptime &') Here we append a new option "-T" for "torcs" command to enable the text mode. It's really easy, but have bothered me for minutes. Hope this can help u guys getting started with the code.

aradove commented 6 years ago

What should you do if you still want to run practice? When I run with -T, it change mode to quick race.

edit: I think I found the answer.

Change /usr/local/games/torcs/config/raceman/practice.xml under the section Practice

change  <attstr name="display mode" val="normal"/>
to  <attstr name="display mode" val="results only"/>

or run $ sudo torcs --> Race| --> Practice or Quick Race --> | Configure race --> Accept And then set display mode to results only.

ratheesh2107 commented 6 years ago

When I run the code after changing the line. It runs for few episodes and again gives an error saying that "Unable to open display 'default"

zhysgithub commented 5 years ago

What should you do if you still want to run practice? When I run with -T, it change mode to quick race.

edit: I think I found the answer.

Change /usr/local/games/torcs/config/raceman/practice.xml under the section Practice

change    <attstr name="display mode" val="normal"/>
to    <attstr name="display mode" val="results only"/>

or run $ sudo torcs --> Race| --> Practice or Quick Race --> | Configure race --> Accept And then set display mode to results only.

I change display mode to result only, but when I run "sudo torcs -T", it still print "Starting Quick Race". why? Is it really run practice?

UPUPGOO commented 4 years ago

I got it. There is no need to append a new option "-T". You should only change the display mode to 'results only' by running $ sudo torcs.

libersun commented 6 months ago

When I run the code after changing the line. It runs for few episodes and again gives an error saying that "Unable to open display 'default"

Because if you wanna run it in cloud server or you Linux don't have GUI, you need a virtual display to run it You can use command:

Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & export DISPLAY=:99

And then input in your tenminal: python ddpg.py

It definetly can run it.