I using Java for write AI. I using function 'clb.getMap().getStartPos()' for get info about start point to AI. But I found that if start pos set as 'box' mode then this return left-top cornier of boxes. How get start pos type and box square?
And I found description about function 'clb.getGame().sendStartPosition(boolean ready, AIFloat3 pos)' but don't undestand how use it. From where method I can call this function update, init, message(int player, String message)? How it work?
I want say to bot in point message where he will be start and they start on this point.
Java AI: choose start point
Moderators: hoijui, Moderators
Re: Java AI: choose start point
It doesn't work and it can't work because your bot gets its Init() when and only when the game starts.
And it's too late by then.
Sorry.
I'd love to pick my own startpos, too.
This is how you would be using it if it worked.
And it's too late by then.
Sorry.
I'd love to pick my own startpos, too.
And I found description about function 'clb.getGame().sendStartPosition(boolean ready, AIFloat3 pos)' but don't undestand how use it
Code: Select all
AIFloat3 position = getStartPosition(); // self-implemented function to pick best spot
this.callback.sendStartPosition(true, position);
Re: Java AI: choose start point
Struggling the same issue.
I see next options to solve it:
1) Create and initialize NativeAI before NETMSG_STARTPLAYING (rts/Net/NetCommands.cpp) occurs. Couldn't find in code exact position to move init yet, still looking.
And when choose position stage occurs - send EVENT_CHOOSEPOS to localIAs.
2) Write some magic unsynced Lua that has to know which players are local native AIs. Somewhere during LuaAI initialization stage it has to compute and send NETMSG_STARTPOS for each local native AI.
2nd aproach is something of sience fiction to me because i have no idea about Lua capabilities, APIs. And its not good to have Lua part when i want to write NativeAI :)
1st method requires engine modification, 2nd (if its even possible) - presumably not.
Any thoughts or suggestions?
I see next options to solve it:
1) Create and initialize NativeAI before NETMSG_STARTPLAYING (rts/Net/NetCommands.cpp) occurs. Couldn't find in code exact position to move init yet, still looking.
And when choose position stage occurs - send EVENT_CHOOSEPOS to localIAs.
2) Write some magic unsynced Lua that has to know which players are local native AIs. Somewhere during LuaAI initialization stage it has to compute and send NETMSG_STARTPOS for each local native AI.
2nd aproach is something of sience fiction to me because i have no idea about Lua capabilities, APIs. And its not good to have Lua part when i want to write NativeAI :)
1st method requires engine modification, 2nd (if its even possible) - presumably not.
Any thoughts or suggestions?
Re: Java AI: choose start point
Made implementation of 1st method. It occurs much easier than i thought (if i didn't broke anything, but tests were good). And there was no need for separate EVENT_CHOOSEPOS, just init earlier.
Will submit a pull request in the near future.
Will submit a pull request in the near future.
Re: Java AI: choose start point
Please sign here to accept your shipment of massive kudos.
Re: Java AI: choose start point
X
signed. Kudos, kudos, kudos, kudos, cookies, kudos, kudos.
Pushed pull request into spring's pool. Awaiting approval/denial.
https://github.com/spring/spring/pull/118
signed. Kudos, kudos, kudos, kudos, cookies, kudos, kudos.
Pushed pull request into spring's pool. Awaiting approval/denial.
https://github.com/spring/spring/pull/118