JulesVerny / DuffBallML

The use of Unity ML Agents to learn to play a simple form of Football
4 stars 1 forks source link

A problem about adding agents #1

Open hanwenxu1 opened 1 year ago

hanwenxu1 commented 1 year ago

Hello! I'm a university student and my major is AI. I think your project is very cool, I'm working on a project which is similar to yours. But I met some problems. When I try to add more players into my project such as 5 vs 5, the players' models always flash everywhere. Although I had set Oppo Players to 4, TeamPlayers to 3 and modified the code with "OppoPlayer", it still flash. I don't really know how to solve it. Could you please tell me what's wrong with my project so that I can solve it. I would sincerely appreciate it if you can help me. Thank you so much! ^_^

JulesVerny commented 1 year ago

Hello, Thanks for taking an Interest. it has been a while since I was last messing around with Unity ML Agents, so I am not so familiar with my own code and ideas. So I can only make suggestions. This was my first experiment on very basic team play and collaborative behaviours. So I only really envisioned two active players per side. Is it rendering flickering, or is it stuttered during Training or Inference Game play ? a) It may be a performance issue. To train this with more ML-Agents, will obviously require a lot more processing power, and Unity-ML Agents having to batch up more data, to process. So I could imaging Training being a much bigger challenge and so the Training period being very stuttered. Unless you have really powerful computer and RAM. Which may impact the observed performance. I would perhaps advise on just adding a single player (3 active Players per side + NPC:Goallies) to check if the performance was partially impaired. Unity does have a Performance analyser, but Its too complex, awkward for me to use. b) I really only had in my mind Two vs Two, for this basic experiment. When you have more than one Team mate, there would need to be new code for possible Passing The Ball operation. For a single Team Player, its obvious and explicit , who to pass to. So I guess you would need to be careful, and add a whole lot of explicit logic on which one of several, to pass the ball to. This Pass to logic within the PlayerControl and MLPlayer. I guess you have coded to Pass either to Random, of the Most forward Player.

Sorry I cannot be more helpful, with being able to help with actually being able to see he specific behaviour. BTW I have not played with Unity ML Agents for a while, but have noted RL Hugh videos, https://www.youtube.com/@rlhugh/videos who seems quite active.

JulesVerny commented 1 year ago

Hello, Thanks for taking an Interest.

it has been a while since I was last messing around with Unity ML Agents, so I am not so familiar with my own code and ideas. So I can only make suggestions. This was my first experiment on very basic team play and collaborative behaviours. So I only really envisioned two active players per side. Is it rendering flickering, or is it stuttered during Training or Inference Game play ?

a) It may be a performance issue. To train this with more ML-Agents, will obviously require a lot more processing power, and Unity-ML Agents having to batch up more data, to process. So I could imaging Training being a much bigger challenge and so the Training period being very stuttered. Unless you have really powerful computer and RAM. Which may impact the observed performance. I would perhaps advise on just adding a single player (3 active Players per side + NPC:Goallies) to check if the performance was partially impaired. Unity does have a Performance analyser, but Its too complex, awkward for me to use.

b) I really only had in my mind Two vs Two, for this basic experiment. When you have more than one Team mate, there would need to be new code for possible Passing The Ball operation. For a single Team Player, its obvious and explicit , who to pass to. So I guess you would need to be careful, and add a whole lot of explicit logic on which one of several, to pass the ball to. This Pass to logic within the PlayerControl and MLPlayer. I guess you have coded to Pass either to Random, of the Most forward Player.

Sorry I cannot be more helpful, with being able to help with actually being able to see he specific behaviour.

BTW I have not played with Unity ML Agents for a while, but have noted RL Hugh videos, @.***/videos who seems quite active

Cheers

Jules

From: @.> Sent: 19 March 2023 05:11 To: @.> Cc: @.***> Subject: [JulesVerny/DuffBallML] A problem about adding agents (Issue #1)

I think your project is cool and fun. But when I try to add more Agents into this project like 5vs5, the Players'model always flash everywhere. Although I have set Oppo Players to 4, TeamPlayers to 3 and modified the code with "OppoPlayers" and "TeamPlayer", it still flash. Please teach me how to slove it.

— Reply to this email directly, view it on GitHubhttps://github.com/JulesVerny/DuffBallML/issues/1, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAULPD62KVCF5GROI6RMXYDW42IPDANCNFSM6AAAAAAV74PAWI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

hanwenxu1 commented 1 year ago

Thank you for your quick reply!Actually it didn't stutter while training, so I guess that there are some wrongs when I add the Player models. As for the code, I modified the logic of passing a ball to the teammate closest to OppoGoal, other codes have been similarly processed. All in all, I'll try my best to solve this bug and I really appreciate your guidance.