<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://robowiki.net/w/index.php?action=history&amp;feed=atom&amp;title=User%3AWompi%2FGraphicDebugRobotPath</id>
	<title>User:Wompi/GraphicDebugRobotPath - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://robowiki.net/w/index.php?action=history&amp;feed=atom&amp;title=User%3AWompi%2FGraphicDebugRobotPath"/>
	<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=User:Wompi/GraphicDebugRobotPath&amp;action=history"/>
	<updated>2026-04-20T09:17:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://robowiki.net/w/index.php?title=User:Wompi/GraphicDebugRobotPath&amp;diff=24263&amp;oldid=prev</id>
		<title>Wompi: link fixed</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=User:Wompi/GraphicDebugRobotPath&amp;diff=24263&amp;oldid=prev"/>
		<updated>2012-05-11T10:51:57Z</updated>

		<summary type="html">&lt;p&gt;link fixed&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 10:51, 11 May 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[File:2012-05-11T12.25.23.008.png|&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;200px&lt;/del&gt;|thumb|left|Robot Path Debug]] To me it's very useful to see how my bots move on the battle field and so i wrote a graphical debug class to visualize this. The class can be implemented with just one call to every robot and can show the own and aswell the target movement. Every target can have its own color. Its written with melee battles in mind but works for 1vs1 too.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/ins&gt;[File:2012-05-11T12.25.23.008.png|&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;100px&lt;/ins&gt;|thumb|left|Robot Path Debug]] To me it's very useful to see how my bots move on the battle field and so i wrote a graphical debug class to visualize this. The class can be implemented with just one call to every robot and can show the own and aswell the target movement. Every target can have its own color. Its written with melee battles in mind but works for 1vs1 too.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Just call within your robot:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Just call within your robot:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l72&quot; &gt;Line 72:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 77:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Code Snippets]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wompi</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=User:Wompi/GraphicDebugRobotPath&amp;diff=24262&amp;oldid=prev</id>
		<title>Wompi: graphic debug robot path</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=User:Wompi/GraphicDebugRobotPath&amp;diff=24262&amp;oldid=prev"/>
		<updated>2012-05-11T10:45:08Z</updated>

		<summary type="html">&lt;p&gt;graphic debug robot path&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[File:2012-05-11T12.25.23.008.png|200px|thumb|left|Robot Path Debug]] To me it's very useful to see how my bots move on the battle field and so i wrote a graphical debug class to visualize this. The class can be implemented with just one call to every robot and can show the own and aswell the target movement. Every target can have its own color. Its written with melee battles in mind but works for 1vs1 too.&lt;br /&gt;
&lt;br /&gt;
Just call within your robot:&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
	public void onScannedRobot(ScannedRobotEvent event)&lt;br /&gt;
        {&lt;br /&gt;
                 ..... &lt;br /&gt;
                double eX = getX() + Math.sin(getHeadingRadians() + event.getBearingRadians())*event.getDistance(); &lt;br /&gt;
                double eY = getY() + Math.cos(getHeadingRadians() + event.getBearingRadians())*event.getDistance(); &lt;br /&gt;
		PaintRobotPath.onPaint(getGraphics(), event.getName(), getTime(), eX, eY, Color.YELLOW);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
       // or for your own robot&lt;br /&gt;
	public void onPaint(Graphics2D g)&lt;br /&gt;
	{&lt;br /&gt;
		PaintRobotPath.onPaint(g, getName(), getTime(), getX(), getY(), Color.GREEN);&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
package wompi.misc.painter;&lt;br /&gt;
&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.awt.Graphics2D;&lt;br /&gt;
import java.awt.geom.GeneralPath;&lt;br /&gt;
import java.util.HashMap;&lt;br /&gt;
&lt;br /&gt;
public class PaintRobotPath &lt;br /&gt;
{&lt;br /&gt;
	static HashMap&amp;lt;String, PathHelper&amp;gt; pathMap = new HashMap&amp;lt;String, PathHelper&amp;gt;();&lt;br /&gt;
	static long lastTime;&lt;br /&gt;
	&lt;br /&gt;
	public static void onPaint(Graphics2D g,String botName, long time, double xRobot,double yRobot, Color pathColor)&lt;br /&gt;
	{&lt;br /&gt;
		if (lastTime &amp;gt; time) pathMap.clear();  // new battle reset&lt;br /&gt;
		lastTime = time;&lt;br /&gt;
		&lt;br /&gt;
		PathHelper myPath = pathMap.get(botName);&lt;br /&gt;
		if (myPath == null)&lt;br /&gt;
		{&lt;br /&gt;
			myPath = new PathHelper();&lt;br /&gt;
			myPath.rName = botName;&lt;br /&gt;
			myPath.rPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 2000); &lt;br /&gt;
			myPath.rPath.moveTo (xRobot, yRobot);&lt;br /&gt;
			myPath.rColor = pathColor;&lt;br /&gt;
			pathMap.put(botName, myPath);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if (time - myPath.rTime &amp;gt;= 5)  // thin out the path  &lt;br /&gt;
		{&lt;br /&gt;
			myPath.rPath.lineTo(xRobot,yRobot);&lt;br /&gt;
			myPath.rTime = time;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		for (PathHelper helper : pathMap.values()) &lt;br /&gt;
		{&lt;br /&gt;
			if ((time - helper.rTime) &amp;gt;= 30) continue;   // dead robots fade away after 30 turns&lt;br /&gt;
			g.setColor(helper.rColor);		&lt;br /&gt;
			g.draw(helper.rPath);				&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class PathHelper&lt;br /&gt;
{&lt;br /&gt;
	GeneralPath rPath;&lt;br /&gt;
	String rName;&lt;br /&gt;
	Color rColor;&lt;br /&gt;
	long rTime;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wompi</name></author>
		
	</entry>
</feed>