Talk:Main Page

From Robowiki
Jump to navigation Jump to search

Contents

Thread titleRepliesLast modified
Virtual bullet doesn't line up with real bullets1407:33, 11 October 2011
Saving data between rounds220:56, 6 October 2011
while true loop307:12, 29 September 2011
LiquidThreads1013:56, 6 September 2011
Simplify recent change details from thread005:27, 6 September 2011
Talk from old wiki116:05, 5 September 2011
First page
First page
Next page
Next page
Last page
Last page

Virtual bullet doesn't line up with real bullets

I have a virtual gun that fires a virtual bullet, for some reason it's just slightly off when i actually fire.

MisalignedVirtualBullet.png

What's the proper way to align and fire? I think my timing is just off.

Ultimatebuster22:56, 3 October 2011

I would guess this is the result of the Robocode idiosyncrasy where a bullet is fired before the gun is turned (so if you do setTurnGunRightDegrees(10), setFire(3), execute(), the bullet is fired before the gun is turned right 10 degrees). So your actual aim is probably the aim from the previous turn, while your predicted is from the current turn.

Skotty23:28, 3 October 2011
 

Well... can't really tell without more information what's wrong, but my first guess about what's wrong, is that perhaps you're not accounting for how within a tick, firing happens before gun turning does. The angle you fire at when you call setFire() is the angle resulting from the prior tick's setTurnGun() type call.

Rednaxela23:28, 3 October 2011
 

Yeah that's correct, the setFire is from the last tick.

What's a typical pattern for robocode as to code placement? I'm currently placing the gun turning code in the while true loop and the firing code in onScannedRobot

and it's wrapped with if (getGunHeat() == 0.0)

Should I change that layout? (also add && getGunTurnRemaining() == 0.0 to the fire wrap?)

Ultimatebuster02:03, 4 October 2011
 

Using onScannedRobot or run is totally just a matter of preference - for 1v1 it won't make any difference, really. It could also be an off-by-1 error in the bullet source location - it should be your location on the tick you called setFire. Or your target angle was farther than your gun could move during that tick, in which case the getGunTurnRemaining == 0 check would solve it.

Voidious02:18, 4 October 2011
 

I know if i combined the 2 logics in 1 function, the code would fail (for me at least) Nevermind i figured it out.

(Also Voidious: I'm testing my bot against yours now because it has pretty debugging graphics and I can see my weaknesses :P Also I perform better against your bot (diamond) if i don't fire :P)

Ultimatebuster02:58, 4 October 2011
 

Also, am I suppose to, with my virtual guns, determine the fire direction using last tick's information, since gun turns after bullet fires...

Right now this would f with my simulated hit rate, as sometimes a bullet might hit but not a virtual bullet, or vice versa.

Ultimatebuster03:25, 4 October 2011
 

Yep, you should, though the impact is probably quite minor.

Voidious04:48, 4 October 2011
 

Hm. Even last turn's angle doesn't match with the actual fired one. Idk what's going on, also I think the virtual bullets also hits better..

Anyway to compensate the gun turn after the bullet fire?

Ultimatebuster17:15, 4 October 2011
 

My bullets were not lined up either, until in March this year, I finally solved the problem with GresSuffurd 0.2.28. It turned out that when using the estimated bearing of the next tick (firing tick) position iso the bearing this tick (aiming tick), my real bullets indeed lined up with my (correct) virtual bullets. It gained me 0.2 APS, but I reached spot #11 with slightly misaligned bullets, so it is really not that important. Also keep in mind you have to aim at the opponents next tick position.

GrubbmGait23:39, 4 October 2011
 

Wait i'm not sure if i understand what you mean by the next tick's position. How do I accomplish that?

Here's what I roughly have:

   while (true){
       if (getGunHeat() == 0.0){
           fireVirtualBullet(enemyCurrentAbsoluteBearing); // Just use Head on targeting as an example because it's simple
           fire(2);
       }
   
       turnGunRightRadians(enemyRelativeGunHeading);
   }

I know this would be wrong. I just don't know how to fix it =S

Ultimatebuster04:03, 5 October 2011
 

He means something like:

Point2D.Double myNextLocation = project(myLocation,getVelocity(),getHeadingRadians());
Point2D.Double enemyNextLocation = project(enemyLocation,e.getVelocity(),e.getHeadingRadians());
double nextAbsBearing = absoluteBearing(myNextLocation,enemyNextLocation);

I've tried this, and using it to predict the enemy location didn't help me, although it did help for my own location. I think it depends on the way you define wave hits and starting locations in your gun. In DrussGT I wait until my gun-turn remaining at the beginning of the tick is 0, then fire. I put my bullet on the wave from last tick. As long as you make the same assumptions everywhere it should be ok.

Skilgannon06:21, 5 October 2011
 

Yeah that doesn't help me either, predicting my next location and then aiming via that doesn't make it line up either. I also wait until gun turn is complete.... Still not aligning..

Also, how does bullets collision work? I thought it's a line segment that's between last tick's location and this tick's location (length of the velocity). Whatever the line segment intersect will be collided (other bullet lines or robots)

Ultimatebuster15:10, 5 October 2011

Maybe try staying still while shooting to see if that is the problem? If it still doesn't line up, it is some sort of gun alignment issue.

Skilgannon07:33, 11 October 2011
 

Yes, that is how bullet collisions work. Maybe take your last aim and align the bullet to that? What I do is mark my previous wave as having a bullet the moment setFireBullet() returns a non-null result.

Skilgannon16:40, 5 October 2011
 

Saving data between rounds

Can I save data between rounds in the static variables of other classes other than my main robot class?

Ultimatebuster20:45, 6 October 2011

Yep. Anything that's static will stick around in any class.

Personally, I model most of my stuff so the main robot class has objects that are static (gun, movement, etc) and then everything else is non-static in those classes, but you can model it however you'd like.

Voidious20:55, 6 October 2011
 

Yes.

Skotty20:56, 6 October 2011
 

while true loop

How is the while (true) loop actually broken down? Does robocode executes the code there 1 iteration per turn? Or..?

Ultimatebuster20:49, 28 September 2011

Generally, yes - when you call execute(), the Robocode engine processes one tick, including firing all the events on your bot, and then your run() method continues executing. So most of us have an infinite loop that calls execute() at the end, and each iteration is one tick.

But there's no magic to it - you could have a run method that goes:

public void run() {
  turnRight(20);
  ahead(100);
  fire(3);
}

And that would be perfectly valid. Or you could call execute() every third iteration of your loop. In Dookious, my run method used to have a loop that was while (notWonYet) ..., then a victory dance.

Voidious22:00, 28 September 2011
 

The timing thing for me is very confusing...

For example, if i want to fire at a certain angle, i have to rotate to it.. by the time i do.. i have another angle... which requires more rotation.. etc..

Same thing for turning the robot and going ahead.. I never know how to correctly time them. (Effectively stuck)

Ultimatebuster00:36, 29 September 2011
 

For gun aiming, see Robocode/Game_Physics#Firing_Pitfall. This can cause your aim to be a tick behind. I think most robots don't worry about it. But if you do worry about it, what I do is predict robot positions 1 tick into the future and use that for aiming. It's not exact, but works well enough for me.

Skotty07:11, 29 September 2011
 

LiquidThreads

Just installed LiquidThreads... Hope we all dig it. =)

Voidious18:41, 3 September 2011

We might!

Chase-san19:39, 3 September 2011
 

Liquid threads are kind of better, but still not ideal. My main concern is that this still requires you to go to different pages, some are difficult to get to (have to know it specifically or get refered). For example, if someone were to ask a question/start a discussion on certain type of targeting etc.

Personally I think a forum works the best, as it can break things down into different categories and list everything out in a manageable fashion.

The Facebook group is good, but it lacks the community involvement, in my opinion.

Google+ seems cool, but I can't sign up for it with my Google Apps account..

... and who uses yahoo? :P

Ultimatebuster02:17, 5 September 2011

That's what the Special:RecentChanges is for - you can see modifications made anywhere on the wiki. Questions can be asked on the person's homepage and moved later, if necessary.

Skilgannon11:39, 5 September 2011
 

It will take a while to get used to. But there is no need to diff the discussion pages anymore. Neither convert local times to UCT every time I write something. Nice work.

MN02:59, 5 September 2011

Just doing 4 tildas (~) will automatically do a UTC timestamp, plus signature.

Skilgannon09:40, 5 September 2011
 

I have only one complain. LiquidThreads is polluting the Recent Changes page.

MN03:03, 5 September 2011
 

Ultimatebuster: With regards to a forum, personally the problem I would have with a traditional one, is that conversations are often with regards to a specific concept that either has or should have it's own wiki page anyway. The tight linkage between pages and talk pages encourages cross-pollination between the two sides, with discussion inspiring wiki pages and wiki pages inspiring discussion. Plus, I feel that the categories that would be created in a normal forum would be too broad for robocode and cronological sorting within such large groups too limiting.

Rednaxela06:12, 5 September 2011
 

A forum would be much more open for beginners to ask questions though. you shouldn't try to put everything into categories but just leave it to different threads in topics. --Peltco 06:15, 5 September 2011 (UTC)

Peltco07:15, 5 September 2011
 

Maybe it would make sense to have a page using liquidthreads which is specifically for asking questions when a specific page is not known? Perhaps do something like prominently link it from the main page, or even embed it?

Rednaxela16:43, 5 September 2011
 

Well, although beginners may not know, but I believe with our not-so-large community you can ask questions on almost any talk page, and if it seems inappropriate, someone will move the conversation to the right place. I really think we should have a bot that post welcome message to user, since IIRC it tells that you can ask question on your talk page.

Nat Pavasant13:56, 6 September 2011
 

Simplify recent change details from thread

Basically reduce the amount of data from the post that is set in the recent changes area. Lots of it has been wrapping, and that makes it harder to read. If possible half of what it has now. If possible even a "ABC has replied to thread XYZ". ;)

Chase-san05:27, 6 September 2011

Talk from old wiki

Personally, I think with the LiquidThread installed, every talk from old wiki should be put into the Archived talk namespace, or discussion header. My main reason is that discussion from old wiki would be uing old-style link, and I don't know how to programme a wikibot to edit a LiquidThread (plus my old converting code would work with the discussion header without modification)

Nat Pavasant11:27, 5 September 2011

I don't like leaving conversations in the discussion header, since it pushes the LiquidThreads stuff way down the page and I don't think that's what he header is for. I think moving to Archived talk is appropriate in most places, and you can just link to it in the header (like I did in Talk:Main Page).

I'm not sure how to deal with current conversations on the new wiki. I don't want them in the header. Archiving them is OK in most places, and maybe we could do it with a bot, but it feels pretty drastic to do it across the whole wiki. I wish I could just convert them to LiquidThreads conversations...

Voidious16:05, 5 September 2011
 
First page
First page
Next page
Next page
Last page
Last page