Comments (2)
Not sure if related, but I noticed that there are some weird issues with sc2.bot_ai.find_placement(). I noticed this when trying to make a custom warp_in function, because I couldn't get it to warp in further out from the targetted pylon, regardless of what I changed max_distance to, I kept getting placement errors, even with random_alternative=True.
I solved this by just warping in at random positions, so I didn't have to use find_placement() or query_building_placement() at all, and I sent the action manually using self._client.actions() to surpress the error logging. As a side-note, I kind of wish you could disable error-logging with an extra argument to sc2.bot_ai.do() so I could use that directly instead.
Here's my custom warp-in solution:
async def warp_in(self, unit, location, warpgate):
if isinstance(location, sc2.unit.Unit):
location = location.position.to2
elif location is not None:
location = location.to2
x = random.randrange(-8,8)
y = random.randrange(-8,8)
placement = sc2.position.Point2((location.x+x,location.y+y))
action = warpgate.warp_in(unit, placement)
error = await self._client.actions(action, game_data=self._game_data)
if not error:
cost = self._game_data.calculate_ability_cost(action.ability)
self.minerals -= cost.minerals
self.vespene -= cost.vespene
return None
else:
return error
from python-sc2.
@Dentosal , I remember having this problem way back when I was still actively contributing. It's because the API can't register a currently warping in unit as an unavailable cell. The random alternative only works if the initial cell is unavailable.
from python-sc2.
Related Issues (20)
- AttributeError: TRAIN_ADEPT
- Headless Linux version broken on "develop" branch HOT 3
- Can not run bot_vs_bot in double screen separately. HOT 1
- Does this library support distributed training?
- KeyError: 412
- STARPORTTECHLABRESEARCH abilities not working HOT 3
- How to make SCV continue build an structure which is interrupted by enemy
- Is it possible to visualize the distance in sc2? HOT 2
- Is it possible to snapshot a game state? HOT 1
- Erro in ramp_wall.py HOT 2
- ValueError: 3794 is not a valid AbilityId causing by "realtime=True/False" HOT 2
- ModuleNotFoundError: No module named 'websockets' HOT 1
- Error while using self.time = (self.state.game_loop/22.4) / 60 HOT 2
- after fixing 3794/3795 error -botAI main_base_ramp fails
- Error on max() of empty set when assigning workers.
- cannot import name 'run_game' HOT 1
- How to Arm Silo with Nuke for ghost HOT 1
- How to ask Queen EFFECT_INJECTLARVA"v" to hatcherys each one
- error to execute.
- don't have "run_game" file in sc2 lib HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-sc2.