Darwinbots Forum
Code center => Bugs and fixes => Topic started by: strangers on October 27, 2007, 02:41:57 PM
-
I haven't checked this in 2.43o, but in 2.43n in non-torroidal sims my bots dissapear off screen.
I was using standard F1 conditions with torroidal turned off.
-
Yeah, I just noticed that too. I don't think they disappear, I think they just go off visible field for a bit and then come back.
-
Try unlocking the screen and zooming way out. Do the bots disappear or are they just going out of the arena?
-
Where is the option for unlocking screen? I saw it somewhere, but now can't find it.
-
It's in the top toolbar. It looks like a padlock. When you unlock the screen, it'll look like an unlocked padlock.
-
Thanks. Yes, they just go out of bounds for short periods of time. Usually it's a small bot being pushed out by a large bot. They do come back though, so I don't think this is a serious problem.
-
It's an artifact of the way the physics engine works. The arena isn't a hard constraint. It's more like the walls are made of rubber.
-
A recent perf change I made is calling attention to this. If the center of the bot is outside the visible portion of the field, I don't display the bot even if part of it should still be visible. This helps perf, primarly when zoomed in, but it also has the side effect of making bots whose center crosses the edge seem to disappear when the field is locked and zoomed all the way out.
I could change this in a generalized way, but there would be a small perf hit to do the math for every bot every cycle when zoomed in arbitrarily.
What I think I will do unless someone has strong objections is special case the locked zoomed all the way out mode and check center + radius in that case only.
-
This shouldn't be too hard to fix in the general case, I did it once for the C++ version I believe. Are you organizing the bots in any way? Like in a grid?
-
It's not hard. I just don't want to take the perf hit when zoomed. Every little bit helps...
There is no positional bucketization code for bots in the VB fork presently. I may end up adding one for the Egrid, but right now, it doesn't exist.
-
I don't mean to lecture, but this strikes me as an instance of premature optimization. What sort of perf hit are we talking? 1%? Less? When you say that a feature will create a slight perf hit, most people probably imagine something like 3 to 7 % slower. If it's in the 1% to less range, I'd call it a negligable perf hit.
Right now you're probably doing a point vs. axis aligned bounding box collision test, right? When you probably want to be doing a circle vs. axis aligned bounding box collision test. How many extra calculations are required? I think it's on the order of maybe double for a naive test. Maybe less with a sophisticated algorithm. Maybe the SAT (http://www.harveycartel.org/metanet/tutorials/tutorialA.html).
Of course, it all takes time to implement, so if implementation time is the deciding factor instead of perf hits, that's another matter entirely.
-
Its four additional additions and comparisons per bot per cycle plus the drawing hit. The total imapct on perf is certainly less than 1% so it's not a big deal, but every little bit helps. Do people really care that they can't see bots that are more than half off the screen when zoomed? If people really care, I'd be happy to fix it generally.
-
I don't really care. Rubber borders work for me, and I don't usually keep track of particular bots to be troubled by their disappearance. And even if I did, I could always unlock the edges and see everything.
-
Do people really care...
Nope. Especially if it reduces performance, even just 1%. It may be too much when my sim is down to 0.1 cycles/sec.
-
Fixed in 2.43p. I fixed this in a general way. In all cases, zoomed or locked, all parts (skin, aim, etc.) of a bot are displayed for any visible bot, even those only partially visible.