-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update combat.py #41
Update combat.py #41
Conversation
Fix some bugs: 1. in get_agent_obs(), the local variable '_type' was mistakenly written as 'type'. 2. self.agent_prev_pos and self.opp_prev_pos are not updated, but in __update_agent_view() and __update_opp_view(), these previous positions are cleared. Thus the movement records are incorrect. 3. The self._agent_cool and self._opp_cool are not updated (i.e., the agents and opponents could execute 'attack' action at every step if within range). updates: (1) update the is_fireable() function to check if the attack agents have been cooled down. (2) add self._agent_cool_step and self._opp_cool_step to track the cooling down of the agents and opponents. 4. In the opps_action() function, the dead opponent could still call reduce_distance_move() function to sample a 'move' action, which will raise an 'no where to move' exception when the position of the dead opponent is the same with any of the agents. 5. Update the get_agent_obs(): only return the local view of observation when the agent is alive, otherwise return a zero vector. Add 2 new functions to support CTDE 6. Add get_state() to support CTDE (centralized training with decentralized execution).
In get_agent_obs(), the x-coordinates and y-coordinates of the entites (whether the entity is 'agent' or 'opponent') within each agent's view range were incorrectly set to the agent's position.
Thanks for these changes. I will probably merge it by the end of the month. Thanks again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good! Thanks for the changes.
I can merge it once you resolve the "_render" comment.
remove the unused "_render"
All looks good. But, Let's write some more exhaustive test cases. You may use this as a reference. |
Fix some bugs:
Add 2 new functions to support CTDE