Monster Mechanics - Final Day Madness
It's the final day - corners are being cut, coffee is being brewed, features are dropping, bugs are creeping... when will it all end?(log in to comment)
Comments
mihi@lenore:/tmp/monstermechanics-1.0.0$ python run_game.py
Traceback (most recent call last):
File "run_game.py", line 3, in <module>
monstermechanics.__main__.main()
File "/tmp/monstermechanics-1.0.0/monstermechanics/__main__.py", line 28, in main
game.start()
File "/tmp/monstermechanics-1.0.0/monstermechanics/game.py", line 177, in start
pyglet.app.run()
File "/usr/lib/pymodules/python2.6/pyglet/app/__init__.py", line 264, in run
EventLoop().run()
File "/usr/lib/pymodules/python2.6/pyglet/app/xlib.py", line 94, in run
sleep_time = self.idle()
File "/usr/lib/pymodules/python2.6/pyglet/app/__init__.py", line 187, in idle
dt = clock.tick(True)
File "/usr/lib/pymodules/python2.6/pyglet/clock.py", line 696, in tick
return _default.tick(poll)
File "/usr/lib/pymodules/python2.6/pyglet/clock.py", line 303, in tick
item.func(ts - item.last_ts, *item.args, **item.kwargs)
File "/tmp/monstermechanics-1.0.0/monstermechanics/game.py", line 100, in update
self.update_timers(dt)
File "/tmp/monstermechanics-1.0.0/monstermechanics/game.py", line 94, in update_timers
callback()
File "/tmp/monstermechanics-1.0.0/monstermechanics/game.py", line 209, in spawn_next_enemy
monster = Monster.enemy_from_json(self.world, 'data/enemies/enemy%d.json' % self.enemy_number)
File "/tmp/monstermechanics-1.0.0/monstermechanics/monster.py", line 766, in enemy_from_json
m = Monster.from_json(world, mutant, 'enemy')
File "/tmp/monstermechanics-1.0.0/monstermechanics/monster.py", line 730, in from_json
body1._joints.append((body2, body1.body.restore_joint(body2.body, j)))
File "/tmp/monstermechanics-1.0.0/monstermechanics/box2d_physics.py", line 191, in restore_joint
return self._create_joint(another, v(*js['anchor1']) * SCALE, v(*js['anchor2']) * SCALE, js['angle'], js['refAngle'])
File "/tmp/monstermechanics-1.0.0/monstermechanics/box2d_physics.py", line 206, in _create_joint
j = StiffJoint(self.world, joint, self, another)
File "/tmp/monstermechanics-1.0.0/monstermechanics/box2d_physics.py", line 227, in __init__
self.joint = world.world.CreateJoint(jointdef).getAsType()
AttributeError: 'b2RevoluteJoint' object has no attribute 'getAsType'
Exception AttributeError: "'StiffJoint' object has no attribute 'joint'" in <bound method StiffJoint.destroy of <monstermechanics.box2d_physics.StiffJoint object at 0x2d2ca90>> ignored
Moste useless compiling and installing of dependencies....
all of its recent versions, so it's that I chose to work with. Unfortunately I don't think it's really justifiable to support different versions of a physics library during Pyweek itself.
However to mitigate the compatibility problems I made sure I didn't litter Box2D calls throughout the code. Everything pokes through a common physics abstraction layer so that it should be easier to bolt in different versions of Box2D or even completely different physics engines. If you let me know exactly what version of pybox2d you have been able to obtain I'll try to add an adapter for it tomorrow. For newer Box2D it's likely to involve just a few minor API changes.
Thanks, mihi, I anticipated this. When I chose Box2D it was because I know it better than Pymunk or ODE or anything, but I noticed it doesn't look like there's been a stable release in a while. Ubuntu includes the same version of python-box2d 2.0.2+svn20100109.244-1build1 in However to mitigate the compatibility problems I made sure I didn't litter Box2D calls throughout the code. Everything pokes through a common physics abstraction layer so that it should be easier to bolt in different versions of Box2D or even completely different physics engines. If you let me know exactly what version of pybox2d you have been able to obtain I'll try to add an adapter for it tomorrow. For newer Box2D it's likely to involve just a few minor API changes.
I'm on Ubuntu, but I installed Box2D-2.0.2b2 for... some reason. I think it was to get another game to work. Is there some easy way to remove it and go back to the version from the repository? I tried setup.py uninstall but it didn't work, of course. ^^
python run_game.py
Traceback (most recent call last):
File "run_game.py", line 3, in <module>
monstermechanics.__main__.main()
File "/home/ehsanul/python/others-entries/monstermechanics-1.0.1/monstermechanics/__main__.py", line 28, in main
game.start()
File "/home/ehsanul/python/others-entries/monstermechanics-1.0.1/monstermechanics/game.py", line 147, in start
self.world = World()
File "/home/ehsanul/python/others-entries/monstermechanics-1.0.1/monstermechanics/world.py", line 11, in __init__
self.world = physics.create_world(gravity=v(0, -500))
File "/home/ehsanul/python/others-entries/monstermechanics-1.0.1/monstermechanics/box2d_physics.py", line 35, in create_world
I installed it via easy_install because apt-get tells me there's no 'python-box2d' package. :/
What distro are you using? Recent versions of Ubuntu and Debian all have the same version of python-box2d.
E:\tmp\pyweek13\monstermechanics-1.0.1>run_game.py
Traceback (most recent call last):
File "E:\tmp\pyweek13\monstermechanics-1.0.1\run_game.py", line 3, in <module>
monstermechanics.__main__.main()
File "E:\tmp\pyweek13\monstermechanics-1.0.1\monstermechanics\__main__.py", li
ne 28, in main
game.start()
File "E:\tmp\pyweek13\monstermechanics-1.0.1\monstermechanics\game.py", line 1
77, in start
pyglet.app.run()
File "D:\hg_externals\pyglet_12dev\pyglet\app\__init__.py", line 123, in run
event_loop.run()
File "D:\hg_externals\pyglet_12dev\pyglet\app\base.py", line 133, in run
self._run_estimated()
File "D:\hg_externals\pyglet_12dev\pyglet\app\base.py", line 161, in _run_esti
mated
timeout = self.idle()
File "D:\hg_externals\pyglet_12dev\pyglet\app\base.py", line 276, in idle
window.dispatch_event('on_draw')
File "D:\hg_externals\pyglet_12dev\pyglet\window\__init__.py", line 1151, in d
ispatch_event
if EventDispatcher.dispatch_event(self, *args) != False:
File "D:\hg_externals\pyglet_12dev\pyglet\event.py", line 358, in dispatch_eve
nt
self._raise_dispatch_exception(event_type, args, handler)
File "D:\hg_externals\pyglet_12dev\pyglet\event.py", line 355, in dispatch_eve
nt
if handler(*args):
File "E:\tmp\pyweek13\monstermechanics-1.0.1\monstermechanics\game.py", line 1
21, in on_draw
self.world.draw()
File "E:\tmp\pyweek13\monstermechanics-1.0.1\monstermechanics\world.py", line
52, in draw
a.draw()
File "E:\tmp\pyweek13\monstermechanics-1.0.1\monstermechanics\actor.py", line
78, in draw
self.sprite.set_position(*self.body.get_position())
File "E:\tmp\pyweek13\monstermechanics-1.0.1\monstermechanics\box2d_physics.py
", line 157, in get_position
return v(*self.body.GetPosition()) / SCALE
TypeError: v() argument after * must be a sequence, not b2Vec2
windows xp sp3, python 2.6.5, box2D from Box2D-2.0.2b1.win32-py2.6.exe
File "/home/ehsanul/python/others-entries/monstermechanics-1.0.1/monstermechanics/box2d_physics.py", line 35, in create_world
world_bounds = b2AABB()
NameError: global name 'b2AABB' is not defined
Claxo: it appears it doesn't work at all with 2.0.2b1 - the problem here is just that b2Vec2 isn't iterable. It's very possible that the other differences between this and the versions that I've tested are minimal. You could try a monkey patch:
def b2vec2iter(self):
yield self.x
yield self.y
b2Vec2.__iter__ = b2vec2iter
There may be other problems though.
cyhawk on 2011/09/17 10:40:
Looks like you cut a lot of the corners on the left side but not much on the right :).