RoboCode Mentors

Jump to navigation Jump to search

RoboCode Mentors

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:Talk:Main Page/RoboCode Mentors.

I would say just make yourself at home on the wiki and post all the questions you like. You'll probably get better / faster responses giving everyone a chance to answer them. Most of us watch Recent Changes and are happy to help. =) I'd also love to hear what kind of intro / tutorial pages would have been helpful to you, once you get your footing.

Welcome to the RoboWiki!

Voidious01:58, 11 October 2011
 

Yeah, just ask away. If you're not sure where to ask, just ask on your user page. It also helps if you keep some sort of documentation of what you're doing, it doesn't have to be fancy, but more like a changelog - it makes it easier for us to give suggestions. I'd think that the majority of the stuff is already here on the wiki, but knowing what to call it and where it is needs a bit of experience =). Fresh blood is always appreciated! So go wild with the questions.

Skilgannon07:32, 11 October 2011
 

Ok, I guess the format of the Wiki and the highly-conversational style are throwing me a bit. I wasn't expecting a response so quickly (or at all, for that matter).

I think a brief primer on the physics/maths calculations you'll need for robocode would be useful, eg:

- how to calculate the difference between two headings
- how to calculate the relative velocity of another bot vs your bot (don't know if this is used in any of the 'top' algorithms, but it feels like it could be useful to newbie bot authors)
- how/why to normalise headings to relative angles (I know the Utils class has this, but it would be useful for newbie bot developers to know how to do it themselves and why it's useful)
- how to calculate the distance between two headings (subtle difference between this and the first point)

If this already exists, could someone point me in the right direction?

Cbrowne14:04, 11 October 2011
 

I'm not sure if this is covered explicitly anywhere - I know for all of the geometry problems I run into I sketch it on paper then solve it traditionally.

That said, the difference between two headings is just (scan1 - scan2). You might want to use normalisation - either relative or absolute - to put it in the range you want.

On this wiki we generally refer to relative velocity in terms of its components - Lateral_Velocity and Advancing_Velocity. The pages for those explain how to calculate them, and yes, they are used in a lot of the more advanced algorithms =)

Relative normalisation is used for determining how far something is to the left or right - for instance, whether you should turn your gun left or right. It puts the angle between -Pi and +Pi (or -180 and +180). Absolute normalisation is usually used to figure out where something is 'relative to North' and gives a value between 0 and 2*Pi (or 0 and 360).

As to your last question, I'm not sure exactly what you're asking. Perhaps you want the absolute value of the heading difference? If so, take the relative normal angle first so you don't get the situation where one is on 355 degrees and the other 5 degrees, and the difference between them is 350 degrees instead of 10.

Skilgannon15:03, 11 October 2011
 

scan1-scan2 is over-simplified, if you want the -shortest- difference between the two headings, which is more useful, it should be: `360 - Math.max(scan1,scan2) + Math.min(scan1,scan2)` I think. Different when dealing in radians (obviously).

The last question is a little difficult to phrase, but no I'm not talking about the absolute value of the heading difference. I'm talking about calculating the distance between two points on two given headings. Using trigonometry. Eg "where is the bullet the robot I just scanned just fired? if he fired one", I know this specific example is impossible to model exactly, but for modelling best-guesses of enemies' guns I would imagine this kind of equation would come in handy.

Thanks for the links to Lateral and Advancing Velocities, it makes sense that they're used a lot in the more advanced algorithms, but those algorithms are all pretty much magic to me at the moment so I had absolutely no idea what is and isn't used.

I'm also not asking for specific answers to these questions, just asking if it might be wise to set up a wiki page that has some basic physics for the purposes of other newbies who don't have answers to the questions (I do, because my dad teaches A-level physics). But thanks for your answers nonetheless, as they did help clarify one or two points I wasn't sure about. :)

Cbrowne15:41, 11 October 2011
 

I'd take the difference, then normalise it relatively and take the absolute value.

As for the other one, you probably want to look at projecting a point from an origin location, a certain distance at a certain angle. If you look in the source of Raiko (or pretty much any other open source bot) you'll see the 'project' function. Once you have the new location of the point, you can calculate the distance the normal way, sqrt((x1-x2)^2 + (y1 - y2)^2).

Skilgannon16:11, 11 October 2011
 

Oh, and if you want to have a starting point for more advanced algorithms, I suggest Pattern_Matching. It's what I started with, and it makes a good introduction =)

Skilgannon16:13, 11 October 2011