eronoobos / BABAR-The-Shardifant

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

Assist behaviour strength weaknesses and guidelines #21

Open pandaro opened 8 years ago

pandaro commented 8 years ago

i open this issues for you, i read assistbehaviour a tons of time and i reach a discrete handling in the past. Now i will know (very calmly and without haste) what are the scheme behind assistbehaviour, what the concept and how to manage. For me is not bad at all. One particular issues: i notice that in the second half of the game, when there are to much builders, the game slowdown cause all builders help and a little number build. My idea is: under certain condition( for example lots of metal and energy incoming and full resource storage and advanced factory builded and and and what do you want) the managment of assister change, and is so handled: if metal full < 0.3 and Energy full < 0.3 force to much builder to assist (and leave one per type able to build stuff) if metal full > 0.7 and Energy full > 0.7 force to much assister to build stuff ( and leave to much builders free to build stuff) in the middle use for assisting the strictly required number called by getHelp

eronoobos commented 8 years ago

i notice that in the second half of the game, when there are to much builders, the game slowdown cause all builders help and a little number build

Yes! One of the nasty side effects is that the AI is very slow to expand to available metal spots in the latter half of the game.

if metal full < 0.3 and Energy full < 0.3 force to much builder to assist (and leave one per type able to build stuff)

I don't think this is the right condition for more assistance. If metal is low, don't we need more mexes, in other words more builders and less assistance? And if resources are low, more assistance does nothing because the amount of resources the construction units can use far exceeds the amount available to them.

I definitely agree that the number of assisters vs builders needs to be managed differently.

pandaro commented 8 years ago

@eronoobos as i say in the head this is my first approach,i start to manage assist system to take confidence with it. So i need help to ensure me to work in the right way. My intention is to re-handle a bit the number of assister in the battle.

IDEAS: 1-differentiate the max assist per name in base on certain condition 1.1 number of already builded unit of a type / max buildable of a type( if i have build only 5/10 i can use only a minor part of it) 1.2 economic condition ( atm i think about the equilibrium of the resource(hi metal and low energy = many assister) 1.3 level of builders(hi leveled can assist in minor percentage).As an aside: Adv builders can assist? 1.4 total available builder: if hi then we can assist with more unit 1.5 type of unit: the unit that can help the needswater factory must assist factories more then other

so the major question are: using function AssistHandler:Release(builder, bid, dead) is the right way to remove an assist from assistants and make it available for other behaviour?

and in general what do you think about this work? is a good approach at moment?

eronoobos commented 8 years ago

using function AssistHandler:Release(builder, bid, dead) is the right way to remove an assist from assistants and make it available for other behaviour?

As it says in the comment above the function, AssistHandler:Release(builder, bid, dead) releases assistants from the specified builder (with either unitID bid or engineUnit builder). self:Release(self.free[fi].unit:Internal()) probably isn't doing what you want, because anything in self.free is an active assistant. If it's an active assistant, nothing is assisting it.

eronoobos commented 8 years ago

As an aside: Adv builders can assist?

things in `advConList don't get an assistbehaviour, because I felt it was unnecessary. Using them to assist seems like a waste to me, except possibly in the very very late game.

eronoobos commented 8 years ago

Huh. Apparently, whether an assistant is active is entirely determined by ai.nonAssistant[self.id]. And that is set by... assistbehaviour, assisthandler, and taskqueuebehaviour? I don't fully understand what I wrote years ago.

eronoobos commented 8 years ago

you have good ideas of how to change assisthandler, but there are some problems with your implementation

eronoobos commented 8 years ago

I think i might've messed something up in a commit not long ago? Because i don't remember assistant management being this bad. Right now, in the early game I see 4 construction bots assisting the factory, and only one out doing anything!

edit: Never mind. I don't think anything has changed, but the algorithm for deciding how many non assistants really is terrible. Confirms that your rethinking is needful.

pandaro commented 8 years ago

with calm, i work to fully understand the handler

1-big mystery is function AssistHandler:AssignIDByName(asstbehaviour) what must be done this function? 2-self.IDByNameTaken are a list with the units to assist and relative assister atm?

and if i understand correct: self.free contain assister available to assist but not assisting atm self.working contain the units that the assisters assist self.ai.nonAssistant: if true is a builders, if nil the unit dont build but can assist

sorry for boring you

eronoobos commented 8 years ago

It gives the asstbehaviour an ID among the same type of unit. The ID number will not be higher than the number of units of that type. This is how ai.nonAssistant assigns unit IDs (confusingly, the actual Spring unit ID, not the ID by name/type). It just checks if the ID by name/type is above the number of nonassistants per type. It does this within AssignIDByName, after an ID has been found.

    if self.ai.IDByName[asstbehaviour.id] > self.ai.nonAssistantsPerName then
        self.ai.nonAssistant[asstbehaviour.id] = nil
    else
        self.ai.nonAssistant[asstbehaviour.id] = true
    end

you're not boring me, just making me realize how convolutedly i wrote assisthandler.

eronoobos commented 8 years ago

self.working has keys of the unit IDs of builders that the assisters are assisting, and each value is a list of the assistant behaviours assigned to assist that builder.