FAQ
Configuration
- I don't find my AI or map in the list!
-
All usable AI according to the path configuration are in the configuration list. If you do not find yours, that can have several causes:
- Check the Errors... button in the configuration wizard. If it is enabled, errors have occured during classes loading and it will provide useful information to understand the causes.
- Check that you have properly configured the searching path. Only binaries (
.class
files) are supported: check your folder or.jar
file does not only contains source code. - Check that paths containing your classes are activated: check box in the list must be selected.
- A valid AI or map class must be
public
, notabstract
and must have apublic
default constructor (ie a constructor without arguments, it is implicitly defined if no explicit constructors are declared).
In-game
- My AI destroyed itself!
-
An AI is automatically destroyed by the game in three cases:
- If an exception is thrown by the AI at initialization (in method
Intelligence.initialisation()
). - If the AI exceeds time limit during a turn (in method
Intelligence.nouveauTour()
). The time limit per turn can be retrieved (in nanoseconds) thanks to the constantRegles.TEMPS_MAXIMUM_REFLEXION
. - If the unit hits a wall or map edges (see this answer for more information).
- If an exception is thrown by the AI at initialization (in method
- Why does my AI do nothing while it should?
-
Generally, that happens when an AI does not catch an exception. If an exception is uncaught, the game engine catch and register it with additionnal information such as turn, source unit, etc. Unfortunately, exceptions thrown by the AI are not shown by all renderers. If you only use the GL renderer, exceptions are catch silently. If you want to see exceptions generated by AI, you should use "Analyse" or "Console" renderers which print exceptions.
If you forget to do this and you do not want to miss those exceptions, you can save the game. Next, you can enable appropriate renderers and load the saved game: thrown exceptions have been saved.
-
I don't understand why my AI throws
java.lang.SecurityException
? -
Since AI and maps are classic Java classes, it is dangerous to execute them with an unlimited access to the system. That is why AI and maps are executed in a sandbox with limited privileges. They have basically the same restriction than a Java applet, and cannot:
- Create, modify or run a thread (all critical methods in
java.lang.Thread
andjava.lang.ThreadGroup
are restricted). - Write to the disk
- Create or use a socket
- Create a
java.lang.ClassLoader
- Use reflection API (
java.lang.reflect
classes or somejava.lang.Class
methods are restricted) to invoke non-public
methods or fields.
You can refer to the JDK documentation to know all critical methods which can throw a
SecurityException
. For an AI or a map, they practically all throw an exception.While debugging, you might want to write directly to the disk or use threads. It is thus possible to desactivate this security mechanism. In the launching window, you can enable the options Disable security during external binaries loading and Disable security during external binaries execution. You can also append the options
--no-loading-check
and--no-execution-check
on the command line.SECURITY WARNING! If you disable security options, you should not use AI or maps from an untrusted source as they could damage your computer.
- Create, modify or run a thread (all critical methods in
Game rules
- My unit had plenty of life but died of hitting a wall / map edge!
-
In Galaxiia, hitting a wall leads to instant death for any unit. It is the same with map edges.
- Walls
For instance, you can use
Outils.distanceMurPlusProche()
method to know at which distance is a point from the nearest wall or map edge.