def benchmark_config(benchmark, base, nent, *systems):
    conf      = create_config(base, *systems)
    conf.NENT = nent

    env = nmmo.Env(conf)
    env.reset()

    benchmark(env.step, actions={})
def test_pettingzoo_api():
    env = nmmo.Env()
    parallel_api_test(env, num_cycles=2000)
Beispiel #3
0
def test_env_creation():
    import nmmo
    env = nmmo.Env()
    env.reset()
    env.step({})
Beispiel #4
0
'''Manual test for client connectivity'''

from pdb import set_trace as T
import pytest

import nmmo

if __name__ == '__main__':
    env = nmmo.Env()
    env.config.RENDER = True

    env.reset()
    while True:
        env.render()
        env.step({})
def test_large_env_reset(benchmark):
    env = nmmo.Env(Large())
    benchmark(lambda: env.reset(idx=1))
def test_large_env_creation(benchmark):
    benchmark(lambda: nmmo.Env(Large()))
def create_and_reset(conf):
    env = nmmo.Env(conf())
    env.reset(idx=1)
def test_small_env_reset(benchmark):
    env = nmmo.Env(Small())
    benchmark(lambda: env.reset(idx=1))
def test_small_env_creation(benchmark):
    benchmark(lambda: nmmo.Env(Small()))
def test_fps_small_rcp_100_pop(benchmark):
    benchmark_config(benchmark, Small, 100, Resource, Combat, Progression) 

def test_fps_small_all_100_pop(benchmark):
    benchmark_config(benchmark, Small, 100, AllGameSystems)

# Reuse large maps since we aren't benchmarking the reset function
def test_large_env_creation(benchmark):
    benchmark(lambda: nmmo.Env(Large()))

def test_large_env_reset(benchmark):
    env = nmmo.Env(Large())
    benchmark(lambda: env.reset(idx=1))

LargeMapsRCP = nmmo.Env(create_config(Large, Resource, Combat, Progression))
LargeMapsAll = nmmo.Env(create_config(Large, AllGameSystems))

def test_fps_large_rcp_1_pop(benchmark):
    benchmark_env(benchmark, LargeMapsRCP, 1)

def test_fps_large_rcp_100_pop(benchmark):
    benchmark_env(benchmark, LargeMapsRCP, 100)

def test_fps_large_rcp_1000_pop(benchmark):
    benchmark_env(benchmark, LargeMapsRCP, 1000)

def test_fps_large_all_1_pop(benchmark):
    benchmark_env(benchmark, LargeMapsAll, 1)

def test_fps_large_all_100_pop(benchmark):