Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions doom_creator/resources/assets/acs/retinal.acs
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,6 @@ script "Agent Metabolism" ENTER {
}
}

// Tracking stats
script 10 (int pickedup) {

health_gathered = health_gathered + pickedup;
if(pickedup > 0) { num_nourishments = num_nourishments - 1; }
if(pickedup < 0) { num_poisons = num_poisons - 1; }

}

script "Agent Initialization" ENTER {

int act_x = random(-spawn_range/10,spawn_range/10);
Expand Down
9 changes: 8 additions & 1 deletion doom_creator/util/_templates/acs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,26 @@ def object_variables(typ: str, unique: int, init: int, delay: int):
"""


def actor_function(actor_name: str, values: List[int], heal_or_damage: bool):
def actor_function(actor_name: str, values: List[int], heal_or_damage: str):
actor_name = actor_name.replace("-", "_")
# Actor name will be used in function name, not possible with -
num_values = len(values)
values_string = ",".join([str(v) for v in values])


plus_minus = "+" if heal_or_damage == "Heal" else "-"
update_health_gathered = f"health_gathered = health_gathered {plus_minus} values_{actor_name}[i];"

return f"""\
int values_{actor_name}[{num_values}] = {{ {values_string} }};
script "func_{actor_name}" (void)
{{
int i = Random(0,{num_values}-1);
{heal_or_damage}Thing(values_{actor_name}[i]);

// Update health gathered for stats
{update_health_gathered}

// Free space for spawning
int x = GetActorX(0) >> 16;
int y = GetActorY(0) >> 16;
Expand Down
3 changes: 2 additions & 1 deletion doom_creator/util/_templates/vizdoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def config(scenario_name: str):
}}

# Game variables that will be in the state
available_game_variables = {{ HEALTH }}
available_game_variables = {{ HEALTH USER17 USER18 USER19}}
# USER17 = HEALTH_GATHERED, USER18 = NUM_NOURISHMENTS, USER19 = NUM_POISONS

mode = PLAYER
"""