View source for User talk:Tkiesel/Dev Notebook

From Robowiki
Jump to navigation Jump to search


Thread titleRepliesLast modified
hiatus116:00, 26 August 2012
calling execute() every tick918:28, 18 June 2012

Glad to hear you're not gone for good! :-) Some of my best jumps have come after long breaks. Getting stuck in a constant state of running tests and anxiously awaiting the results can drive any man insane.

Voidious21:59, 23 August 2012

Thanks for the well-wishes! I decided to just take a break, think about other things and come back to the problem later, hopefully with a fresh perspective. Not to mention I might start with a refactor/cleanup when I do come back to Robocode this fall/winter. and could both use some cleaning up and trimming down to start with.

I'll be teaching an engineering class this year instead of CS, but it will include programming LEGO/Tetrix style bots (as are used in the FIRST competition) with a variant of C. I think I'll use Robocode as my intro software engineering projects this semester. I'm excited!

Tkiesel16:00, 26 August 2012

calling execute() every tick

I notice you only call execute() once during your run() method, not in a loop. Is that new? Don't you need to call execute() or another blocking method every tick?

Voidious21:01, 17 June 2012

That execute() was just an instance of me trying to stop the do-nothing-this-round bug. When deBroglie does nothing on a round, the radar isn't spinning.. despite the infinite radar spin in run().. yet onSkippedTurn is still never triggered.

I don't have any calls to execute(). Everything is in onScannedRobot()

Question: in a 1v1 match, can onScannedRobot trigger more than once? That right there might be a source of some of my problems.

deBroglie's structure would allow a movement(), gun(), execute() loop in run().. and just update the Universe object in onScannedRobot. I think some of my bullet/wave code would need tweaking because the gun and movement might be operating on a one-tick-old Universe.. but I think that can be dealt with.

Tkiesel21:16, 17 June 2012

I don't think you should get 2 scans in one tick, but I did find oldwiki:DoubleScanning the other day, where David Alves said: "f you skip a turn before handling the ScannedRobotEvent for that turn, you'll get 2 ScannedRobotEvents on the next turn. You only miss lose events if you skip 2 or more turns in a row, if you miss one you'll just get extra events on the next turn."

My guess is that this is likely to have long ago been fixed, but I don't know for sure. It seems like Wompi and I have found some similar issues recently, so maybe something like that could be happening?

Having everything in onScannedRobot except a turnRadar in run() makes sense, but I thought you'd still need the turnRadar in a loop, wouldn't you? If you skip a turn and your radar slips, will it ever move again?

Voidious21:23, 17 June 2012

No, if the radar slips, I'm well and truly out of luck. Interestingly enough, my weird rounds (when I have battles slow enough to observe visually) seem to happen right from the word go.

might be worth exploring the idea of getting a non-onScannedRobot Universe update method, and put everything I can in run()?

Those rumble rounds (with about 6 bots on my rumble client, MN's and KID's it looks like) with completely zero score are concerning to me too.

Tkiesel21:27, 17 June 2012

Interestingly enough, if I put an execute() at the end of my onScannedRobot(), my debug graphics for waves fired from the enemy are off, as if I didn't tag the wave until one turn too late. *head scratching*

I get the feeling once I really figure this whole mess out and resolve it, my bot's scores will benefit greatly.

Tkiesel22:43, 17 June 2012

Sorry if i'm wrong (i'm a little drunk because of the soccer EM). I think your radar can miss the target in the first search procedure. If the target moves very unlucky you end up with a sitting duck. It happens sometimes that you hit the target under an very bad angle/velocity and than the radar won't lock at the first hit. Looking at your code, i think this would lead to a sitting duck straight from the first round. I think you are better off with something like

public void run()
            if (getRadarTurnRemaining() == 0) setTurnRadarRight(Double.MAX_VALUE);

I don't think you have to move all your onScannedRobot(..) stuff to run(). This would lead to some other issues if you miss/skip some turns.

For the execute() at the end of onScannedRobot(..). The paint event has a priority of 5 (i guess) and comes after the onScanned.. so if you end your turn before onPaint(..) is processed you won't get any graphics. Not sure about the priorities now but it is something around this i guess.

I try to have a closer look at this tomorrow ... not sure on what time shift you are :) but maybe it helps right now.

Take Care

Wompi23:53, 17 June 2012

I agree having everything in onScannedRobot for a 1v1 bot is reasonable, and is a setup I've used in some bots. I just have an infinite loop in run() like Wompi put above.

I see your initialization code only runs in the first round. I don't know what's happening, but if your bot throws an exception in the initialization in the first round, you'd be dead in the water. I usually check for null... but at least this way it's really obvious something is wrong, which is probably a good thing.

Voidious00:04, 18 June 2012

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:User talk:Tkiesel/DeBroglie dev Notebook/calling execute() every tick/reply (7).


A little more clear minded now. And i agree to Voidious that something kills your robot while in the first round rule. Skipping the whole match is very uncommon i guess :(. I had some test runs with your bot but never got the dreaded "skip match " issue. But sometimes it gets disabled because of to much sipped turns. I hope you can figure it out soon :)

Wompi17:41, 18 June 2012

Yeah. I've cleaned up and compartmentalized the initialization code some more, and after some reading about Exception catching, I'll probably try to catch problems there so I can at least get a console message when something screws up.

I just started my static Universe, Gun and Wheels as nulls, and initialize them if they're null. That prevents the need to check what getRoundNum() it is. With everything spread out, bug hunting should be easier!

Thanks for the help and encouragement, folks! :)

Tkiesel18:28, 18 June 2012