import os import yaml import jsonlines enemies = [] print("Reading enemies (this will take a few seconds)") with open("enemy_configuration_table.yml") as input_enemies_file: input_enemies = yaml.safe_load(input_enemies_file) print("Parsing enemies") for enemy_id, enemy in input_enemies.items(): enemy_name = enemy.get("Name") if enemy_name == "null": enemy_name = None enemies.append({"file_name": "{:03d}".format(enemy_id), "name": enemy_name}) print("Writing enemy metadata") with jsonlines.open(os.path.join("sprites", "train", "metadata.jsonl"), "w") as writer: writer.write_all(enemies) print("Done!")