Doctor Korovic's Flying Atomic Squid - Day 7
It's done! Some features didn't quite make it in, such as balloons, though I did get as far as making the physical rope to connect them. Susie briefly had tentacles (squid have two long tentacles and eight short ones) - but it affected the flight dynamics too much.Among various other features, I added a title screen:
I wish I had another week to work on it! So many possibilities - but the code is in dire need of a refactor now. Such is the way of Pyweek.
Congratulations to everyone on all their brilliant games. I look forward to playing them!
(log in to comment)
Comments
ImportError: No module named pkg_resources
Yes, you need setuptools/distribute. I'll add that to the readme.
I do not have PIP I think
Pip is excellent and you should get it. You can also use easy_install, I believe, if you have that.
Lepton <- this one asked for Python 2.6
I'm running it quite happily under Python 2.7.2.
AttributeError: 'Space' object has no attribute 'static_body'
The version of Pymunk required is specified in the installer - pymunk==2.1.0. If you install pip you can check what packages are installed by running "pip freeze". I imagine you've got a slightly different version that this. However, there is an easy workaround for this one particular issue that I can include in the next tarball if you like.
error: Setup script exited with error: Unable to find vcvarsall.bat
I imagine that's trying to compile a dependency? I don't know Windows. Maybe this solution which I found on the Googles?
http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat
Thanks for your feedback; I'm packaging my fixes now. Let's get this working for you!
python setup install now worked (ended with error:none, using both Python 2.6 and Python 2.7)
Launched the game with python run_game.py (2.6) and I got this:
Launched the game with python run_game.py (2.6) and I got this:
C:\Users\BlueDragon\Downloads\korovic-1.0.3\korovic-1.0.3>python run_game.py
Loading chipmunk for Windows (32bit) [C:\Panda3D-1.7.2\python\lib\site-packages\
pymunk\chipmunk.dll]
Exception AttributeError: "'Body' object has no attribute '_body'" in <bound met
hod Body.__del__ of <pymunk.Body object at 0x05543910>> ignored
Traceback (most recent call last):
File "run_game.py", line 2, in <module>
main()
File "C:\Users\BlueDragon\Downloads\korovic-1.0.3\korovic-1.0.3\korovic\__mai
n__.py", line 9, in main
g.start(level=options.level)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.3\korovic-1.0.3\korovic\game.
py", line 19, in start
self.game = self.scene = Scene(self, level=level)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.3\korovic-1.0.3\korovic\scene
.py", line 30, in __init__
self.world = World('level%d' % self.level)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.3\korovic-1.0.3\korovic\world
.py", line 47, in __init__
self.load(initial_level)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.3\korovic-1.0.3\korovic\world
.py", line 105, in load
self.create_wall()
File "C:\Users\BlueDragon\Downloads\korovic-1.0.3\korovic-1.0.3\korovic\world
.py", line 181, in create_wall
body = pymunk.Body()
TypeError: __init__() takes exactly 3 arguments (1 given)
Python 2.7 instead tells me:
ImportError: No module named lepton
This page offered Lepton (windows compiled) for 2.6 only:
http://code.google.com/p/py-lepton/downloads/list
Found another Lepton here:
http://pypi.python.org/pypi/lepton/1.0b2
I tried to launch python setup.py install to get it working but got again:
Python 2.7 instead tells me:
ImportError: No module named lepton
This page offered Lepton (windows compiled) for 2.6 only:
http://code.google.com/p/py-lepton/downloads/list
Found another Lepton here:
http://pypi.python.org/pypi/lepton/1.0b2
I tried to launch python setup.py install to get it working but got again:
building 'lepton.group' extension
error: Unable to find vcvarsall.bat
I'll check the link about this error you posted.
I'll check the link about this error you posted.
Tried to compiled Lepton with
setup.py install build --compiler=mingw32`
but I got
error: don't know how to compile C/C++ code on platform 'nt' with 'mingw32`' com
piler
I'm starting to hate Lepton :)
I'm starting to hate Lepton :)
Can you do a pip freeze and tell me what versions of what packages are installed?
I had to go through this yesterday to package our game. I actually got an error message about -mno-cygwin then which was solved via the first hit on Google -- by removing this flag in the distutils source... Developing on Windows seems really painful and messy.
"at line 102 in camera.py"
"gl.glPushMatrix(gl.GL_MODELVIEW)"
"this function takers 0 arguments"
I usually use openGL 2.1 and openGL ES 2.0, in c/c++
in C api glPushMatrix and glPopMatrix have zero arguments, now I don't know what pyglet to do.
But I think the fix is:
i change your code
FORM
i change your code
FORM
@contextmanager
def modelview(self):
gl.glPushMatrix(gl.GL_MODELVIEW)
try: gl.glMatrixMode(gl.GL_MODELVIEW)
x, y = self.pos - self.ss
gl.glTranslatef(-x, -y, 0)
yield
finally:
gl.glPopMatrix(gl.GL_MODELVIEW)
IN
@contextmanager
IN
@contextmanager
def modelview(self):
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glPushMatrix()
try:
x, y = self.pos - self.ss
gl.glTranslatef(-x, -y, 0)
yield
finally:
gl.glPopMatrix()
p.s. sorry for my horrible english.
p.s. sorry for my horrible english.
I've made that mistake before: I make the API call from (faulty) memory, and pyglet lets me get away with it in whatever version I use.
I've rolled in the pymunk and pyglet compat fixes in the PyPI version - this contains no changes other than compatibility fixes:
http://pypi.python.org/pypi/korovic/1.0.4
Or perhaps you'd like to pull from the repo:
https://bitbucket.org/lordmauve/korovic
One thing I immediately noticed is that there was no music: this game deserves to have some music, so if you plan on working on it, get some music in it! :)
The story idea is excellent, beautifully done!
Too bad I could see only lvl 1.
When I click to fly, here's what happens:
Traceback (most recent call last):
File "run_game.py", line 2, in <module>
main()
File "C:\Users\BlueDragon\Downloads\korovic-1.0.4\korovic-1.0.4\korovic\__main__.py", line 9, in main
g.start(level=options.level)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.4\korovic-1.0.4\korovic\game.py", line 42, in start
pyglet.app.run()
File "C:\Panda3D-1.7.2\python\lib\site-packages\pyglet\app\__init__.py", line 264, in run
EventLoop().run()
File "C:\Panda3D-1.7.2\python\lib\site-packages\pyglet\app\win32.py", line 63, in run
self._timer_func(0, 0, timer, 0)
File "C:\Panda3D-1.7.2\python\lib\site-packages\pyglet\app\win32.py", line 84, in _timer_func
sleep_time = self.idle()
File "C:\Panda3D-1.7.2\python\lib\site-packages\pyglet\app\__init__.py", line 187, in idle
dt = clock.tick(True)
File "C:\Panda3D-1.7.2\python\lib\site-packages\pyglet\clock.py", line 700, in tick
return _default.tick(poll)
File "C:\Panda3D-1.7.2\python\lib\site-packages\pyglet\clock.py", line 303, in tick
item.func(ts - item.last_ts, *item.args, **item.kwargs)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.4\korovic-1.0.4\korovic\game.py", line 76, in update
self.scene.update(dt)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.4\korovic-1.0.4\korovic\scene.py", line 74, in update
self.world.update(dt)
File "C:\Users\BlueDragon\Downloads\korovic-1.0.4\korovic-1.0.4\korovic\world.py", line 221, in update
self.space.step(0.2 / TARGET_FPS)
File "C:\Panda3D-1.7.2\python\lib\site-packages\pymunk\__init__.py", line 279, in step
cp.cpSpaceStep(self._space, dt)
WindowsError: exception: access violation reading 0x0000000C
Python 2.7 is still stuck on not being able to install Lepton.
---> using setup still fails with unable to find vcvarsall.bat
---> I tried using VirtualEnv + PIP but got into the same error vcvarsall.bat
@cyhawk - I included the backtick because it was included in the suggestion I found in internet and I had actually misread the error without backtick (so I thought it was better with the backtick on).
Without backtick it says:
building 'lepton.group' extension
gcc -mno-cygwin -mdll -O -Wall -DGLEW_STATIC -I../include -Iglew/include -Ic:\Py
thon27\include -Ic:\Python27\PC -c lepton/group.c -o build\temp.win32-2.7\Releas
e\lepton\group.o
error: command 'gcc' failed: No such file or directory
I thought it said I had no gcc but it is actually saying that group.o is missing.
A step forward then before I guess.
I thought it said I had no gcc but it is actually saying that group.o is missing.
A step forward then before I guess.
Added c:\MinGW\bin to path and now I get this:
building 'lepton.group' extension
c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DGLEW_STATIC -I../include -Igle
w/include -Ic:\Python27\include -Ic:\Python27\PC -c lepton/group.c -o build\temp
.win32-2.7\Release\lepton\group.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
I found out that '-mno-cygwin' was an old option of MinGw. The solution on the internet was to either get rid of that option or downgrade MinGw. I followed the first route.
To make story short, I tracked down the option to line 323 of cygwincompiler.py in distutils, inside Mingw32CCompiler class it says:
compiler_so='gcc -mno-cygwin -mdll -O -Wall',
commented it out and put the following instead:
compiler_so='gcc -mdll -O -Wall',
It now runs beatifully on 2.7: I still have to fly it but it doesn't crash now, I can see the squid quietly resting on the beach :)
I got a Biplane-RearPropeller-LargeTank design to fly 16881m, mainly by gliding.
By careful flying it can probably fly much further.
The city defences (baloons) actually helped me in one case, as I frequently overshoot the city in level 3 (my designs were not stable enough to fly close water up to the city)
Given the difficulty (I think) of getting the physics right to make it playable, this game is awesome :)
Graphics are beatiful, the (short) story/idea too and sounds are good albeit music is sadly missing.
(we need a nice soundtrack to keep us company while we glide for kilometers).
This game is a candidate for top ranking spots imo.
Another interesting addition would be: how fast are we flying? Add a speedmeter please :)
It would also help when you are far high and you need to calculate when it's time to dive down to the city :)
- add a "Fly Time" timer as well, this way we know long we fly
\---> this could lead to competitions such as "Who has gone highest in less than 15 sec", 'Who has flown farther within 1, 5, 10 mins..etc" :)
Sorry for making lots of posts but it seems there's no edit/remove feature in the forum.
F12 gave an error:
File "c:\Python27\lib\site-packages\pyglet\image\__init__.py", line 434, in save
file = open(filename, 'wb')
IOError: [Errno 22] invalid mode ('wb') or filename: 'screenshot_2012-05-15_22:45:48.749000.png'
Anyway, here's the pic:
http://oi47.tinypic.com/kcgqc8.jpg
23166m.. and I know it can probably do a lot more! :)
However, it is mainly flown by gliding, so it takes some time to reach these distances.
Bug/Minor issues:
- sometimes, when you press fly, the squid appears for a brief second and then it returns to the lab screen
- it is not always easy to click on the desired component (e.g. fuel) as it can easily select a different one.
This happens especially with the jet. I usually have to remove everything, put the jet, adjust it, and then add the other components.
Are you going to develop it further?
Anyway, here's the pic:
http://oi47.tinypic.com/kcgqc8.jpg
23166m.. and I know it can probably do a lot more! :)
However, it is mainly flown by gliding, so it takes some time to reach these distances.
Bug/Minor issues:
- sometimes, when you press fly, the squid appears for a brief second and then it returns to the lab screen
- it is not always easy to click on the desired component (e.g. fuel) as it can easily select a different one.
This happens especially with the jet. I usually have to remove everything, put the jet, adjust it, and then add the other components.
Are you going to develop it further?
Ah, you can't put colons in filenames in Windows, can you? The screenshot filename is in korovic/screenshot.py, line 12. Take the colons out and it will work, I believe.
Thanks for the bug reports. I'd certainly like to develop it further, only I've exhausted my girlfriend's patience by "ignoring her" for a week, so it's going to be a little while before I can do much more on it.
on the bitbucket page. I don't have much experience of distributing Python under Windows, so I hope it works.
Hey, thanks BlueDragon! I followed all your workarounds and got it to build with py2exe, so it's now available I had only to take the readme from the previous version since it is not in the zip and I wasn't able to find the keys.
However, looking at the screenshots of your Pyweek I noticed a possible bug (which was present in earlier versions too)... I saw you worked on jet engines, rockets....and they are not in the game! At first I thought you had decided to cut those features, but then I realized they are in the game data, however they are never shown!
I've decided to comment out the following code:
# if item.price > max_money:
# continue
(in editor_hud.py)
Commenting these lines makes Jet engine, Rotor and Rocket available from the first level.
Given that in the SHOP list you have commented out Balloon but not these 3, I suspect that Jet engine, Rotor and Rocket were actually meant to appear in later levels when you have enough money to buy them....however they do not appear even in level 5!
So I assume there must be a bug somewhere - however simply deleting the lines I commented could work too, since showing these items on first level when you cannot buy them "ruins the surprise" but also gives you a goal to aim for to get to the next level.
Talking about bugs, I noticed that if you skip very fast all the dialogue in the intro, the game crashes:
(in editor_hud.py)
Commenting these lines makes Jet engine, Rotor and Rocket available from the first level.
Given that in the SHOP list you have commented out Balloon but not these 3, I suspect that Jet engine, Rotor and Rocket were actually meant to appear in later levels when you have enough money to buy them....however they do not appear even in level 5!
So I assume there must be a bug somewhere - however simply deleting the lines I commented could work too, since showing these items on first level when you cannot buy them "ruins the surprise" but also gives you a goal to aim for to get to the next level.
Talking about bugs, I noticed that if you skip very fast all the dialogue in the intro, the game crashes:
Traceback (most recent call last):
File "run_game.py", line 2, in <module>
File "korovic\__main__.pyc", line 9, in main
File "korovic\game.pyc", line 42, in start
File "pyglet\app\__init__.pyc", line 264, in run
File "pyglet\app\win32.pyc", line 63, in run
File "pyglet\app\win32.pyc", line 84, in _timer_func
File "pyglet\app\__init__.pyc", line 187, in idle
File "pyglet\clock.pyc", line 700, in tick
File "pyglet\clock.pyc", line 303, in tick
File "korovic\game.pyc", line 76, in update
File "korovic\cutscene.pyc", line 165, in update
File "korovic\cutscene.pyc", line 169, in run_steps
IndexError: list index out of rangeI think this happens only if you manage to skip all the dialogue before your squid reaches the water, so it's a very minor bug :)
korovic --level 4
etc, which is how I tested the later levels.
You can safely delete those lines, yes.
It's also very difficult to lift off with Jet Engines only - no wonder real airliner jets needs a long runway :)
Rotor engines instead are a bit difficult to use, in part because it's not easy to select them in the UI, like Pulse Jets, but their vertical thrust can be useful.
The rockets instead are easy, straightforward and fun in the first levels :)
Anyway, while trying to lift off a dual-large tank, I ended up with scrapping jets and putting 3 propellers (front, rear, top). This weird model managed to cover his first few kilometers very quickly and reached almost 2km altitude, so I decided to glide from there and see what happened:
http://oi49.tinypic.com/2rn7mtu.jpg
32794m :)
Traceback (most recent call last):
File "run_game.py", line 2, in <module>
main()
File "/Users/leif/Downloads/pyweek14/korovic-1.0.5/korovic/__main__.py", line 9, in main
g.start(level=options.level)
File "/Users/leif/Downloads/pyweek14/korovic-1.0.5/korovic/game.py", line 19, in start
self.game = self.scene = Scene(self, level=level)
File "/Users/leif/Downloads/pyweek14/korovic-1.0.5/korovic/scene.py", line 30, in __init__
self.world = World('level%d' % self.level)
File "/Users/leif/Downloads/pyweek14/korovic-1.0.5/korovic/world.py", line 47, in __init__
self.load(initial_level)
File "/Users/leif/Downloads/pyweek14/korovic-1.0.5/korovic/world.py", line 133, in load
self.create_island(x, x + iw)
File "/Users/leif/Downloads/pyweek14/korovic-1.0.5/korovic/world.py", line 193, in create_island
self.space.add_static(pymunk.Segment(body, p1, p2, SEA_LEVEL))
File "/Library/Python/2.7/site-packages/pymunk/__init__.py", line 289, in add_static
self._add_static_shape(o)
File "/Library/Python/2.7/site-packages/pymunk/__init__.py", line 331, in _add_static_shape
assert static_shape._hashid_private not in self._static_shapes, "shape already added to space"
AssertionError: shape already added to space
os x lion, xcode 3.2, python 2.7
os x lion, xcode 3.2, python 2.7
First please check if you have pymunk 2.1.0. My game requires pymunk 2.1.0 exactly, as defined in setup.py and in the README. If you do have this version then I'll have to consider less likely causes.
BlueDragon on 2012/05/13 14:39:
I was looking forward to play your game but got disappointed :(At first I got this one:
I tried the other suggested method but they failed as well (python setup.py install , I do not have PIP I think)
Setuptools
Pymunk
Lepton <- this one asked for Python 2.6, so I had to install again the previous two again.
PyGame (I had it, but not on 2.6)
and finally I got this:
I thought that I might have done something wrong during the libraries install so I tried the "automatic setup" again as well:
python setup.py install
It gave a lot of messages (suggesting it was doing well) but then it ended with:
error: Setup script exited with error: Unable to find vcvarsall.bat
I stopped here :(