Robo Home | Changes | Preferences | AllPages


Is a team of 5 robots, 3 Slartibartfass and 2 Fatghost bots.

Great, I want to try it. Where can I download it?


Version rank raiting comment
0.1 - - "this team is slooooow! -- GrubbmGait"
0.2 20 1391.55 improved movement calculation speed
0.3 17 1514.0 movement debugging...
0.4 12 1616.2 basic movement is ready, gunnery is the next thing!
This basic movement is really good!! place 12 with a random gun, nice!
0.5 10 1657.34 Top 10 with the new basic gf-gun!! But still slow :(


I have a little problem: I have memory leak in my team bots. I suppose its the enemy and mate data stored in a ArrayList... IŽll have to delete it manually, but how? I can do it by using the onRobotDeat?/onWin, getRoundNum? and getNumRounds? functions if the battle runs to its end. But is there a way to detect an early end? (you can not overwrite the finaliese function) --Krabb

The finalize function couldn't be used for this anyway I think. Because there's no guarantee that function will ever be called. Or so I think I have read somewhere. Anyway, if you're sure its those lists you can maybe check the size of them when you add data and then delete stuff there if they grow too large. This is what I do in Ali. -- PEZ

The problem is not the size of that data, but the fact that the heap is full after a few matches. --Krabb

Just delete what you need to if( getRoundNum?() == 1 ). There is also onWin() and onDeath(), but be aware that onWin() is called before onRobotDeath?( robot ), so you risk throwing null pointers if you clean up too early, and likewise there may still be bullets in the air that you still need to dodge. -- Martin

First remark: this team is slooooow! I have not seen it in action though, just running the teamrumble. It occupies my cpu for 100% for quite some time, then suddenly drops to 10-20%. Later this evening (after Brazil-Croatia) I will watch some battles to check what is going on. -- GrubbmGait

Yea, its realy slow :) I have to improve some iterations... Dont bother to run the client, i'll run it myself this night. --Krabb

Slarti is still slow. I have no experiences in java performace. Can somebody give me an advice what is really slow and how i can improve it. I read somewhere that object instantiation is slow, should I try to do it at the start of each round? --Krabb

Instantiation is not particularly slow. Phoenix creates about several hundred Point objects per turn, I've watched it with a profiler. =) Since it's a team, I'd guess that's probably slowing you down is serialization and de-serialization. Trig is also somewhat slow, as are squareroots. Try making a team with no droids and team messages disabled, see how much faster it is. I'm betting it will be a dramatic difference. --David Alves

Yes, i think you are right, its mainly the serialization. In 1on1 and melee Slarti is skipping about 1.5% turns and in a team over 5%. But how can i increase the speed? Im sending the position of the bot, fired bullets and enemy Scans. Each of them in a seperate classes. Is it faster to send them all in one class? Or should i try to decrease the amount of send data? --Krabb

I'd say only send the positions of fired bullets. That should eliminate 90% of your team messages and I bet it won't hurt performance much, though you should test it to see how much it impacts performance. --David Alves

I don't want to kick my droids out of the team, they would be blind without any enemy/teammate information. But iŽll do some tests on sending less information...

EDIT: One more question: Is there a performace difference between
double d = e.getDistance();


I seriously doubt there's any noticeable performance gain in such a difference; in some cases, I think it even compiles to the exact same code, but I could be wrong about that. -- Voidious

One thing you can do pretty easily to increase performance (although only by a tiny bit) is use squared distances instead of normal ones. For example, instead of

Point2D.Double me, enemy, anotherEnemy;
if(me.distance(enemy) < 100) runAway();
if(me.distance(enemy) < me.distance(anotherEnemy)) switchTargets();
you can use
Point2D.Double me, enemy;
if(me.distanceSq(enemy) < 10000) runAway();
if(me.distanceSq(enemy) < me.distanceSq(anotherEnemy)) switchTargets();
square roots are slow, so the second version is a bit faster. Probably only worth it if it's inside a loop or something though. --David Alves

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited July 28, 2006 1:26 EST by David Alves (diff)