Java AI interface: Where is the path finding?

Java AI interface: Where is the path finding?

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
meriton
Posts: 18
Joined: 11 Jul 2009, 14:03

Java AI interface: Where is the path finding?

Post by meriton »

I'd like to get approximate travel times to specific map positions. Since the engine has a decent path finder, I'd rather query it than reinvent the wheel. How can I do this through the Java API?

Full-text search through AIInterface.jar has revealed several promising looking methods such as

com.springrts.ai.JniAICallback.Pathing_getApproximateLength(float[], float[], int, float)

but AIInterface-src.jar contains no source code for this class. Is that class deprecated ...? If not, how do I use it?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI interface: Where is the path finding?

Post by hoijui »

just in case you do not know already, there will eb a mayor re-fracture introduced in the (Java) AI Interface in the next mayor release (0.83.x).
You can read about it here:
http://springrts.com/phpbb/viewtopic.php?f=15&t=24114

for current release:
in AIInterface-src.jar, have a look at /com/springrts/ai/command/. You can issue these commands through:

Code: Select all

ooAiCallback.getEngine().handleCommand(...);

	/**
	 * Whenever an AI wants to change the engine state in any way,
	 * it has to call this method.
	 * In other words, all commands from AIs to the engine (and other AIs)
	 * go through this method.
	 * 
	 * @param teamId       the team number of the AI that sends the command
	 * @param toId         the team number of the AI that should receive
	 *                     the command, or COMMAND_TO_ID_ENGINE if it is addressed
	 *                     to the engine
	 * @param commandId    used on asynchronous commands, this allows the AI to
	 *                     identify a possible result event, which would come
	 *                     with the same id
	 * @param commandTopic unique identifier of a command
	 *                     (see COMMAND_* defines in AISCommands.h)
	 * @param commandData  a commandTopic specific struct, which contains
	 *                     the data associated with the command
	 *                     (see *Command structs)
	 * @return     0: if command handling ok
	 *          != 0: something else otherwise
	 */
	public int handleCommand(int toId, int commandId, AICommand command)
have a look at HughAI source for more details:
https://github.com/hughperkins/HughAI
meriton
Posts: 18
Joined: 11 Jul 2009, 14:03

Re: Java AI interface: Where is the path finding?

Post by meriton »

Hey, you're exactly the person I was looking for :-)

Thanks for pointing out the pureint merge again. Since there has been a release since your announcement, I was under the mistaken impression it would already contain the change.

When is 0.83 scheduled to be released? In the meantime, is there a current binary release (for Windows) of spring I could use?
have a look at /com/springrts/ai/command/
Ah, I didn't think a request for information could be a command because I didn't see any way for it to return the requested information - I didn't occur to me it might be written into the command itself. Thanks for pointing me in the right direction!
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI interface: Where is the path finding?

Post by hoijui »

0.83 is still quite some ahead, speaking of months. there will still be at least one more 0.82 release before that.
Post Reply

Return to “AI”