<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.fightorder.net/wiki/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://www.fightorder.net/wiki/index.php?action=history&amp;feed=atom&amp;title=AI%3ADevelopment%3AMonitorAndDebug"/>
	<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=AI:Development:MonitorAndDebug&amp;action=history"/>
	<updated>2026-04-21T05:43:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=1580&amp;oldid=prev</id>
		<title>Qrow: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=1580&amp;oldid=prev"/>
		<updated>2026-02-24T06:08:39Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:08, 23 February 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Qrow</name></author>
	</entry>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=1579&amp;oldid=prev</id>
		<title>interaidev&gt;Paulomorfeo at 21:59, 22 October 2014</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=AI:Development:MonitorAndDebug&amp;diff=1579&amp;oldid=prev"/>
		<updated>2014-10-22T21:59:51Z</updated>

		<summary type="html">&lt;p&gt;&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 Skirmish 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;br /&gt;
&lt;br /&gt;
[[Category: AI Dev]]&lt;/div&gt;</summary>
		<author><name>interaidev&gt;Paulomorfeo</name></author>
	</entry>
</feed>