eronoobos / BABAR-The-Shardifant

Balanced Annihilation & Balanced Annilhation Reloaded configuration for Shard
2 stars 1 forks source link

builders abandon builds after few moment #9

Closed pandaro closed 8 years ago

pandaro commented 8 years ago

i noticed that some level 1 builders(specially lv1 air) abandon to build things after few moment, try with the sailaway map

eronoobos commented 8 years ago

it has been driving me insane.

it could be some kind of duplication, like two ShardSpringUnit assigned to one unitID, or two behaviours assigned to one unit

pandaro commented 8 years ago

this bug don't exist in the non shardSpringLuaAi version? maybe the insane target problem have the same origin?

eronoobos commented 8 years ago

i doubt it's the same origin, because the targetting problem has to do with two ShardSpringLua teams in the same game. this issue with abandoning construction happens regardless of enemy teams. but yes, they are both bugs only with the Lua AI

pandaro commented 8 years ago

or two behaviours assigned to one unit

two time the same bhaviour? or two different behaviour that work at same time?

i cant understand how to self.constructing is not true... and in where is called taskqueuebehaviour:constructionBegun() that i cant see

eronoobos commented 8 years ago

two different behaviours working at the same time. actually i don't think this is happening, but i should test to rule it out. would just need to print to the console every time the behaviour inits, with its associated unitID.

yeah. the timing seems like constructionBegun() is never called, so the unit just moves on to the next thing. but i see that buildsitehandler is removing the build plan rectangles and replacing them with "don't build here" rectangles, just like it should be doing.

eronoobos commented 8 years ago

i'm making some progress. constructionBegun() isn't being called because buildsitehandler doesn't recognize that it was planned by anyone. haven't found out why yet. i'm guessing it will be some decimal or rounding mismatches in coordinates

eronoobos commented 8 years ago

nope, it's a timing problem:

[f=0026089] unplanned building creation armmakr 4179 424, 296
[f=0026089] armcv 25378 successful build command for armmakr
[f=0026089] BuildSiteHandler Plans: armcv plans to build armmakr at 424, 296

somehow unit creation happens in the same frame as the build command, and before the build command is even issued? how is this possible?

eronoobos commented 8 years ago

okay this is bizarre to me. i had the AILoader gadget print when it received a build command and when a unit was created, and here are the results:

[f=0009370] armcv, 28129, received command to build, tawf001
[f=0009370] tawf001, 30635, created
[f=0009370] unplanned building creation tawf001 30635 224, 1712
[f=0009370] armcv 28129 successful build command for tawf001
[f=0009370] BuildSiteHandler Plans: armcv plans to build tawf001 at 224, 1712

how is the command received by the gadget before taskqueuebehaviour prints to the console that it sent the command?

i guess the whole thing is more real-time than i had imagined. i thought that in a lua gadget/widget, one callin was completed before another. apparently not. the solution is: taskqueuebehaviour needs to send buildsitehandler planned construction information before the build command is actually issued.

eronoobos commented 8 years ago

https://github.com/eronoobos/BABAR-The-Shardifant/commit/97faac4c8f860f309bb1816dd39e04f05e427827

(obviously reopen if this doesn't fix it)

pandaro commented 8 years ago

so sorry, this commit don't fix. I try to help you but i must raise my level and search in the shard lua ai config,very complicated..

pandaro commented 8 years ago

reopen please

eronoobos commented 8 years ago

what are the new circumstances for this bug happening in your tests? i can't reproduce the bug with the above commit

pandaro commented 8 years ago

sailawai map air builders are urggggggggg

eronoobos commented 8 years ago

what are they doing? i'm trying sailaway, and the air builders seem to be fine? it's strange that taskqueuebehaviour starts progressing through the queue before the builder is out of the factory, but it doesn't matter

edit: it does matter, but it doesn't affect this issue

pandaro commented 8 years ago

no wait, i just rebuild shardluaai by fallow the instructions and the error is alive, on sailaway the builders abbandoning build or a'm stupid, if you want, cause sometimes i'm dummyUnitMan you can suspend to work on this but leave the issues open, if im sure be close or open i update the issues

pandaro commented 8 years ago

ok i have understand why your fix wont work for me: i rebuild all shard but your commit is not on my local if i use the guide here if i just paste copy from my local repo it work :+1: so close this one and open issues to fix 'guide dont work correctly?'

eronoobos commented 8 years ago

the guide probably doesn't work because https://github.com/eronoobos/BAR-Shard-LuaAI doesn't have an up-to-date submodule. in development it would be best to just pull in the new changes, or since you have a fork, https://help.github.com/articles/configuring-a-remote-for-a-fork/ https://help.github.com/articles/syncing-a-fork/