Skip to content

Commit

Permalink
Update nmmo c to c_step, c_reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Suarez committed Feb 4, 2025
1 parent 076696a commit 0cb9a31
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pufferlib/ocean/nmmo3/nmmo3.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void demo(int num_players) {
};
allocate_mmo(&env);

reset(&env, 42);
c_reset(&env, 42);

// Must reset before making client
Client* client = make_client(&env);
Expand All @@ -183,7 +183,7 @@ void demo(int num_players) {
env.actions[0] = human_action;
}

step(&env);
c_step(&env);
//printf("Reward: %f\n\tDeath: %f\n\tProf: %f\n\tComb: %f\n\tItem: %f\n", env.rewards[0].death, env.rewards[0].death, env.rewards[0].prof_lvl, env.rewards[0].comb_lvl, env.rewards[0].item_atk_lvl);
human_action = ATN_NOOP;
} else {
Expand Down Expand Up @@ -222,13 +222,13 @@ void test_mmonet_performance(int num_players, int timeout) {
.y_window = 5,
};
allocate_mmo(&env);
reset(&env, 42);
c_reset(&env, 42);

int start = time(NULL);
int num_steps = 0;
while (time(NULL) - start < timeout) {
forward(net, env.obs, env.actions);
step(&env);
c_step(&env);
num_steps++;
}

Expand Down Expand Up @@ -434,15 +434,15 @@ void test_performance(int num_players, int timeout) {
.y_window = 5,
};
allocate_mmo(&env);
reset(&env, 0);
c_reset(&env, 0);

int start = time(NULL);
int num_steps = 0;
while (time(NULL) - start < timeout) {
for (int i = 0; i < num_players; i++) {
env.actions[i] = rand() % 23;
}
step(&env);
c_step(&env);
num_steps++;
}

Expand Down

0 comments on commit 0cb9a31

Please sign in to comment.