Mex built above and left of metal spot
Moderators: hoijui, Moderators
Mex built above and left of metal spot
Hello,
Got a tad excited when I found out about the spring project, been keeping an eye for something like this for a while.
Anyway I have a noob question so please forgive me if this is obvious.
So on unitFinished the economy manager i built makes a list of all the metal spots and then the method nearestMetalSpot gives returns a AIFloat3 value of the nearest metal spot.
I then give the command to my commander to build a mex, but the mex is always not on top of the metal spot, but placed diagonally top left of it.
I'm wondering in the metalspot position is the top left corner and the build position is the bottom right corner of the structure.
Would someone mind putting me right?
Thank you
Got a tad excited when I found out about the spring project, been keeping an eye for something like this for a while.
Anyway I have a noob question so please forgive me if this is obvious.
So on unitFinished the economy manager i built makes a list of all the metal spots and then the method nearestMetalSpot gives returns a AIFloat3 value of the nearest metal spot.
I then give the command to my commander to build a mex, but the mex is always not on top of the metal spot, but placed diagonally top left of it.
I'm wondering in the metalspot position is the top left corner and the build position is the bottom right corner of the structure.
Would someone mind putting me right?
Thank you
Re: Mex built up and left of metal spot
When SJ first introduced the engine, it was with an air to producing an XTA which deviated somewhat from OTA, in that he'd have energy webs of sort, and one of his changes, was metal radius, rather than metal spots.
The cosnequence of this si that a metal extractors output will depend on the values of the metalmap covered by its radius. People didnt like this resulting in metalmaps which had just spots and tiny radii to replicate OTA behaviour. You'll see metalmaps SJ style on maps such as brazillian battlefields.
So, now we know a metal extractor needs to be within range of a spot to extract, not built directly and only directly ontop, we come to the algorithm that reads in the metalmap grid and figures out where to place the extractors.
The best we have so far are variants of the algorithm devised originally for KAI.These place them to the upper left corner because that's a quirk of its algorithm. Press f4 however and you'll see that the extractor is still placed within range of the metal spot.
Because of this, any translation to fix this adjustment would be purely cosmetic, and some players and AIs deliberatly do this offsetting to exploit the mechanics, e.g. building a moho extractor on the spot while the metal extractor continues mining offsetted, so you dont loose income while building.
The cosnequence of this si that a metal extractors output will depend on the values of the metalmap covered by its radius. People didnt like this resulting in metalmaps which had just spots and tiny radii to replicate OTA behaviour. You'll see metalmaps SJ style on maps such as brazillian battlefields.
So, now we know a metal extractor needs to be within range of a spot to extract, not built directly and only directly ontop, we come to the algorithm that reads in the metalmap grid and figures out where to place the extractors.
The best we have so far are variants of the algorithm devised originally for KAI.These place them to the upper left corner because that's a quirk of its algorithm. Press f4 however and you'll see that the extractor is still placed within range of the metal spot.
Because of this, any translation to fix this adjustment would be purely cosmetic, and some players and AIs deliberatly do this offsetting to exploit the mechanics, e.g. building a moho extractor on the spot while the metal extractor continues mining offsetted, so you dont loose income while building.
Re: Mex built up and left of metal spot
Oh yeah, i just tried it and took control of a commander, built a mex right on top of a metal spot and it was producing 1.99, then resigned to examine the mexes the AI had built and likewise producing 1.99.
Thanks for the reply, i'll not worry about the cosmetics and crack on with the next bit.
Thanks again
Thanks for the reply, i'll not worry about the cosmetics and crack on with the next bit.
Thanks again
Re: Mex built up and left of metal spot
btw... are you using the Java AI-Interface or the (new) C++ AI Wrapper?
in both cases, there will be some (relatively big) changes in those when the next mayor version of spring comes out (0.83). You can see them, and changes required for them in AIs by looking at spring master branch already (we refer to changes as the pureint changes).
Just saying, cause you probably want to code for that right away, depending on your goals.
in both cases, there will be some (relatively big) changes in those when the next mayor version of spring comes out (0.83). You can see them, and changes required for them in AIs by looking at spring master branch already (we refer to changes as the pureint changes).
Just saying, cause you probably want to code for that right away, depending on your goals.
Re: Mex built up and left of metal spot
A new pureint sticky for the next release detailing changes?
Re: Mex built up and left of metal spot
>.< We need a lightning dance unicorn gif for stickies
Re: Mex built above and left of metal spot
lol, a lot of what you say goes right over my head! Sorry.
I have another question if that's okay?
My bot is working fine in the CA mod, but not the BA mod.
I think it's something to do with how i'm creating a command, like this...
then in another method which handles the commands this
I have another question if that's okay?
My bot is working fine in the CA mod, but not the BA mod.
I think it's something to do with how i'm creating a command, like this...
Code: Select all
AICommand command = new BuildUnitAICommand(this.commander, -1, new ArrayList<AICommand.Option>(), 10000, this.botFactory, pos, 0);
edit: sorry yes I am using the java interfaceint ret = this.clb.getEngine().handleCommand(AICommandWrapper.COMMAND_TO_ID_ENGINE, -1, command);
Re: Mex built above and left of metal spot
you should really come to the #ai channel in the lobby!
with the pureint changes (see link i posted above), the way commands work will change completely. commands will be integrated into the callback interface.
though, it is unlikely that it is the way you use commands, as this is not different between CA and BA. if something does not work, explain exactly what/how it does not work, and if it crashes, attach infolog.txt to your post.
with the pureint changes (see link i posted above), the way commands work will change completely. commands will be integrated into the callback interface.
though, it is unlikely that it is the way you use commands, as this is not different between CA and BA. if something does not work, explain exactly what/how it does not work, and if it crashes, attach infolog.txt to your post.
Re: Mex built above and left of metal spot
Thanks for your advice the other day.
I've altered my code so it build units based on UnitDef properties as opposed to unit name, which in case anyone was wondering is why my bot worked in CA and not BA - rookie mistake.
So i'm thinking about long term memory for my bot. Would something like an XML file be the easist way to store battle results or does Spring have a database i could hook into?
Hang
I've altered my code so it build units based on UnitDef properties as opposed to unit name, which in case anyone was wondering is why my bot worked in CA and not BA - rookie mistake.
So i'm thinking about long term memory for my bot. Would something like an XML file be the easist way to store battle results or does Spring have a database i could hook into?
Hang
Re: Mex built above and left of metal spot
there is a replays site, which.. i think.. also has a DB with the basic statistics (how many teams, who won, ...).
do not have link though.
do not have link though.
Re: Mex built above and left of metal spot
http://replays.adune.nl/ by Trademark
this is quite the lol too: http://knorke.net23.net/battlereports/
this is quite the lol too: http://knorke.net23.net/battlereports/
Re: Mex built above and left of metal spot
Wow, cool links. Although I was thinking of something for my bot to learn...true AI stylie. I'll figure it out...
Anyone know why the getMoveData() methods would cause spring to crash when applied to Air units?
I'm trying to make my bots build units based on their qualities, as opposed to their names, but after an airfactory has been built spring crashes. I know it's those lines of code cause when I comment them out and rebuild the bots work fine.
Hf
Anyone know why the getMoveData() methods would cause spring to crash when applied to Air units?
I'm trying to make my bots build units based on their qualities, as opposed to their names, but after an airfactory has been built spring crashes. I know it's those lines of code cause when I comment them out and rebuild the bots work fine.
Hf
Re: Mex built above and left of metal spot
always check for returned null pointers when making API calls
Re: Mex built above and left of metal spot
That's a fair comment and indicative of my desire to crack on with developing the AI element of the bot. I was simply returning the results to a log so I could examine the return values and were not to going to be apart of the final code.
But why does the getMoveData method not work for air type units?
But why does the getMoveData method not work for air type units?
Re: Mex built above and left of metal spot
I think its because of historical reasons in how Air movement is implemented, in that air relies on the unitdef values such as aeleron ( did I spell that right ) etc, to simulate aircraft movement, which is completely different to how ground units and movedefs work.
Error values in the API tend to take the form of null pointers being returned, or error positions, most notable the upvector constant float3(0,1,0). This is why one should be careful, and why basic AIs just starting out will give commands in the top left corner sometimes.
Maybe this post and one or two others should be separated out into a sticky on handling API error return values?
Error values in the API tend to take the form of null pointers being returned, or error positions, most notable the upvector constant float3(0,1,0). This is why one should be careful, and why basic AIs just starting out will give commands in the top left corner sometimes.
Maybe this post and one or two others should be separated out into a sticky on handling API error return values?
Re: Mex built above and left of metal spot
if spring crashes while using the Java AI API, it is likely a bug of spring/the AI Interface. in spring, move-data is something that air units do not have, but the crash should not happen of course, but null should be returned.
It is quite likely that this is fixed in pureint changes though, so again.. i encourage you to use spring master (unstable), instead of current release.
It is quite likely that this is fixed in pureint changes though, so again.. i encourage you to use spring master (unstable), instead of current release.
Re: Mex built above and left of metal spot
You guys seem to have you own language or something
i've been on the thread that discusses the pureint changes and there's nothing to download or links to a page that allows you to download the pureint version.
Of course I have been to the download page and can only see that I can download the current stable version.
@AF I can't remember if I thanked you for your answer, it was helpful. I guess because Spring is constantly evolving there are dead ends and pit falls that I need to be more careful about.
Finally can anyone help me with a quandry?
Here's a very simple build command
I understand that this parameter can be used to simulate a shift click or alt click. But how?
Cya HF

i've been on the thread that discusses the pureint changes and there's nothing to download or links to a page that allows you to download the pureint version.
Of course I have been to the download page and can only see that I can download the current stable version.
@AF I can't remember if I thanked you for your answer, it was helpful. I guess because Spring is constantly evolving there are dead ends and pit falls that I need to be more careful about.
Finally can anyone help me with a quandry?
Here's a very simple build command
Code: Select all
AICommand command = new BuildUnitAICommand(this.unit, -1, new ArrayList<AICommand.Option>(), 10000, solar, pos, 0);
Code: Select all
new ArrayList<AICommand.Option>()
Cya HF
Re: Mex built above and left of metal spot
join the channel i told you in the lobby, and ask for help there.
this is the currently latest master build (installer), and it contains pureint changes.
you might encounter random bugs of course, as they are more common in the master build then in release versions.
this is the currently latest master build (installer), and it contains pureint changes.
you might encounter random bugs of course, as they are more common in the master build then in release versions.
Re: Mex built above and left of metal spot
I've been in the channel tonnes of times.
Usually there's one or two people in there and getting a reply takes about 10 minutes and usually I'm at work most of the day.
Why, what's wrong with asking questions on a forum? At least that way there's an audit trail so if other people have the same/similar questions they might get the answer by reading the thread.
Ah well, i'll just struggle on and see how far I get.
Usually there's one or two people in there and getting a reply takes about 10 minutes and usually I'm at work most of the day.
Why, what's wrong with asking questions on a forum? At least that way there's an audit trail so if other people have the same/similar questions they might get the answer by reading the thread.
Ah well, i'll just struggle on and see how far I get.