Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyCommandCenter v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Bonnaudet
PyCommandCenter v2
Commits
e08c388d
Commit
e08c388d
authored
4 years ago
by
Hannes Jämtner
Browse files
Options
Downloads
Patches
Plain Diff
Debug commands added and tested
parent
4fce66f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python-api-src/library.cpp
+20
-2
20 additions, 2 deletions
python-api-src/library.cpp
src/IDABot.cpp
+94
-2
94 additions, 2 deletions
src/IDABot.cpp
src/IDABot.h
+24
-3
24 additions, 3 deletions
src/IDABot.h
with
138 additions
and
7 deletions
python-api-src/library.cpp
+
20
−
2
View file @
e08c388d
...
...
@@ -73,8 +73,26 @@ PYBIND11_MODULE(library, m)
.
def
(
"get_all_units"
,
&
IDABot
::
GetAllUnits
,
"Returns a list of all units"
)
.
def
(
"get_my_units"
,
&
IDABot
::
GetMyUnits
,
"Returns a list of all units beloning to the player"
)
.
def
(
"get_player_race"
,
&
IDABot
::
GetPlayerRace
)
.
def
(
"carry_vespene"
,
&
IDABot
::
isCarryingVespene
,
"If unit carries a vespene"
)
.
def
(
"carry_mineral"
,
&
IDABot
::
isCarryingMineral
,
"If unit carries a mineral"
)
.
def
(
"is_unit_carry_vespene"
,
&
IDABot
::
IsUnitCarryVespene
,
"If unit carries a vespene"
)
.
def
(
"is_unit_carry_mineral"
,
&
IDABot
::
IsUnitCarryMineral
,
"If unit carries a mineral"
)
.
def
(
"debug_create_unit"
,
&
IDABot
::
DebugCreateUnit
,
"Create unit from debug mode"
)
.
def
(
"debug_kill_unit"
,
&
IDABot
::
DebugKillUnit
,
"Kill unit from debug mode"
)
.
def
(
"debug_show_map"
,
&
IDABot
::
DebugShowMap
,
"Show the entire map through debug mode"
)
.
def
(
"debug_fast_build"
,
&
IDABot
::
DebugFastBuild
,
"Set build time to 1 through debug mode"
)
.
def
(
"debug_enemy_control"
,
&
IDABot
::
DebugEnemyControl
,
"Control the enemy through debug mode"
)
.
def
(
"debug_ignore_food"
,
&
IDABot
::
DebugIgnoreFood
,
"Ignore the food through debug mode"
)
.
def
(
"debug_ignore_resource_cost"
,
&
IDABot
::
DebugIgnoreResourceCost
,
"Ignore the resource cost through debug mode"
)
.
def
(
"debug_give_all_resources"
,
&
IDABot
::
DebugGiveAllResources
,
"Give all the resources through debug mode"
)
.
def
(
"debug_god_mode"
,
&
IDABot
::
DebugGodMode
,
"Give the player god mode"
)
.
def
(
"debug_ignore_mineral"
,
&
IDABot
::
DebugIgnoreMineral
,
"Ignore the mineral cost through debug mode"
)
.
def
(
"debug_no_cooldowns"
,
&
IDABot
::
DebugNoCooldowns
,
"Deactive cooldowns through debug mode"
)
.
def
(
"debug_give_all_tech"
,
&
IDABot
::
DebugGiveAllTech
,
"Give all the tech to the player through debug mode"
)
.
def
(
"debug_give_all_upgrades"
,
&
IDABot
::
DebugGiveAllUpgrades
,
"Give all the upgrades to the player trough debug mode"
)
.
def
(
"debug_set_score"
,
&
IDABot
::
DebugSetScore
,
"Set the Players score through debug mode"
)
.
def
(
"debug_end_game"
,
&
IDABot
::
DebugEndGame
,
"End the game through debug mode"
)
.
def
(
"debug_set_energy"
,
&
IDABot
::
DebugSetEnergy
,
"Set the energy on a unit through debug mode"
)
.
def
(
"debug_set_life"
,
&
IDABot
::
DebugSetLife
,
"Set the life on a unit through debug mode"
)
.
def
(
"debug_set_shield"
,
&
IDABot
::
DebugSetShields
,
"Set the shields on a unit through debug mode"
)
.
def_property_readonly
(
"base_location_manager"
,
&
IDABot
::
Bases
)
.
def_property_readonly
(
"tech_tree"
,
&
IDABot
::
GetTechTree
)
.
def_property_readonly
(
"map_tools"
,
&
IDABot
::
Map
)
...
...
This diff is collapsed.
Click to expand it.
src/IDABot.cpp
+
94
−
2
View file @
e08c388d
#include
"IDABot.h"
#include
"Util.h"
IDABot
::
IDABot
()
:
m_map
(
*
this
)
,
m_bases
(
*
this
)
...
...
@@ -229,14 +230,105 @@ const TypeData & IDABot::Data(const MetaType & type) const
API extended summer 2020
*/
bool
IDABot
::
is
Carry
ing
Vespene
(
Unit
const
unit
)
const
bool
IDABot
::
IsUnit
CarryVespene
(
Unit
const
unit
)
const
{
const
sc2
::
Unit
*
sc2unit
=
unit
.
getUnitPtr
();
return
Observation
()
->
IsUnitCarryVespene
(
*
sc2unit
);
}
bool
IDABot
::
is
Carry
ing
Mineral
(
Unit
const
unit
)
const
bool
IDABot
::
IsUnit
CarryMineral
(
Unit
const
unit
)
const
{
const
sc2
::
Unit
*
sc2unit
=
unit
.
getUnitPtr
();
return
Observation
()
->
IsUnitCarryMineral
(
*
sc2unit
);
}
void
IDABot
::
DebugCreateUnit
(
UnitTypeID
unit_type
,
const
CCPosition
&
p
,
uint32_t
player_id
,
uint32_t
count
)
{
Debug
()
->
DebugCreateUnit
(
unit_type
,
p
,
player_id
,
count
);
}
void
IDABot
::
DebugKillUnit
(
const
Unit
unit
)
{
Debug
()
->
DebugKillUnit
(
unit
.
getUnitPtr
());
}
void
IDABot
::
DebugShowMap
()
{
Debug
()
->
DebugShowMap
();
}
void
IDABot
::
DebugFastBuild
()
{
Debug
()
->
DebugFastBuild
();
}
void
IDABot
::
DebugEnemyControl
()
{
Debug
()
->
DebugEnemyControl
();
}
void
IDABot
::
DebugIgnoreFood
()
{
Debug
()
->
DebugIgnoreFood
();
}
void
IDABot
::
DebugIgnoreResourceCost
()
{
Debug
()
->
DebugIgnoreResourceCost
();
}
void
IDABot
::
DebugGiveAllResources
()
{
Debug
()
->
DebugGiveAllResources
();
}
void
IDABot
::
DebugGodMode
()
{
Debug
()
->
DebugGodMode
();
}
void
IDABot
::
DebugIgnoreMineral
()
{
Debug
()
->
DebugIgnoreMineral
();
}
void
IDABot
::
DebugNoCooldowns
()
{
Debug
()
->
DebugIgnoreMineral
();
}
void
IDABot
::
DebugGiveAllTech
()
{
Debug
()
->
DebugGiveAllTech
();
}
void
IDABot
::
DebugGiveAllUpgrades
()
{
Debug
()
->
DebugGiveAllUpgrades
();
}
void
IDABot
::
DebugSetScore
(
float
score
)
{
Debug
()
->
DebugSetScore
(
score
);
}
void
IDABot
::
DebugEndGame
(
bool
victory
)
{
Debug
()
->
DebugEndGame
(
victory
);
}
void
IDABot
::
DebugSetEnergy
(
float
value
,
const
Unit
unit
)
{
Debug
()
->
DebugSetEnergy
(
value
,
unit
.
getUnitPtr
());
}
void
IDABot
::
DebugSetLife
(
float
value
,
const
Unit
unit
)
{
Debug
()
->
DebugSetLife
(
value
,
unit
.
getUnitPtr
());
}
void
IDABot
::
DebugSetShields
(
float
value
,
const
Unit
unit
)
{
Debug
()
->
DebugSetShields
(
value
,
unit
.
getUnitPtr
());
}
This diff is collapsed.
Click to expand it.
src/IDABot.h
+
24
−
3
View file @
e08c388d
...
...
@@ -14,6 +14,8 @@
#include
"MetaType.h"
#include
"Unit.h"
using
sc2
::
UnitTypeID
;
class
IDABot
:
public
sc2
::
Agent
{
MapTools
m_map
;
...
...
@@ -61,10 +63,29 @@ public:
/*
API extended summer 2020
*/
bool
isCarryingVespene
(
Unit
const
unit
)
const
;
bool
isCarryingMineral
(
Unit
const
unit
)
const
;
bool
IsUnitCarryVespene
(
Unit
const
unit
)
const
;
bool
IsUnitCarryMineral
(
Unit
const
unit
)
const
;
void
DebugCreateUnit
(
UnitTypeID
unit_type
,
const
CCPosition
&
p
,
uint32_t
player_id
=
1
,
uint32_t
count
=
1
);
void
DebugKillUnit
(
const
Unit
unit
);
void
DebugShowMap
();
void
DebugFastBuild
();
void
DebugEnemyControl
();
void
DebugIgnoreFood
();
void
DebugIgnoreResourceCost
();
void
DebugGiveAllResources
();
void
DebugGodMode
();
void
DebugIgnoreMineral
();
void
DebugNoCooldowns
();
void
DebugGiveAllTech
();
void
DebugGiveAllUpgrades
();
void
DebugSetScore
(
float
score
);
void
DebugEndGame
(
bool
victory
);
void
DebugSetEnergy
(
float
value
,
const
Unit
unit
);
void
DebugSetLife
(
float
value
,
const
Unit
unit
);
void
DebugSetShields
(
float
value
,
const
Unit
unit
);
Unit
findClosestWorkerTo
(
std
::
vector
<
Unit
>
&
unitsToAssign
,
const
CCPosition
&
target
);
// Not needed, just convenience functions
const
TypeData
&
Data
(
const
UnitType
&
type
)
const
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment