Skip to content
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

What is the difference between flag_destroyed and wreck? #78

Open
cjmdd opened this issue Nov 11, 2023 · 6 comments
Open

What is the difference between flag_destroyed and wreck? #78

cjmdd opened this issue Nov 11, 2023 · 6 comments

Comments

@cjmdd
Copy link

cjmdd commented Nov 11, 2023

What is the difference between flag_destroyed and wreck?

@ErkMkd
Copy link
Contributor

ErkMkd commented Nov 11, 2023

Wreck is when model is crashing, exploding.... Destroying animations and physics are in progress.
When destroying animations are finished, when the model is immobilized on the ground, it's declared as "destroyed".
If needed you can display a destroyed mesh when flag_destroyed is true.

@cjmdd
Copy link
Author

cjmdd commented Nov 11, 2023

Wreck is when model is crashing, exploding.... Destroying animations and physics are in progress. When destroying animations are finished, when the model is immobilized on the ground, it's declared as "destroyed". If needed you can display a destroyed mesh when flag_destroyed is true.

Thanks, When setting rewards, which symbols in def get_plane_state() should be used for the punishment of aircraft being hit by missiles and aircraft being completely destroyed?
For example:
"health_level": machine.health_level,
"destroyed": machine.flag_destroyed,
"wreck": machine.wreck,
"crashed": machine.flag_crashed,

@ErkMkd
Copy link
Contributor

ErkMkd commented Nov 12, 2023

There is no direct information to determines if aircraft has been hit by missile or machinegun. If I correctly understood your need, I think you can set a reward using health_level derivative... Not 100% safe but without add a feature to the simulator, that's what i would do.

@ErkMkd
Copy link
Contributor

ErkMkd commented Nov 12, 2023

Now, You can easily add a list of all objects that hit the aircraft, passing them by Machine.hit function. Just add the source of the hit, and store it in a List of the Machine. Then, in get_state function, add the list of all objects that hit the plane.

@cjmdd
Copy link
Author

cjmdd commented Nov 13, 2023

Now, You can easily add a list of all objects that hit the aircraft, passing them by Machine.hit function. Just add the source of the hit, and store it in a List of the Machine. Then, in get_state function, add the list of all objects that hit the plane.

Thank you for your patience in answering. Can you explain it in more detail? I couldn't find the hit function in the network_server,py. Also, The reward received seems to be a delayed reward since missiles require time to fly for a while. Would the delayed reward mislead the policies of airplanes? If so, how can it be alleviated?

@cjmdd
Copy link
Author

cjmdd commented Nov 13, 2023

Now, You can easily add a list of all objects that hit the aircraft, passing them by Machine.hit function. Just add the source of the hit, and store it in a List of the Machine. Then, in get_state function, add the list of all objects that hit the plane.
I modified the program along another line of thought:
Main: def update_kinetics: def update_kinetics: dm.update_kinetics for dm in Destoryabke_machine
Aircraft Class: def update_kinetics: def update_devices--->
DestroyableDevice Class: def update_devices: device.update for device in self.devices---->
MachineGun Class: def update:
for target in targets:
cnds = target.get_collision_nodes()
for nd in cnds:
if nd == hit.node:
target.hit(0.1, hit.P)
%%%%we set this flag_hit of gun from aircraft to True%%%%%
self.flag_hit=True

                     network_server:get_plane_state: state = {'flag_hit_gun': main.get_device("MachineGun").flag_hit}

Here, We query whether the flag_hit_gun of each plane is True to determine if this plane shoot the enemy.
Missile Class in MissileDevice of Aircraft Class: def update_kinetics: self.update_collisions:
if self.target is not None:

                            if collision_object is not None and hasattr(collision_object, "nationality") and collision_object.nationality != self.nationality:
                            self.start_explosion()
                            collision_object.hit(self.get_hit_damages(), hit.P)
                  method1:%%%%we set this flag_hit of missile fired by aircraft to True%%%                  
                            self.flag_hit=True                      
    network_server:get_missile_state: state = {'flag_hit_missile': machine.flag_hit}

At last, We query whether the flag_hit_missile of the missiles launched by each plane is True to determine if this plane hit the enemy. Then, the plane is rewarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants