Git Product home page Git Product logo

Comments (2)

DrInfy avatar DrInfy commented on July 21, 2024

As a point of view from history, first iteration of the micro had things like MicroBack, MicroForward, FocusFire and RegroupUnits etc. This is pretty close to what you are suggesting.

Now the problem with that was that it started to get extremely hard to keep track what step in the chain does what and if there is a bug, which of these steps is causing the issues.

In the current version the only and best way to implement custom micro is to replace individual unit micro classes.

i.e.

self.knowledge.group_combat_manager.micros[UnitTypeId.ROACH] = MyRoachMicro()

I haven't written the wiki pages for this, because I'm not happy with this solution.
What I am thinking now, is to have a class that contains the basic rules for micro. Let's call it MicroRules. Combat manager would have the current settings as default, but the user could use his own set of Rules by giving them in command execute like this combat_manager.execute(pos, MoveType.Assault, my_micro_rules) Or you could write whatever you'd like in the default Rules. I think it is important for users to be able to temporarily set a different kind of micro for example to your flanking units without the need to mess up with your main army logic.

Thanks for the feedback as that really helps to understand the needs better.

from sharpy-sc2.

DrInfy avatar DrInfy commented on July 21, 2024

Drafting something like this now:

class MicroRules:
    regroup_func: Callable[[Point2, List[CombatUnits], MoveType], None]
    focus_fire_func: Callable[[MicroStep, Unit, Action, Optional[Dict[UnitTypeId, int]]], Action]
    melee_focus_fire_func: Callable[[MicroStep, Unit, Action, Optional[Dict[UnitTypeId, int]]], Action]
    ready_to_shoot_func: Callable[[MicroStep, Unit], bool]
    init_group_func: Callable[[MicroStep, CombatUnits, Units, List[CombatUnits], MoveType], None]

    def __init__(self) -> None:
        self.regroup = True
        self.unit_micros: Dict[UnitTypeId, MicroStep] = dict()
        self.regroup_threshold = 0.75
        # How much distance must be between units to consider them to be in different groups, set to 0 for no grouping
        self.own_group_threshold = 7

from sharpy-sc2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.