-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
215 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import os | ||
path = os.path.dirname(__file__) | ||
from ssbm_gym.ssbm_env import SSBMEnv | ||
from ssbm_gym.ssbm_env import SSBMEnv, EnvVec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from ssbm_gym import SSBMEnv, EnvVec | ||
import atexit | ||
import platform | ||
import random | ||
import time | ||
|
||
options = dict( | ||
render=True, | ||
player1='ai', | ||
player2='cpu', | ||
char1='fox', | ||
char2='falco', | ||
cpu2=7, | ||
stage='battlefield', | ||
) | ||
|
||
# Vectorized envs not supported on Windows | ||
# if platform.system() == 'Windows': | ||
# options['windows'] = True | ||
|
||
num_workers = 4 | ||
|
||
|
||
# Required for vectorized envs | ||
if __name__ == "__main__": | ||
env = EnvVec(SSBMEnv, num_workers, options=options) | ||
obs = env.reset() | ||
atexit.register(env.close) | ||
|
||
t = time.time() | ||
for i in range(1000): | ||
action = [random.randint(0, env.action_space.n - 1) for _ in range(num_workers)] | ||
obs, reward, done, infos = env.step(action) | ||
try: | ||
print("FPS:", round(1/(time.time() - t))) | ||
print([o.players[0].x for o in obs]) | ||
except: | ||
pass | ||
t = time.time() |