Package: gym-zelda-1
gym-zelda-1AnOpenAI Gymenvironment for The Legend of
Zelda (i.e., Zelda 1) on The Nintendo Entertainment System (NES) based on
thenes-pyemulator.InstallationThe preferred installation ofgym-zelda-1is frompip:pipinstallgym-zelda-1UsagePythonYou must importgym_zelda_1before trying to make an environment.
This is because gym environments are registered at runtime. By default,gym_zelda_1environments use the full NES action space of 256
discrete actions. To constrain this,gym_zelda_1.actionsprovides
an action list calledMOVEMENT(20 discrete actions) for thenes_py.wrappers.JoypadSpacewrapper.fromnes_py.wrappersimportJoypadSpaceimportgym_zelda_1fromgym_zelda_1.actionsimportMOVEMENTenv=gym_zelda_1.make('Zelda1-v0')env=JoypadSpace(env,MOVEMENT)done=Trueforstepinrange(5000):ifdone:state=env.reset()state,reward,done,info=env.step(env.action_space.sample())env.render()env.close()NOTE:gym_zelda_1.makeis just an alias togym.makefor
convenience.NOTE:remove calls torenderin training code for a nontrivial
speedup.Command Linegym_zelda_1features a command line interface for playing
environments using either the keyboard, or uniform random movement.gym_zelda_1-m<`human`or`random`>StepInfo about the rewards and info returned by thestepmethod.Reward FunctionTODO: The reward function is a complicated work in progress.infodictionaryTheinfodictionary returned by thestepmethod contains the following
keys:KeyTypeDescriptioncurrent_levelintThe current level Link is in (0 for overworld)x_posintLink'sxposition in the screen (from the left)y_posintLink'syposition in the screen (from the top)directionstrLink's direction as one of{"N", "S", "E", "W"}has_candledboolWhether Link has candled the current roompulse_1strThe signal playing through pulse 1pulse_2strThe signal playing through pulse 2killed_enemiesintThe number of enemies killednumber_of_deathsintThe number of times Link has diedswordstrThe kind of sword Link hasnumber_of_bombsintThe number of bombs in Link's inventoryarrows_typestrThe kind of arrows in Link's inventoryhas_bowboolWhether Link has the bow in his inventorycandle_typestrThe type of candle in Link's inventoryhas_whistleboolWhether Link has the whistle in his inventoryhas_foodboolWhether Link has food in his inventorypotion_typestrThe type of potion in Link's inventoryhas_magic_rodboolWhether Link has the magic rod in his inventoryhas_raftboolWhether Link has the raft in his inventoryhas_magic_bookboolWhether Link has the magic book in his inventoryring_typestrThe type of ring in Link's inventoryhas_step_ladderboolWhether Link has the step ladder in his inventoryhas_magic_keyboolWhether Link has the magic key in his inventoryhas_power_braceletboolWhether Link has the power bracelet in his inventoryhas_letterboolWhether Link has the letter in his inventoryis_clock_possessedboolWhether the clock is possessedrupeesintThe number of rupess Link has collectedkeysintThe number of keys in Link's inventoryheart_containersintThe number of heart containers that Link hasheartsfloatThe number of remaining health Link hashas_boomerangboolWhether Link has the boomerang in his inventoryhas_magic_boomerangboolWhether Link has the magic boomerang in his inventoryhas_magic_shieldboolWhether Link has the magic shield in his inventorymax_number_of_bombsintThe maximum number of bombs Link can carryCitationPlease citegym-zelda-1if you use it in your research.@misc{gym-zelda-1,
  author ={Christian Kauten},
  title ={{The Legend of Zelda}for{OpenAI Gym}},
  year ={2019},
  publisher ={GitHub},
  howpublished ={\url{https://github.com/Kautenja/gym-zelda-1}},}ReferencesThe following references contributed to the construction of this project.The Legend of Zelda: RAM Map.Data Crystal ROM Hacking.The Legend of Zelda: Memory Addresses.NES Hacker.