<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=AI%3ADevelopment%3AMonitorAndDebug</id>
	<title>AI:Development:MonitorAndDebug - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=AI%3ADevelopment%3AMonitorAndDebug"/>
	<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=AI:Development:MonitorAndDebug&amp;action=history"/>
	<updated>2026-11-09T01:06:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=687&amp;oldid=prev</id>
		<title>Paulomorfeo at 21:59, 22 October 2014</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=687&amp;oldid=prev"/>
		<updated>2014-10-22T21:59:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:59, 22 October 2014&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=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;[[AI:Development|AI Development]] &amp;lt; AI Development - Monitor and Debug&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;[[AI:Development|AI Development]] &amp;lt; AI Development - Monitor and Debug&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;=How to monitor and debug your AI=&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;=How to monitor and debug your &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Skirmish &lt;/ins&gt;AI=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;You will probably want to monitor what&amp;#039;s is happening in the execution and need some form of debugging. This page describes a few options that can be implemented to monitor an AI.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;You will probably want to monitor what&amp;#039;s is happening in the execution and need some form of debugging. This page describes a few options that can be implemented to monitor an AI.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Paulomorfeo</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=686&amp;oldid=prev</id>
		<title>Paulomorfeo at 19:29, 22 October 2014</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=686&amp;oldid=prev"/>
		<updated>2014-10-22T19:29:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:29, 22 October 2014&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-l52&quot;&gt;Line 52:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 52:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;== Runtime debugging with the JDK/IDE  ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;== Runtime debugging with the JDK/IDE  ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;TODO: Don&amp;#039;t even know yet if this is possible or even how it interacts with the engine (will Spring crash or timeout waiting for a response from the Interface???).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;TODO: Don&amp;#039;t even know yet if this is possible or even how it interacts with the engine (will Spring crash or timeout waiting for a response from the Interface???).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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: AI Dev]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Paulomorfeo</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=685&amp;oldid=prev</id>
		<title>Paulomorfeo: Inception</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=685&amp;oldid=prev"/>
		<updated>2014-10-22T19:25:30Z</updated>

		<summary type="html">&lt;p&gt;Inception&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[AI:Development|AI Development]] &amp;lt; AI Development - Monitor and Debug&lt;br /&gt;
&lt;br /&gt;
=How to monitor and debug your AI=&lt;br /&gt;
You will probably want to monitor what&amp;#039;s is happening in the execution and need some form of debugging. This page describes a few options that can be implemented to monitor an AI.&lt;br /&gt;
&lt;br /&gt;
All code examples are using the Java interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Print a text message ingame ==&lt;br /&gt;
From the interface, you can request the &amp;quot;Game&amp;quot; object to &amp;quot;sendTextMessage&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
_Callback.getGame().sendTextMessage (...);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will display a text message to all players just like when a player hits &amp;quot;enter&amp;quot;, types something, then hits &amp;quot;enter&amp;quot; again.&lt;br /&gt;
&lt;br /&gt;
Whatever is sent to that method will show up in the game&amp;#039;s GUI but it will also end up logged in the engine&amp;#039;s log file. In Linux, it will be: &amp;lt;code&amp;gt;~/.config/spring/infolog.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Write to the engine&amp;#039;s log ==&lt;br /&gt;
You can access a &amp;quot;log&amp;quot; from the Interface and send messages to it.&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
_Callback.getLog ().log (msg);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Doing this .. appears to have the exact same effect as the previous option...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Write to a custom log ==&lt;br /&gt;
SpringRTS is built to run on a variety of different system (Linux, Windows and Mac), each with its own filesystems. Using the Interface you can obtain an appropriate path for the AI to create a log file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
String logFilePath = _Callback.getDataDirs ().allocatePath (&amp;quot;PI_P&amp;quot; + _TeamID + &amp;quot;.txt&amp;quot;, &lt;br /&gt;
								true, true, false, false);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would return a path like like: &amp;lt;code&amp;gt;/home/paulo/.config/spring/AI/Skirmish/PoucoInteligente/1/PI_P0.txt&amp;lt;/code&amp;gt; which you can use to create a log file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Draw a window ==&lt;br /&gt;
An extremely powerfull option to have visibility over what&amp;#039;s happening in the game in realtime is to draw whatever you want into another window. For example, create a JFrame window (Java) and draw into it a minimap of LineOfSight.&lt;br /&gt;
&lt;br /&gt;
The existing AI zkgbai has code which can be learnt from (or reused) to create a new separate window and to draw a minimap into it.&lt;br /&gt;
&lt;br /&gt;
The AI&amp;#039;s class &amp;quot;LosManager&amp;quot; draws a minimap of the LineOfSight, creating an &amp;quot;Image&amp;quot; object:&amp;lt;br&amp;gt;&lt;br /&gt;
https://github.com/Anarchid/zkgbai/blob/master/src/zkgbai/los/LosManager.java&amp;lt;br&amp;gt;&lt;br /&gt;
The AI&amp;#039;s class &amp;quot;DebugView&amp;quot; is the separate window itself and paints &amp;quot;Image&amp;quot; objects - the AI then creates a &amp;lt;code&amp;gt;new DebugView (...)&amp;lt;/code&amp;gt; and hands it over the desired images (like a LOS minimap).&amp;lt;br&amp;gt;&lt;br /&gt;
https://github.com/Anarchid/zkgbai/blob/master/src/zkgbai/gui/DebugView.java&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Runtime debugging with the JDK/IDE  ==&lt;br /&gt;
TODO: Don&amp;#039;t even know yet if this is possible or even how it interacts with the engine (will Spring crash or timeout waiting for a response from the Interface???).&lt;/div&gt;</summary>
		<author><name>Paulomorfeo</name></author>
	</entry>
</feed>