rubenvereecken / py-vgdl

VGDL 2.0: A video game description language for AI research

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Most games crash - status of the project?

RaphaelMarinier opened this issue · comments

Hello,

I've tested the games in this project. Most games crash either at startup or after a few actions.

For instance, aliens_lvl0.txt crashes with:

$ python -m vgdl.util.humanplay.play_vgdl vgdl/games/aliens_lvl0.txt
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
WARNING:vgdl.util.humanplay.human trace_path provided but could not find the gym_recording package
'BasicGameLevel' object has no attribute '_updateCollisionDict'
Traceback (most recent call last):
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/core.py", line 763, in _event_handling
    effect(s1, None, self)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/core.py", line 1110, in __call__
    return self.call_fn(sprite, partner, game)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/ontology/effects.py", line 92, in turnAround
    game._updateCollisionDict(sprite)
AttributeError: 'BasicGameLevel' object has no attribute '_updateCollisionDict'

frogs_lvl0.txt crashes with:

$ python -m vgdl.util.humanplay.play_vgdl vgdl/games/frogs_lvl0.txt 
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/usr/local/google/home/raphaelm/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/google/home/raphaelm/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/play_vgdl.py", line 102, in <module>
    main()
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/play_vgdl.py", line 90, in main
    controller = controller_cls(env_name, args.tracedir)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/human.py", line 118, in __init__
    super().__init__(env_name, *args)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/human.py", line 15, in __init__
    self.env = gym.make(env_name)
  File "/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/envs/registration.py", line 171, in make
    return registry.make(id, **kwargs)
  File "/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/envs/registration.py", line 123, in make
    env = spec.make(**kwargs)
  File "/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/envs/registration.py", line 87, in make
    env = cls(**_kwargs)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/interfaces/gym/env.py", line 38, in __init__
    self.loadGame(game_desc, level_desc)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/interfaces/gym/env.py", line 48, in loadGame
    domain = vgdl.VGDLParser().parse_game(self.game_desc, **self.game_args)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/parser.py", line 88, in parse_game
    self.parse_interactions(c.children)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/parser.py", line 122, in parse_interactions
    effect = FunctionalEffect(eclass, *args, **kwargs)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/core.py", line 1106, in __init__
    super().__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'resource'

I think I have tried most of the games, and only portals_lvl0.txt and missilecommand_lvl0.txt seem to be working (with the latter one having possibly broken dynamics).

I guess that's because the project is actively being worked on. Is there a past working version that I could use? Do you plan to have a working version in the near future?

For reference, I am using the repo at head (27a38da).

Thanks!

Thanks for confirming why testing is so important!

We had a working version recently. It must have been a recent change, probably an old bug that got uncovered again.

Stick to head, I'm on it and will update this issue with a fix.

Ok, thanks. Looking forward to it.

FYI, here are other types of errors I get on other games (just to let you know the kind of errors that exist).

On zelda:

$ python -m vgdl.util.humanplay.play_vgdl vgdl/games/zelda_lvl0.txt
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/usr/local/google/home/raphaelm/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/google/home/raphaelm/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/play_vgdl.py", line 102, in <module>
    main()
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/play_vgdl.py", line 90, in main
    controller = controller_cls(env_name, args.tracedir)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/human.py", line 118, in __init__
    super().__init__(env_name, *args)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/human.py", line 15, in __init__
    self.env = gym.make(env_name)
  File "/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/envs/registration.py", line 171, in make
    return registry.make(id, **kwargs)
  File "/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/envs/registration.py", line 123, in make
    env = spec.make(**kwargs)
  File "/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/envs/registration.py", line 87, in make
    env = cls(**_kwargs)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/interfaces/gym/env.py", line 38, in __init__
    self.loadGame(game_desc, level_desc)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/interfaces/gym/env.py", line 48, in loadGame
    domain = vgdl.VGDLParser().parse_game(self.game_desc, **self.game_args)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/parser.py", line 88, in parse_game
    self.parse_interactions(c.children)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/parser.py", line 122, in parse_interactions
    effect = FunctionalEffect(eclass, *args, **kwargs)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/core.py", line 1106, in __init__
    super().__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'stype'

On sokoban:

$ python -m vgdl.util.humanplay.play_vgdl vgdl/games/sokoban_lvl0.txt 
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
WARNING: undefined parameter 'key_handler' for game! 
WARNING: undefined parameter 'square_size' for game! 
/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/logger.py:30: UserWarning: WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
  warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow'))
WARNING:vgdl.util.humanplay.human trace_path provided but could not find the gym_recording package
Traceback (most recent call last):
  File "/usr/local/google/home/raphaelm/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/google/home/raphaelm/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/play_vgdl.py", line 102, in <module>
    main()
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/play_vgdl.py", line 93, in main
    window_open = controller.play(args.pause_on_finish)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/util/humanplay/human.py", line 41, in play
    obs, reward, done, info = self.env.step(self.controls.current_action)
  File "/usr/local/google/home/raphaelm/ec_oss33/lib/python3.7/site-packages/gym/wrappers/time_limit.py", line 31, in step
    observation, reward, done, info = self.env.step(action)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/interfaces/gym/env.py", line 105, in step
    self.game.tick(self._action_keys[a])
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/core.py", line 870, in tick
    self._event_handling()
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/core.py", line 794, in _event_handling
    effect(sprite, other, self)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/core.py", line 1110, in __call__
    return self.call_fn(sprite, partner, game)
  File "/usr/local/google/home/raphaelm/py-vgdl-rubenvereecken/vgdl/ontology/effects.py", line 47, in bounceForward
    assert False, 'TODO'
AssertionError: TODO

Also, the original py-vgdl implementation from Tom Schaul had a few additional games that I don't see in your version: dodge, mrpacman, pong, mario, artillery, lander, tankwars. Is there a specific reason why you don't have them?

Thanks,

@RaphaelMarinier thanks! The reason is the same source of those traces you've reported, part of which I'm working on. I reimplemented the 'physics engine' to work based on forces so it becomes possible to have more complicated interactions. The physics of those games haven't been verified/ported. The effort involved with most of them is likely minor, so I think I will have a look at them. On a side note, they would need porting to the new sprites, but that's fun and minor work.

@RaphaelMarinier The games now seem to work fine. Misbehaviour resulted from:

  • New physics + decoupling of pixels and logical units of space, to allow different renderers.
  • Slightly altered event loop, which allows for more complex behaviour.

There is the exception of survivezombies, which should crash after running for a while. The new state keeping is behaving a bit funny, and a runtime sanity check should trigger. I'm going to take my time with that one, as there might be an underlying logical bug. State keeping is hard (and only needed for state saving/loading).

I'm closing this issue, and will add a note to port the other games. They're the continuous physics one, so their behaviour will change, but in a good way.

Much appreciated!

Thanks! Indeed with your last changes I confirm that the games work on my side as well (except survivezombies that you mention).