Git Product home page Git Product logo

sharpy-sc2's Issues

Void Rays are losing DPS because they stutter step

Measure dps when stutter stepping and calculate much dps is lost by stuttering and how much the voidray can move while doing so.

Void rays should still move when they are in a bad position, but they should only reposition when a clearly better position is available in order to maximize damage.

Cyclone bot crashes

Describe the bug
Cyclone bot crashes when I try to run it.

To Reproduce

  1. Run py run_custom.py -p1 cyclone
  2. Observe crash
ERROR:sc2.main:AI on_start threw an error
Traceback (most recent call last):
  File "python-sc2\sc2\main.py", line 115, in _play_game_ai
    await ai.on_start()
  File "C:\Dev\sc2\sharpy-sc2\sharpy\knowledges\knowledge_bot.py", line 97, in on_start
    await self.real_init()
  File "C:\Dev\sc2\sharpy-sc2\sharpy\knowledges\knowledge_bot.py", line 35, in real_init
    self.plan = await self.create_plan()
  File "C:\Dev\sc2\sharpy-sc2\dummies\terran\cyclones.py", line 58, in create_plan
    ActTech(UpgradeId.TERRANVEHICLEANDSHIPARMORSLEVEL1),
  File "C:\Dev\sc2\sharpy-sc2\sharpy\plans\acts\act_tech.py", line 34, in __init__
    from_building = UPGRADE_RESEARCHED_FROM[self.upgrade_type]
KeyError: UpgradeId.TERRANVEHICLEANDSHIPARMORSLEVEL1

Expected behavior
A game should run.

Version

> git last
commit 88e9287bd63caae6fc342f0eb0278d1d55355919 (HEAD -> develop, origin/develop)

only_once optional parameter for BuildAddon()

BuRny:

i think an only_once optional parameter for BuildAddon() would be good, with the addon swaps, otherwise it gets stuck in a sequential build order if a barracks has a reactor but should build a techlab

Rename acts and requirements to be simpler

Is your feature request related to a problem? Please describe.
Build orders are needlessly verbose and some of them are obvious without the need to have Required or Act in the name.

Describe the solution you'd like

Rename and deprecate old

ActBuildAddon -> BuildAddon
ActDefensiveCannons -> DefensiveCannons
ActExpand -> Expand
ActTech -> Tech
ActWarpUnit -> WarpUnit
ChronoUnitProduction -> ChronoUnit
RequiredEnemyBuildingExists -> EnemyBuildingExists
RequiredEnemyUnitExistsAfter -> EnemyUnitExistsAfter
RequiredAny ->Any
RequiredAll -> All
RequiredUnitReady -> UnitReady
RequiredMinerals -> Minerals
RequiredGas -> Vespene
RequiredCount -> Count
RequiredEnemyBases -> EnemyBases
RequiredSupply -> Supply
RequiredSupplyLeft -> SupplyLeft
RequiredTechReady -> TechReady
RequiredTime -> Time
RequiredTotalUnitExists -> TotalUnitExists
StepBuildGas -> BuildGas (Remove Step functionality)

Deprecate

RoboUnit
GateUnit
StarUnit
RequiredLessUnitExists

Delete

RequiredTotalUnitExists
ActMany
RequiredLessUnitExists

Disruptor shot improvements

Disruptor shots will stop in the middle of own army if no enemy is seen, shots should instead continue in the direction the were going to in the first place.

Make sharpy compatible with multiple SC2 versions

somewhere should be a function called ping

Version can be get from the ping. Make some hacks in ActUpgrade to skip upgrades that don't exist in 4.10.

Reconfigure ALL_GAS in python-sc2 to ids in 4.10

flake8 ignores exclude configuration when used through pre-commit hooks

Describe the bug
When sharpy-sc2's pre-commit hooks are installed, flake8 will ignore excludes configured in .flake8 file.

This is by design, and pre-commits exclude should be used instead.

Checked-in python files will be passed as positional arguments. flake8 will always lint explicitly passed arguments (flake8 --exclude has no effect). Instead use pre-commit’s exclude: ... regex to exclude files. pre-commit won’t ever pass untracked files to flake8 so excluding .git / .tox / etc. is unnecessary.

https://flake8.pycqa.org/en/latest/user/using-hooks.html

Expected behavior
Flake8 should work in similar way, whether launched with eg. py -m flake8 or by the pre-commit hooks (installed by pre-commit install).

Additional context

sharpy-sc2 repo already contains multiple config files with the same excludes.

  1. .flake8
  2. pyproject.toml for Black config
  3. pytest.ini

Adding a fourth file with the same excluded directories would be... less than ideal.

Proposition for extending micro

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

With the current architecture it is no good way to extend or change the micro. One either has create a new class for it with no way of just extending what is currently implemented without overwriting.

Describe the solution you'd like
I want an architecture where I can for each unit type add or remove micro solvers without modifying the sharpy library.

Describe alternatives you've considered
I propose changing the group_combat_manager to have a list of solvers that are executed in order. These solvers contains the functions group_solve_combat and unit_solve_combat that will be executed in order. The functions return either an Action or None depending if they are triggered or are doing blocking actions like burrow or siege. This way the developer could easily reuse code with many simple solvers or have one complex solver.

To optimize, I suggest that the StepMicro is sent as an additional parameter to the unit_solve_combat so this information is only calculated once for each group.

A function to add and one to overwrite the list assigned by default for each unit_type would make it more developer friendly to use.

I considered modifying MicroStep instead of the manager, but it feel more right to keep it in the manager.

Add mechanism for requesting manager by name or type

sharpy provides a mechanism for registering new managers by overriding KnowledgeBot.configure_managers(self) -> Optional[List[ManagerBase]]).

The additional managers are then passed to Knowledge.pre_start(...)

Sharpy's internal managers are available through hard coded properties in Knowledge. However, there's no easy mechanism for accessing the added managers.

Describe the solution you'd like

Save all managers to eg. a Dict instead of a List in Knowledge.

Add a new method to Knowledge and/or KnowledgeBot, that can be used to get an added manager by eg. EITHER it's name as a string OR the manager type.

Using type as key has the benefit of some "compile-time" checks. It prevents adding multiple instances of the same manager (probably not needed).

Using string as key has the con that errors are only detected at runtime, resulting in a longer feedback loop. It has the added benefit of allowing multiple instances of the same manager to be added (probably not needed).

Also, please update relevant Wiki docs, including at least Extending Managers.

Additional information

It's important to preserve the order of sharpy's own managers, because the order affects how they are updated.

Dictionaries preserve insertion order. Note that updating a key does not affect the order. Keys added after deletion are inserted at the end.

Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.

source: https://docs.python.org/3.7/library/stdtypes.html#dict.values

Add Auto turrets to raven micro

Is your feature request related to a problem? Please describe.
Safe raven TvT bot opens up with raven and dies to marine pushe with the raven not using any energy.

Describe the solution you'd like
Use auto turrets on small scale fights. Unsure on how to look for turret placement positions.

Additional context

generally 'when attacking: place them offensively (next to enemy tanks)' and 'when defending: place defensively in a retreating manner'
well at least for tvt
i dont think autoturrets are very good in the other matchups
there is also raven autoturret harass for killing workers

Default micro for Liberator

Is your feature request related to a problem? Please describe.
Liberators just fly in and die against ground units

Describe the solution you'd like
Siege the liberator in a reasonable way.

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.