As part of my M.Sc, I am working on a robot which simulates in every step the following step (look ahead) and depending on the result of the step chooses the action with the best action (using some grading function). The problem is that it looks like the simulation might take some time. But I don't think it explains the following behavior:
When I am running the battle in slow speed, the robot is able to identify SittingDuck (meaning ScannedRobotEvent is triggered). When I run it in higher speed (even 15), the event is not triggered, even if the radar passed the SittingDuck.
It is important to note that I am printing the getScannedRobotEvents() in some parts of the execution and it appears empty.
This happens even if I have a simple robot which only rotates its radar to find the enemy and simulates only one possible action.
Did anyone face this issue before? Is there a workaround? A configuration I can set that will let the robot run the simulation?
I am not aiming to create a robot that will qualify to participate in roborumble and competitions, so I don't mind change configuration (even in robocode's source) for it to work.
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am not sure if it will help shed more light or will only confuse, but I did the following test:
I changed robocode.cpu.constant to a large number (~30 seconds). In this configuration I see two weird things - (1) my robot doesn't get the ScannedRobotEvent even in low battle speed. (2) it still skips turns, even though the caculations it does don't take 30 seconds.
I can provide you my packed robot and sources, if it'll help.
Is there any way I can help in the reproduction\investigation?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have tried to reproduce your issue on my own by using this robot:
packagetest;importrobocode.*;publicclassScanTestBotextendsAdvancedRobot{publicvoidrun(){setAdjustRadarForGunTurn(true);setAdjustRadarForRobotTurn(true);setTurnRadarLeft(Double.MAX_VALUE);while(true){ahead(100);turnGunRight(360);back(100);turnGunRight(360);}}publicvoidonScannedRobot(ScannedRobotEvente){out.println("Scanned \""+e.getName()+"\" at turn "+e.getTime());}}
I get all ScannedRobotEvent with the onScannedRobot(..) method in every speed, from 1 to 1000 and even max speed does not make a difference.
If you are not detecting ScannedRobotEvents using onScannedRobot(..), but instead use "only" the getScannedRobotEvents, you will get 0 events, if the ScannedRobotEvent have already been fired to the onScannedRobot() method, and hence the ScannedRobotEvents have been removed from the ScannedRobotEvents queue. If you read out the event too late, it might be empty.
Instead, I would use onScannedRobot() and collect all events in a list, which I would read out when needed instead of using getScannedRobotEvents().
You are welcome to send me your robot code to fnl (at) users.sourceforge.net. Then I could have a look, if you are still stuck on receiving the ScannedRobotEvents.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
As part of my M.Sc, I am working on a robot which simulates in every step the following step (look ahead) and depending on the result of the step chooses the action with the best action (using some grading function). The problem is that it looks like the simulation might take some time. But I don't think it explains the following behavior:
When I am running the battle in slow speed, the robot is able to identify SittingDuck (meaning ScannedRobotEvent is triggered). When I run it in higher speed (even 15), the event is not triggered, even if the radar passed the SittingDuck.
It is important to note that I am printing the getScannedRobotEvents() in some parts of the execution and it appears empty.
This happens even if I have a simple robot which only rotates its radar to find the enemy and simulates only one possible action.
Did anyone face this issue before? Is there a workaround? A configuration I can set that will let the robot run the simulation?
I am not aiming to create a robot that will qualify to participate in roborumble and competitions, so I don't mind change configuration (even in robocode's source) for it to work.
Thank you!
Hi Meytal,
Thank you for reporting this. I am not sure what causes this. It could be a bug. Hence, I need to investigate this issue and try to reproduce it.
Hi Flemming,
Thanks for your answer.
I am not sure if it will help shed more light or will only confuse, but I did the following test:
I changed robocode.cpu.constant to a large number (~30 seconds). In this configuration I see two weird things - (1) my robot doesn't get the ScannedRobotEvent even in low battle speed. (2) it still skips turns, even though the caculations it does don't take 30 seconds.
I can provide you my packed robot and sources, if it'll help.
Is there any way I can help in the reproduction\investigation?
Hi Meytal,
I have tried to reproduce your issue on my own by using this robot:
I get all ScannedRobotEvent with the onScannedRobot(..) method in every speed, from 1 to 1000 and even max speed does not make a difference.
If you are not detecting ScannedRobotEvents using onScannedRobot(..), but instead use "only" the getScannedRobotEvents, you will get 0 events, if the ScannedRobotEvent have already been fired to the onScannedRobot() method, and hence the ScannedRobotEvents have been removed from the ScannedRobotEvents queue. If you read out the event too late, it might be empty.
Instead, I would use onScannedRobot() and collect all events in a list, which I would read out when needed instead of using getScannedRobotEvents().
You are welcome to send me your robot code to fnl (at) users.sourceforge.net. Then I could have a look, if you are still stuck on receiving the ScannedRobotEvents.