drinfy / sharpy-sc2 Goto Github PK
View Code? Open in Web Editor NEWPython framework for rapid development of Starcraft 2 AI bots
License: MIT License
Python framework for rapid development of Starcraft 2 AI bots
License: MIT License
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.
Describe the bug
Cyclone bot crashes when I try to run it.
To Reproduce
py run_custom.py -p1 cyclone
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)
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
Roles manager should work in a way were roles are lost if the units aren't claimed each step.
The idea here is to have smoothless transition between builds that might have different triggers for attack and defense.
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
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)
RoboUnit
GateUnit
StarUnit
RequiredLessUnitExists
RequiredTotalUnitExists
ActMany
RequiredLessUnitExists
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.
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
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.
Adding a fourth file with the same excluded directories would be... less than ideal.
Describe the bug
This is calling the .execute() without arguments, but it expects arguments: https://github.com/DrInfy/sharpy-sc2/blob/develop/sharpy/managers/group_combat_manager.py#L96
To Reproduce
Add it to bot. Should crash the bot.
Expected behavior
Adept should stay in places where reapers like to stay the most and kill them when seen
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.
See this game: https://aiarena.net/matches/153533/
For some reason after the planetary fortress is built worker distribution sends workers back to the main base instead of having them mine at the PF.
Is this intended?
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
It's possible to detect burrowed units by checking death events, checking visibility around the unit that disappeared and seeing if there is a detector nearby.
It's also possible to detect lurker shot effects.
Take into account amount of larva, income and available resources to determine whether a new overlord should be build or not.
Describe the bug
The natural wall is build inside 2nd base incorrectly.
Enemy units manager doesn't properly count units that have been turned into other units by morphing.
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
Create an act that swaps add-ons between two terran buildings.
Describe the bug
Army starts getting stuck when they see a single zergling
To Reproduce
Probots grand finals with harvester vs spiny
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.
When expanding, the army doesn't cover the expanding worker long enough to actually build the new expansion and the worker can be killed by zerglings or reapers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.