From 9b7de6a54b863a900bce90bd443c084675e04de6 Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Thu, 5 May 2022 20:20:31 -0400 Subject: [PATCH 1/8] add workfile --- .github/workflows/unit-test.yml | 15 +++++++++++++++ .gitignore | 3 ++- requirements.txt | Bin 0 -> 1200 bytes 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/unit-test.yml create mode 100644 requirements.txt diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000..f9ad312 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,15 @@ +name: Unit Test +on: [push] +jobs: + Unit-Test: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: 3.10 + - name: Install dependencies + run: pip install -r requirements.txt + diff --git a/.gitignore b/.gitignore index abd32e8..844292d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*__pycache__* \ No newline at end of file +*__pycache__* +.idea diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..4be94cb4550604626d491a92d03950c845188f9a GIT binary patch literal 1200 zcmY+D%}&EW41|3~;!#>PDHJ$x;KT(auAES5phUDuNjKu>;eq+=G)Wb0q{Q}kX6*g@ zUD=B@maMc_oohY0&2%!G>df@Mv{O5=mA%%nw}(Md^W-iO|0F)#$4b z-*I-}t<^0l_UtiGK)do@w;p>CLXzTII;o#44yW8MJZr7^wnxspI7}iE{@^P94jkyS zaD-C*E9p6)ha)KX7O&d9F8U6ccR2UTt?<^;xa?hp8OVWg9EV9Ou6Qzb;zIeE;~mFC zW!|IF2Pcv^F@-@(WTJT|uWR)v6^;3g>xohQEFQ1DUbgJOV5hoPIi>L7c&^BmPD~5t zYq8jlu*bcJNloM_Y+sJh;KJU;J~G)yyRmz_^IpT2u`eI0WL~M$Ni8!!FhyUbXd{$~ za*A%R;REZe^E7Tr__A_kN!o_p9{kz+mT?1HJ!}OIfQLVE_xAe#)&I{%H)AhXxPv>7 z!hovq4bL0x$lItgaG6<>)j4e!ZfLmK>HcwLaB}BY| oE4L>0gnYCHZYw?;J*9SG-m}VGPu#vwX{p33Zf0x<^=O9mKaQHLOaK4? literal 0 HcmV?d00001 From ad4492a1a25f0e2a9be4420b631059a39bc28285 Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Thu, 5 May 2022 20:22:52 -0400 Subject: [PATCH 2/8] fix --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index f9ad312..18e8877 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -9,7 +9,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v3 with: - python-version: 3.10 + python-version: '3.10.x' - name: Install dependencies run: pip install -r requirements.txt From c2c25bd8b31ab3b38723bdcebb63040ee9630824 Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Thu, 5 May 2022 21:55:55 -0400 Subject: [PATCH 3/8] fix --- .github/workflows/unit-test.yml | 15 ++++- .gitignore | 3 + requirements.txt | Bin 1200 -> 0 bytes setup.py | 2 +- tests/utils/test_util.py | 113 ++++++++++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 4 deletions(-) delete mode 100644 requirements.txt create mode 100644 tests/utils/test_util.py diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 18e8877..de861a1 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -2,14 +2,23 @@ name: Unit Test on: [push] jobs: Unit-Test: - runs-on: ubuntu-20.04 + runs-on: windows-2022 steps: - uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: - python-version: '3.10.x' + python-version: '3.9.x' + - name: Download BakkesMod + run: Invoke-WebRequest https://github.com/bakkesmodorg/BakkesModInjectorCpp/releases/latest/download/BakkesModSetup.zip -O BakkesModSetup.zip + - name: Unzip BakkesMod + run: Expand-Archive -Path 'BakkesModSetup.zip' -DestinationPath 'BakkesModSetup' + - name: Install BakkesMod + run: BakkesModSetup\BakkesModSetup.exe - name: Install dependencies - run: pip install -r requirements.txt + run: python setup.py install + - name: Run Test + run: pytest + diff --git a/.gitignore b/.gitignore index 844292d..86e639f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ *__pycache__* .idea +build +rocket_learn.egg-info +*.egg diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4be94cb4550604626d491a92d03950c845188f9a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1200 zcmY+D%}&EW41|3~;!#>PDHJ$x;KT(auAES5phUDuNjKu>;eq+=G)Wb0q{Q}kX6*g@ zUD=B@maMc_oohY0&2%!G>df@Mv{O5=mA%%nw}(Md^W-iO|0F)#$4b z-*I-}t<^0l_UtiGK)do@w;p>CLXzTII;o#44yW8MJZr7^wnxspI7}iE{@^P94jkyS zaD-C*E9p6)ha)KX7O&d9F8U6ccR2UTt?<^;xa?hp8OVWg9EV9Ou6Qzb;zIeE;~mFC zW!|IF2Pcv^F@-@(WTJT|uWR)v6^;3g>xohQEFQ1DUbgJOV5hoPIi>L7c&^BmPD~5t zYq8jlu*bcJNloM_Y+sJh;KJU;J~G)yyRmz_^IpT2u`eI0WL~M$Ni8!!FhyUbXd{$~ za*A%R;REZe^E7Tr__A_kN!o_p9{kz+mT?1HJ!}OIfQLVE_xAe#)&I{%H)AhXxPv>7 z!hovq4bL0x$lItgaG6<>)j4e!ZfLmK>HcwLaB}BY| oE4L>0gnYCHZYw?;J*9SG-m}VGPu#vwX{p33Zf0x<^=O9mKaQHLOaK4? diff --git a/setup.py b/setup.py index 3ad3b19..296c3db 100644 --- a/setup.py +++ b/setup.py @@ -16,5 +16,5 @@ url='https://github.com/Rolv-Arild/rocket-learn', packages=[package for package in find_packages() if package.startswith("rocket_learn")], long_description=long_description, - install_requires=['cloudpickle==1.6.0', 'gym', 'torch', 'tqdm', 'trueskill', 'msgpack_numpy', 'wandb', 'pygame', 'keyboard'], + install_requires=['cloudpickle==1.6.0', 'gym', 'torch', 'tqdm', 'trueskill', 'msgpack_numpy', 'wandb', 'pygame', 'keyboard', 'pytest'], ) diff --git a/tests/utils/test_util.py b/tests/utils/test_util.py new file mode 100644 index 0000000..1e1cf9b --- /dev/null +++ b/tests/utils/test_util.py @@ -0,0 +1,113 @@ +from rlgym.utils.gamestates import GameState + +from rocket_learn.utils.util import encode_gamestate + + +def test_encode_gamestate(): + initial = [0,0,0] + boost_pad = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + ball_state = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] + player_info = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] + player_car_state = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4] + player_ternary = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5] + + state = [] + state.extend(initial) + state.extend(boost_pad) + state.extend(ball_state) + state.extend(player_info) + state.extend(player_car_state) + state.extend(player_ternary) + assert encode_gamestate(GameState(state)) == [0, + 0, + 0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + True, + True, + True, + True, + 4.0] From 2219d75733c67b9ac20cb995bbb88820b45582c5 Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Thu, 5 May 2022 22:01:32 -0400 Subject: [PATCH 4/8] fix --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 296c3db..1d164ad 100644 --- a/setup.py +++ b/setup.py @@ -16,5 +16,5 @@ url='https://github.com/Rolv-Arild/rocket-learn', packages=[package for package in find_packages() if package.startswith("rocket_learn")], long_description=long_description, - install_requires=['cloudpickle==1.6.0', 'gym', 'torch', 'tqdm', 'trueskill', 'msgpack_numpy', 'wandb', 'pygame', 'keyboard', 'pytest'], + install_requires=['cloudpickle==1.6.0', 'gym', 'torch', 'tqdm', 'trueskill', 'msgpack_numpy', 'wandb', 'pygame', 'keyboard', 'rlgym', 'pytest'], ) From 32cc9df8c7ad5b01e718ab128716770c27b6e703 Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Thu, 5 May 2022 22:12:17 -0400 Subject: [PATCH 5/8] fix --- .github/workflows/unit-test.yml | 5 ++++- setup.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index de861a1..a406d2c 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -17,7 +17,10 @@ jobs: - name: Install BakkesMod run: BakkesModSetup\BakkesModSetup.exe - name: Install dependencies - run: python setup.py install + run: | + python setup.py install + pip install rlgym + pip install pytest - name: Run Test run: pytest diff --git a/setup.py b/setup.py index 1d164ad..3ad3b19 100644 --- a/setup.py +++ b/setup.py @@ -16,5 +16,5 @@ url='https://github.com/Rolv-Arild/rocket-learn', packages=[package for package in find_packages() if package.startswith("rocket_learn")], long_description=long_description, - install_requires=['cloudpickle==1.6.0', 'gym', 'torch', 'tqdm', 'trueskill', 'msgpack_numpy', 'wandb', 'pygame', 'keyboard', 'rlgym', 'pytest'], + install_requires=['cloudpickle==1.6.0', 'gym', 'torch', 'tqdm', 'trueskill', 'msgpack_numpy', 'wandb', 'pygame', 'keyboard'], ) From 3163b4bc563521d2e00a90335e19b61b223dafed Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Wed, 11 May 2022 12:28:13 -0400 Subject: [PATCH 6/8] should install now --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index a406d2c..632f2e4 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -15,7 +15,7 @@ jobs: - name: Unzip BakkesMod run: Expand-Archive -Path 'BakkesModSetup.zip' -DestinationPath 'BakkesModSetup' - name: Install BakkesMod - run: BakkesModSetup\BakkesModSetup.exe + run: BakkesModSetup\BakkesModSetup.exe /VERYSILENT /installfromdll=true - name: Install dependencies run: | python setup.py install From 887526f581a40b646c9c94373e9771e325e54a10 Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Wed, 11 May 2022 22:27:05 -0400 Subject: [PATCH 7/8] progress --- tests/utils/test_util.py | 150 +++++++++++++-------------------------- 1 file changed, 51 insertions(+), 99 deletions(-) diff --git a/tests/utils/test_util.py b/tests/utils/test_util.py index 1e1cf9b..225f36d 100644 --- a/tests/utils/test_util.py +++ b/tests/utils/test_util.py @@ -4,12 +4,55 @@ def test_encode_gamestate(): - initial = [0,0,0] - boost_pad = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - ball_state = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] - player_info = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] - player_car_state = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4] - player_ternary = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5] + initial = [0.9014944386070818, 0.7437496717058292, 0.11523679140045551] + boost_pad = [0.003111401210689868, 0.5021335460386673, 0.8533789339552476, 0.09714999894304932, 0.7143390721018188, + 0.904023562293331, 0.16265660155305572, 0.571626944750347, 0.24778384184792368, 0.9091309632722162, + 0.6592361326653748, 0.791795318386487, 0.2724695390498557, 0.32326792073286925, 0.167624621608909, + 0.8361758804667154, 0.8746872111461466, 0.7678519252038587, 0.5267171401875672, 0.5168564049955375, + 0.8574124397586926, 0.4390338879520339, 0.7161976230618752, 0.9423951164291233, 0.4252098997873843, + 0.6348407562452576, 0.7996163381861632, 0.9607027302407571, 0.29866522048265587, 0.030547111448842923, + 0.6698791835691189, 0.22825689183720432, 0.31471833657100423, 0.137017403696158] + ball_state = [0.27696337802234927, 0.901607574537501, 0.9162636151172863, 0.41581528176420535, 0.3802807190091779, + 0.2828253821061679, 0.9477133581539083, 0.7817742167252288, 0.06521346143339035, 0.07321247932474795, + 0.35884491811630737, 0.22579710962370836, 0.7108677439023905, 0.21351596462413647, + 0.14567335233924572, 0.31729176772958034, 0.011272366424840863, 0.8338832290060092] + player_info = [0.1178052811634831, 0.7593878303755066, 0.3792401241859009, 0.0664535399729691, 0.9830587561000144, + 0.2368589444233229, 0.146776662484974, 0.1874666469160684, 0.9514036150101033, 0.4132994067611899, + 0.15133628109361186, 0.48387899467955564, 0.047234692358380626, 0.2308392882416661, + 0.4935608251648853, 0.9113517608715533, 0.01738674352128089, 0.7335486816964638, 0.5818931065950903, + 0.6313772865665637, 0.9449745140714203, 0.02902726416928747, 0.11522208711681747, + 0.24542619510094865, 0.29808562243890857, 0.6950708345594185, 0.524042067861269, 0.48254636506229165, + 0.28527828522822873, 0.9117533992528384, 0.45416210041176064, 0.47544287360060866, + 0.08661855564023346, 0.3795672723524046, 0.9262328865485365, 0.8992876308061273, 0.47634356601984007, + 0.19171424900276124] + player_car_state = [0.5715392654342994, 0.9559166840971312, 0.25425424051431444, 0.6333342900076249, + 0.40481192086972473, 0.5077252706866591, 0.4583819597091836, 0.4023090090469079, + 0.876953238223366, 0.5467481676210741, 0.1744282580053842, 0.08924552124605833, + 0.3765565576495673] + player_ternary = [0.026049308518568903, 0.24955622534606547, 0.22673928889397366, 0.13049151215564336, + 0.8944196699100078, 0.5526069742201103, 0.42653203231391146, 0.7954012359724127, + 0.25672816070234417, 0.47182189809712916] + + expected_state = [0, 0, 0, 0.003111401107162237, 0.5021335482597351, 0.85337895154953, 0.09714999794960022, + 0.7143390774726868, 0.9040235877037048, 0.16265660524368286, 0.5716269612312317, + 0.2477838397026062, 0.9091309905052185, 0.6592361330986023, 0.7917953133583069, + 0.27246955037117004, 0.3232679069042206, 0.16762462258338928, 0.8361758589744568, + 0.8746871948242188, 0.7678519487380981, 0.5267171263694763, 0.5168564319610596, + 0.8574124574661255, 0.4390338957309723, 0.7161976099014282, 0.9423950910568237, + 0.4252099096775055, 0.634840726852417, 0.7996163368225098, 0.9607027173042297, + 0.29866522550582886, 0.030547112226486206, 0.6698791980743408, 0.22825689613819122, + 0.3147183358669281, 0.1370173990726471, 0.27696337802234927, 0.901607574537501, + 0.9162636151172863, 0.41581528176420535, 0.3802807190091779, 0.2828253821061679, + 0.9477133581539083, 0.7817742167252288, 0.06521346143339035, 0.07321247932474795, + 0.35884491811630737, 0.22579710962370836, 0.7108677439023905, 0.21351596462413647, + 0.14567335233924572, 0.31729176772958034, 0.011272366424840863, 0.8338832290060092, 0, 0, + 0.3792401241859009, 0.0664535399729691, 0.9830587561000144, 0.2368589444233229, 0.146776662484974, + 0.1874666469160684, 0.9514036150101033, 0.4132994067611899, 0.15133628109361186, + 0.48387899467955564, 0.047234692358380626, 0.2308392882416661, 0.4935608251648853, + 0.9113517608715533, 0.01738674352128089, 0.7335486816964638, 0.5818931065950903, + 0.6313772865665637, 0.9449745140714203, 0.02902726416928747, 0.11522208711681747, + 0.24542619510094865, 0.29808562243890857, 0.6950708345594185, 0.524042067861269, + 0.48254636506229165, 0, 0, 0, 0, 0, True, True, True, True, 0.19171424900276124] state = [] state.extend(initial) @@ -18,96 +61,5 @@ def test_encode_gamestate(): state.extend(player_info) state.extend(player_car_state) state.extend(player_ternary) - assert encode_gamestate(GameState(state)) == [0, - 0, - 0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - True, - True, - True, - True, - 4.0] + + assert encode_gamestate(GameState(state)) == expected_state From aecdda83b8bdbe5c44b997aaba9a05a008d3c31d Mon Sep 17 00:00:00 2001 From: George Walter Colgrove IV Date: Sun, 12 Jun 2022 14:56:23 -0400 Subject: [PATCH 8/8] test fix --- tests/utils/test_util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/utils/test_util.py b/tests/utils/test_util.py index 225f36d..133cfd2 100644 --- a/tests/utils/test_util.py +++ b/tests/utils/test_util.py @@ -24,7 +24,7 @@ def test_encode_gamestate(): 0.24542619510094865, 0.29808562243890857, 0.6950708345594185, 0.524042067861269, 0.48254636506229165, 0.28527828522822873, 0.9117533992528384, 0.45416210041176064, 0.47544287360060866, 0.08661855564023346, 0.3795672723524046, 0.9262328865485365, 0.8992876308061273, 0.47634356601984007, - 0.19171424900276124] + 0.191714249002761240, .37912220860787436] player_car_state = [0.5715392654342994, 0.9559166840971312, 0.25425424051431444, 0.6333342900076249, 0.40481192086972473, 0.5077252706866591, 0.4583819597091836, 0.4023090090469079, 0.876953238223366, 0.5467481676210741, 0.1744282580053842, 0.08924552124605833, @@ -52,7 +52,7 @@ def test_encode_gamestate(): 0.9113517608715533, 0.01738674352128089, 0.7335486816964638, 0.5818931065950903, 0.6313772865665637, 0.9449745140714203, 0.02902726416928747, 0.11522208711681747, 0.24542619510094865, 0.29808562243890857, 0.6950708345594185, 0.524042067861269, - 0.48254636506229165, 0, 0, 0, 0, 0, True, True, True, True, 0.19171424900276124] + 0.48254636506229165, 0, 0, 0, 0, 0, True, True, True, True, .37912220860787436] state = [] state.extend(initial) @@ -62,4 +62,5 @@ def test_encode_gamestate(): state.extend(player_car_state) state.extend(player_ternary) - assert encode_gamestate(GameState(state)) == expected_state + current_gamestate = GameState(state) + assert encode_gamestate(current_gamestate) == expected_state