| Kriscross |
| Posted: Feb 9 2009, 02:25 AM |
 |
|
New Member

Group: Members
Posts: 1 (0 robots)
Member No.: 1448
Joined: 7-February 09

|
Good day to all of you. My robot(Caesar) is fairing pretty well with other robots. However, its problem is that it has to do a complete radar rotation to fire again. Can anyone give me a sample code that allows the robot to lock its radar to the opponent? Thanks. |
| sniporbob |
| Posted: Feb 19 2009, 10:42 PM |
 |
|
New Member

Group: Members
Posts: 4 (0 robots)
Member No.: 1446
Joined: 4-February 09

|
Haha i think that is the problem that nearly everybody here faces. I assume that since your robot does fairly well, it moves. I have made a simple tracking system for my robot (viewable here: http://www.robotbattle.com/registry/index....=ST&f=3&t=1521), but once I add movement to my robot it all goes haywire. You would need something like what I have, but you would also need to factor in your movement speed, enemy movement speed (which we dont have), enemy bearing, and your heading vs his heading to determine which way you need to rotate the radar. Not easy, but it is certainly possible.
My plan is to get the stationary tracking down, then add movement into the mix. I almost have a perfect stationary tracking system with the code Im working on now, so I will soon start on tracking while moving. Perhaps adapting a stationary tracking system to a moving tracking system is harder than making a moving one from scratch, but it seemed like a logical thing to do at the time. Good luck, and keep us updated!
Bobby |
| P-E-F |
| Posted: Feb 22 2009, 11:06 PM |
 |
|

New Member

Group: Members
Posts: 8 (1 robots)
Member No.: 1454
Joined: 22-February 09

|
I have found with my own robot creation that the best way to target an enemy robot accuratly while moving, is to calculate the last know x,y position of the enemy robot. I don't have an updated example at the moment, but here's the basic flow in my program.
-use cos( _scandist) and sin( _scandist) to get the last known x,y coordinates -use a seperate section with the basic trig. formula to calculate the new heading and distance to x,y coordinates if you move -put lots of IF statements in it to avoid divide by zero errors -in your scan section use a radarright( # * RR) RR being a + or - from your current _gunaim to last know target x,y -have a if statement that reverses RR if your radar goes beyond a certain scope of last known x, y of target... say 20 deg. each way. -have the last known x,y clear them selves if your scan hasn't found them again in a certian amount of time after searching.
One on one this tracking sytem works great : beating fire 4 to 1 but it has proven to be a thorn if there are other robots around, or if they are moving too fast. such attention to one target makes the robot more vulnerable to the others. |
| chess123mate |
| Posted: Feb 25 2009, 01:44 PM |
 |
|
Logical Programmer
    
Group: Members
Posts: 587 (24 robots)
Member No.: 936
Joined: 3-February 07

|
To prevent your robot from continuing to scan, you could use a variable like "shouldScan" and assign it the value "true" unless you scan and detect a bot (then assign it the value 'false'). Only advance the radar if "shouldScan" is true. If it is false, set it to true for next turn.
In response to P-E-F's post, I would suggest simply detecting pings (then tell your robot to focus on escaping and check for the robot at (x,y) later), or if your bot is pinged simply clear the x/y coordinates if you don't want to be bothered.
Also consider resetting your x/y after you scan that position instead of after a certain amount of time; you can then resume scanning normally or put your bot into a "tracking" mode where it continues to look left/right in an attempt to find the bot for a bit before resuming normal actions.
Perhaps you already have something like that? |
| P-E-F |
| Posted: Feb 26 2009, 08:08 PM |
 |
|

New Member

Group: Members
Posts: 8 (1 robots)
Member No.: 1454
Joined: 22-February 09

|
Thank you for the response chess123mate.... Yes the falure to repond in the best way to enemy pings was one problem with my robot not lasting very long in multi robot fights, but I just found the other major one. My robot was shooting too much. With the tracking system what it was, my robot was spending too much energy on A: shots that would not have a good enough chance of hitting the enemy. And B: Even if most of the shots hit and destroyed the target, before long my robot would be down to 50% energy without getting hit by enemy fire. And still have half the robots to contend with.
Just setting the max fire power when _robots alive > 4 seemed to do wonders, giving it a top three finish almost every time. |
|