harfang3d / dogfight-sandbox-hg2

Air to air combat sandbox, created in Python 3 using the HARFANG 3D 2 framework.
GNU General Public License v3.0
156 stars 49 forks source link

Training without network mode #94

Open fangyichen123 opened 3 months ago

fangyichen123 commented 3 months ago

Excuse me, Is there any method that does not require network mode training? Because I think the network communication time may affect the execution speed of each step in RL and thus affect the training time.

I'm training MARL now and each step takes about 100-200ms (I have already set this: df.set_renderless_mode(True)), is this speed normal? I think the training speed is too slow

muraatozbek commented 3 months ago

Hello, Do you perform your training on a GPU or a CPU?

because on gpu, it should be fast.

muraatozbek commented 3 months ago

also you can try parallel training, this simulation is suitable for that purpose.

fangyichen123 commented 3 months ago

Thank you very much for your reply! I have already used 4090 to run 16 environments in parallel. In fact, I am more concerned about the communication speed between the client and the server, which I think is the main time-consuming part. For example, operations such as "df.get_plane_state()" or "df.set_Plane_yaw()" take a long time to use network mode. Also I found that in Ubuntu: Getting the environment state (such as "df.get_plane_state()") and setting the action (such as "df.set_Plane_yaw()") seem to affect each other's communication speed.

muraatozbek commented 3 months ago

Hello, if you want, you can prevent a lot of information from being sent during communication by managing the state. This might help to improve speed. However, such delays should not occur in communication.

Can you try with and without this function.

fangyichen123 commented 3 months ago

I haven't tried changing this function, I've always set it like this: df.set_client_update_mode(True) Do you mean I need to set it to False?

fangyichen123 commented 3 months ago

Now I have tried this function,I set this: df.set_client_update_mode(False) I realized one thing, is this the asynchronous mode mentioned in this paper?

muraatozbek commented 3 months ago

yes that is exactly async mode. when you send states, on the background it continue to run simulation. but if you activate it, it waits action information to take step. Probably your neural network is heavy, when you send state, it takes time to process that. i have tried with TD3 and SAC in comparison of speed, TD3 was better. SAC was really too slow. you can try it. As a conclusion, speed of simulation is really good, check your neural network side.

fangyichen123 commented 3 months ago

Thank you very much for your advice. I will check my project again. I am studying at the University of Science and Technology of China(USTC). We think Harfang is a very good environment. I hope there will be more opportunities for communication in the future. Finally, please let me make a confirmation. Is the simulation speed you mentioned also included in Ubuntu?

muraatozbek commented 3 months ago

You welcome. Yes we made our all tests in ubuntu.