User talk:Skotty

From Robowiki
Jump to navigation Jump to search

I Hate Wall Avoidance

I hate it with a passion. I'm still trying to come up with an elegant solution. Since one of my main drive strategies is "orbital", I'm now toying with the idea of moving my orbit target to avoid hitting the wall, rather than trying to adjust orbit path separately. Though I'd prefer a solution that works regardless of drive strategy.

I still have a lot of work to get my drives working well in general. However, I may have to stop playing Robocode again soon. Too many other things I need to get done...

Have you tried Wall_Smoothing ? If you are not wave surfing, you will probably also want to have some explicit Dive_Protection . If you are having trouble implementing those elegantly I would suggest you take a look at the Wave_Surfing_Tutorial) --AW 21:37, 31 May 2011 (UTC)

Been awhile since I posted this, but I wanted to touch on it again. I am using the typical implementation of wall smoothing, but I don't consider it elegant. The path is a little irregular when cruising around the edges of the battlefield, and it's possible to run into a wall when approaching too quickly and at too steep an angle to turn in time. I still have working on a better solution on my TODO list. I may work on it in the near future. Now that I've built the ability to predict drive paths into my components, it should be easier to achieve a better solution that can get closer to the walls while running into them less. -- Skotty
FYI - I think this one's pretty elegant: Wall Smoothing/Implementations/Fancy Stick. --Voidious 19:23, 27 June 2011 (UTC)
That's actually very close to some pseudocode I already came up with. Mine also takes velocity into account, which I'm not sure if fancy stick was meant to or not (I kind of just skimmed it). I currently call mine dynamic wall arc. Instead of a stick, I use a 180-degree arc, and it's dynamic, because it changes based on robot velocity. Because it takes velocity into account, my the method for my approach returns both a smoothed angle and smoothed speed. I plan to have it finished in the next couple of days when I have some free time. It will be interesting to see if a better wall smoothing algorithm improves overall performance or not. I'm keeping my old wall smoothing code as well, as I think it is a closer approximation to what most robots do, and I want to continue using it for predicting paths of opponents. -- Skotty 23:06, 27 June 2011 (UTC)
I made a code implementation of the fancy stick on the talk page... it's not very neat but it's quick and dirty and it works =) --Skilgannon 19:14, 28 June 2011 (UTC)
I definitely know what you mean by the common form of wallsmoothing seeming inelegant. Interesting approach you're taking. As far as tuning the wallsmoothing goes, note that tighter and more accurate wallsmoothing won't necessarily be a good thing I think. The thing is, tighter and more accurate wallsmoothing means your behavior near walls will be more distinctly different than far from walls. The distinct difference will give adaptive guns aiming for you more accurate/distinct information to "home in on". (Errata: tighter and more accurate wallsmoothing on the other hand, expands the "wall doesn't affect movement" area, so... how it plays with adaptive guns has factors going both ways... The interplay with adaptive guns hard to predict without doing an in-depth analysis or just plain trying it... but either way, keep a close eye on how it affects performance against adaptive targeting)
Personally I'm hoping to avoid explicit wallsmoothing in my next surfer... sort of like how I already avoid explicit dive protection... (Maybe this is something Voidious would call me insane for, unlike about dive protection? Haha) --Rednaxela 13:33, 28 June 2011 (UTC)
I might have, but I think you already explained the details to me and it sounds pretty badass. =) --Voidious 14:28, 28 June 2011 (UTC)
I've finished a functional version of my fancy stick...trying it out in Rowdy. We'll see what happens... -- Skotty 22:30, 29 June 2011 (UTC)
I'm trying out a new variation on fancy stick in my robot Rowdy. This time, not only do I use my own take on the fancy stick, but I've also built in the means to use non-rectangular drive bounds. I can make the bounds any shape I want, and use either regular wall stick or the fancy stick with it. Should be interesting to play around with. For reference, Rowdy 1.1.1 uses regular wall stick with rectangular drive bounds. Rowdy 1.1.2 uses my take on a fancy stick with rectangular drive bounds. Rowdy 1.1.3 uses my take on a fancy stick with a drive bounds that looks kind of like a rounded rectangle that bows in on each side. I wonder if I am the only one to try using a non-rectangular bounds? If anyone wants to see it visually, I left on the options in Rowdy to draw the fancy stick (or wall arc, as I call it) and the drive bounds. It's kind of interesting. Could still be a few glitches in my implementation. And it reverts to wall stick if my robot happens to get out of bounds somehow (like on startup), as my wall arc doesn't take being out of bounds too well. If you look at the painted battlefield, you will see that there are actually 2 drive bounds drawn. The plain rectangular bounds is the one used for the opponent. I did this partially for fun, but I also have a theory as to why the fancy stick seems to result in lower scores. The theory is that it causes the drive path to be too predictable at the edges, as it results in too much driving straight when smoothing. However, with a wavy drive bounds, this will no longer be the case. -- Skotty 19:17, 30 June 2011 (UTC)
That theory is basically what I meant a few days ago, in the paragraph above where I wrote that I don't think tighter wallsmoothing is likely to be good against adaptive targeting :P --Rednaxela 02:31, 1 July 2011 (UTC)
Okay, I've monkeyed with wall smoothing far too long again, and so far it's not performing even equal to my former wall stick method. I hate it, and I once again hate wall avoidance, but it's back to the wall stick for me so I can go back to focusing on things that might actually make my robot score better. lol. -- Skotty 02:50, 1 July 2011 (UTC)

Packaging Source Files

At the moment, my robot XanderCat is not packaged with source. This is fine, since the Xander framework is not entirely complete yet. Though when I am ready to package with source, I'm not sure how I will do it. I use Eclipse for development. I can add the bin directory under the developer options to run my robot while it is under development. But when I go to package it in Robocode, I'm not sure there is any way to tell it where the src folder is. I could also just check to see what all Robocode is putting into the jar files, and write my own Ant built script. Or I might just provide the source as a seperate download from the wiki page. Thoughts?

I'd also like to point out that not packaging your source doesn't necessarily keep people from checking out your code. Class files can be decompiled. Just a thought...

I too use Eclipse for development, and have never had trouble with packaging the source code. I have options -> preferences : development options set to my ...\workspace\robots\ directory which contains my ...\src\ and ...\bin\ directories, then I can package my robots in robot -> package robot for upload; this dialogue contains an "include source" check box (enabled by default). --AW 23:21, 27 May 2011 (UTC)

The preference dialogue on development options, it says that "If you are using Eclipse, you can enter the root dir of robot project inside robot workspace as well (recommend)". Robocode is able to parse Eclipse's project file to get /src and /bin dir (multiple source dir is also supported I think). That way the source code will be packed. --Nat Pavasant 02:43, 28 May 2011 (UTC) PS. I am the one who requested this feature. Before that, I have to either put the source in the jar myself (via WinRAR) or set output directory to /src

Ah...okay. I did not follow that it would automatically check for /src and /bin folders. Skotty 21:32, 31 May 2011 (UTC)

Rant on Lost Form Submissions

Bitten by poor web application design again. After having to pause one of my edits to take care of another matter, I returned a bit later, finished my edit, and submitted it. However, my session had timed out. Much to my surprise, MediaWiki did not preserve my edit. I thought MediaWiki was classier than that.

It is a newbie web developer mistake to have a web application lose someones edit due to a session timeout. The proper action is to save the edited data, give the user a chance to log back in, and then apply the edit or return them to the edit page without losing the edit. I'm often surprised at how many web applications exhibit this glaring flaw...so many, that I almost consider it my own mistake for not copying the text to notepad before submitting. But it is not my own mistake. It's the web application's mistake. A mistake that I am really growing tired of seeing again and again and again...


Eh? I have never had session timeout with MediaWiki. Are you sure it is really session timeout? I know for the fact that MediaWiki use token cookie for authentication. BTW, I know Chrome preserve form data on 'Back' button. I don't know about other browsers, but I think they do too.

On completely unrelated note, I found that FanFiction.net authentication system more frustrating: if I checked "Remember me for one day", it remember exactly one day i.e. if I start edit on 23.58 and finish on 24.01 hours after my login, my edit will be gone :( --Nat Pavasant 12:51, 27 May 2011 (UTC)

Robocode Bug

I like to print out some stats after each round, but I've been running into a problem. I may be limited to printing to the console. If I win, I get an Win event and a RoundEnded event. But if I lose, it appears as though I get no events. However, it may just be that the console dies before all events are fired/processed. Is that the case? It would be a pain to have to write results to a file every time. I'm running Robocode 1.7.2.2.

In my test, I do a System.out.println in each of the event methods on my main robot class (onWin, onRoundEnded, onDeath), but I only see them when I win. Thoughts? Skotty 21:39, 8 June 2011 (UTC)

I just figured it out. It happens when the main window is minimized. The events are always fired, but they can only print to the console if the main window is not minimized. Annoying, but I can live with it. Skotty 22:01, 8 June 2011 (UTC)
Certainly sounds like a bug - you should always get them, and I'm pretty sure it worked in the past, even when minimized. I have onWin and onDeath both calling a common method (maybe onRoundEnded didn't exist at some point). --Voidious 23:03, 8 June 2011 (UTC)

Painting on the Battlefield

I have been using the painting ability in Robocode to a large degree lately. It's great for debugging, and it's just plain cool. I have quite a few painting features built into XanderCat and the Xander framework now. I left them enabled in XanderCat 3.4, and I have even more cool stuff that can be turned on for XanderCat 3.5 (mostly gun stuff).

Who else out there is using the painting ability of Robocode? Are there any interesting robots to check out? Do you use it for your own bots? Skotty 15:20, 10 June 2011 (UTC)

Off the top of my head: Diamond (gun gfx need an udpate though), Phoenix (one of my favs, and one of the first to make really nice graphics), Shadow, Glacier (other Rednaxela bots?), DrussGT, GresSuffurd. Well, that should get you started. There are lots more though. Maybe Google: graphics site:robowiki.net would yield a more exhaustive list. =) --Voidious 16:24, 10 June 2011 (UTC)

  • Specially Diamond is nice with its feature to turn on/off gun and movement graphics separately during battle (radar graphics does not show anything I think). That's something I definitely want to do too, because enabeling the graphics in the .ini file is just too much trouble. Tigger would be the first tank to have graphics, as stefw was the one who developed the possibility. --GrubbmGait 00:05, 11 June 2011 (UTC)
    • Radar (unless I broke it) shows last known location of each bot. In 1v1 this isn't very visible, but in Melee you can see the squares. And thanks. =) KID's menu system sounds a lot sleeker though! --Voidious 00:21, 11 June 2011 (UTC)

I've built in a lot more painting options into XanderCat and my Xander framework since I first talked about this. Right now, you have to turn painting for different things on and off by setting boolean flags. Sometimes I think it would be nice to turn painting options on and off during battle, but I haven't investigated the possibility. I know ther are interactive robots now, and it might be possible to take advantage of the mouse controls to be able to turn paint options on and off. However, the bigger issue I am working on solving, is that I built the painting ability into individual components, and I now want to seperate that code from the components. What I am doing for the moment is defining interfaces for different kinds of components with getter methods for the information that would be needed to paint. I then create a seperate painter class for that type of component. And for the moment, I register those painter classes with a single PaintManager class. So, for example, if I want to paint the factor arrays for a wave surfing drive, it would look something like this:

// the drive implements the interface

public class SomeWaveSurfDrive implements FactorArrayPaintable {
	...
}

// and in the main robot, where the drive is created...

	SomeWaveSurfDrive drive = new SomeWaveSurfDrive();
	PaintManager.addPainter(new FactorArrayPainter(drive));

Bug Exploits -- What's Fair, What's Not?

Thought I would share my thoughts on bug exploits, and see if anyone else cares to share their thoughts as well.

In my opinion, anything that attempts to exploit bugs or vulnerabilities in the Robocode engine itself is unfair, as it is not in line with the intent of Robocode. However, anything that attempts to exploit vulnerabilties in other robots is fair, and very much in line with the intent of Robocode.

The one case I see as debatable is whether or not it is fair to exploit bugs in other robots. I would categorize this in two flavors -- generic exploits, and targeted exploits. General being an across-the-board attempt to exploit a common bug, and targeted being based on recognizing individual robot names. I think both are fair and acceptable practice, as opponents are always welcome to update their robots to correct them.

Does anyone disagree with this assessment? What are your thoughts?

I agree that exploiting Robocode bugs is unfair and (even if we didn't police it) kinda stupid because they will be fixed eventually. I also agree it's fair to exploit flaws/bugs in other bots. Having bot-specific logic in your bot is definitely allowed in the RoboRumble - even pre-packaged data files. However, many of us (myself included) are not really into doing this ourselves, as we just don't find it as interesting, and doing so could hide the possibility of "real" improvements. (Eg, why improve your gun's learning speed if it can be pre-loaded with data offline?) That said, LittleBlackBook takes bot-specific logic to the extreme, and I find that bot very interesting! =) --Voidious 17:20, 27 June 2011 (UTC)

What brought this up is the x.x5 bug. I agree, it's more interesting not to have bot-specific logic. I like playing with bullet power, but I didn't want to lose ground against other top robots that take advantage of the x.x5 bug. My solution was to specifically target those robots I know to be vulnerable, allowing me to continue playing with bullet power however I want against other opponents. This type of targeted attack is the basis for my Red Eyed Monkey components, as I have been calling them. Generally, I haven't been using them, but this is a case where it made sense. The name coming from Toy Story 3, because it always makes me think of the monkey in the movie that watches the security cameras. -- Skotty 17:32, 27 June 2011 (UTC)
What I did in DrussGT was to do the bullet power choosing first, then round it to the nearest x.x5. --Skilgannon 13:33, 28 June 2011 (UTC)

In last versions of robocode enemy name can be hidden, so in long terms it's not very good idea to have special cases, based on enemy names --Jdev 06:18, 30 June 2011 (UTC)

How are they hidden? Is some unique ID (unique per battle) provided instead? If and when I enter the melee rumble, it is likely I would want to track different opponents, which I currently do by robot name. If no unique ID of any kind is provided, then this means there is no way to differentiate between opponents? That is a pretty big change. -- Skotty 19:11, 30 June 2011 (UTC)
We definitely would not make that change without a lot of discussion, and I doubt we would... It is an available feature in new versions of Robocode, but that doesn't mean we have to use it in the RoboRumble. Anyway, I do think it's a unique identifier though. --Voidious 22:31, 30 June 2011 (UTC)

Virtual Guns Equivalent To Virtual Hit Ratios?

I usually push myself to avoid looking at other's tactics, and come up with as much as possible on my own. I've seen "Virtual Guns" here and there around the wiki. I was thinking this is the same thing as my "Virtual Hit Ratios". With my virtual hit ratios, I have every gun provide it's aim for every time I can take a shot. I then record whether or not that aim would have hit the opponent after the wave passes the opponent. From that, I can track the "virtual hit ratios", and select which gun to use from those ratios. Is "Virtual Guns" the same thing?

Yep, "Virtual Guns" fire "virtual bullets" which can virtually hit or miss the opponent. Most hitratio's you see in the debugwindow when fighting an opponent are virtual hit ratio's. I do not even use the real hitratio, although I print it out at the end of each round. Mind though that the ratio's are not sacred, hitting with a real bullet can influence the behaviour of the opponent, hitting with a virtual bullet will not have influence. --GrubbmGait 07:58, 30 June 2011 (UTC)

CPU Utilization

Have a missed a good conversation on this before? I'm just now getting concerned about how much CPU time I can use without having skipped turns. I now have my framework track peak and average CPU time per turn, but I don't really know what I can generally get away with. How many milliseconds should I try to stay under per turn?

My new factor array system will be more CPU intensive than what I was previously using. One thing I was thinking of doing to avoid possible problems is to split up the workload of factor array processing somewhat evenly for each turn. I can do this with my new drive because it is a Go-To style drive that only makes decisions when the wave situation changes. I could use the in-between turns where decisions are not being made for handling things like rolling averages.

I built a little paint module that can paint a graph of robot CPU utilization on the screen during the battle. Pretty nifty. -- Skotty 20:08, 11 July 2011 (UTC)

Well, if you go to "Options->Recalculate CPU Constant", it will tell you how many nanoseconds that Robocode allocates per turn on your machine. I'd say it would be best to try to keep the peak amounts your robot uses below 80% of that to be safe.

Redistributing CPU intensive code across multiple ticks is something I've considered before, but I haven't because I don't view the mostly empty ticks as "wasted time", I instead view them as a way to: 1) Allow the robot to be tested faster when doing hundreds of seasons of dozens of TC/MC tests in RoboResearch, and 2) Be courteous to others because being inefficient with rumble time is bad karma. --Rednaxela 23:58, 11 July 2011 (UTC)

I'm not looking to maximize my CPU usage, just to flatten the peaks. As a point of interest, I did a recalculate CPU constant, and it gave me a time of about 11.6 ms. On a typical 35 round battle, XanderCat 6.1 had an average turn time of about 1 ms, but could peak close to 9 ms on some turns (although it was more common for it to peak about 5 ms). -- Skotty 02:45, 12 July 2011 (UTC)
On this topic, one of my older guns (Prototype) pretty much required distributing its computation across multiple turns to avoid skipping them. It was also because of this that is could only use actual bullet waves to rate enemy movement. However in my opinion, unless you really need to, it is more painful then useful to do. — Chase-san 03:41, 12 July 2011 (UTC)