View topic - Java AI interface: Where is the path finding?



All times are UTC + 1 hour


Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 26 Dec 2010, 17:03 

Joined: 11 Jul 2009, 13:03
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?


Top
 Offline Profile  
 
PostPosted: 26 Dec 2010, 20:22 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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:
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:
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


Top
 Offline Profile  
 
PostPosted: 26 Dec 2010, 22:34 

Joined: 11 Jul 2009, 13:03
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?

Quote:
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!


Top
 Offline Profile  
 
PostPosted: 26 Dec 2010, 22:46 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
0.83 is still quite some ahead, speaking of months. there will still be at least one more 0.82 release before that.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.