PedoMan: optimizing time
Since I won't be able to code during this Friday / Saturday due to PyCon Argentina, I need to "optimize" time.Levels:
- A simple SVG (inkscape) parser that generates Box2d code. (it seems that everybody is doing it)
Tiles:
- No time for tiles.
- I'll use box2d's DebugDrawData
Characters:
- It seems that squirtle can't draw circles, it's raising an exception, so I'll use raster images.
Sounds:
- cfxr
Intro:
- Only If I have time to do it
(log in to comment)
Comments
There were some problems with circles in early versions of Squirtle - they should be solved by now, but it's possible that you're using an old version, or that there's another edge case that slipped through. If you can show me the SVG file that gives the exception, I can probably fix it.
@martin, @tartley:
I'm using squirtle 0.2.4
The .svg that is raising the exception is:
http://code.google.com/p/pedoman/source/browse/trunk/data/pedoman-character.svg
This is the traceback
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: m
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 408.57143
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 468.07648
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: a
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 95.714287
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 87.14286
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: -191.42857
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 95.714287
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 87.14286
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 191.42857
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Exception while parsing element <Element '{http://www.w3.org/2000/svg}path' at 0x177237e8>
Exception while parsing element <Element '{http://www.w3.org/2000/svg}g' at 0x177237b8>
Traceback (most recent call last):
File "run_game.py", line 4, in <module>
main.main()
File "/Users/riq/progs/pedoman/gamelib/main.py", line 29, in main
s = get_game_scene()
File "/Users/riq/progs/pedoman/gamelib/game_scene.py", line 372, in get_game_scene
gameModel = GameLayer()
File "/Users/riq/progs/pedoman/gamelib/game_scene.py", line 50, in __init__
self.init_background()
File "/Users/riq/progs/pedoman/gamelib/game_scene.py", line 58, in init_background
self.background = squirtle.SVG( data.filepath("pedoman-character.svg") )
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 253, in __init__
self.generate_disp_list()
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 299, in generate_disp_list
self.parse_doc()
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 399, in parse_doc
self.parse_element(e)
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 557, in parse_element
self.parse_element(c)
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 477, in parse_element
self.close_path()
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 571, in close_path
self.loop.append(self.loop[0][:])
IndexError: list index out of range
I'm using squirtle 0.2.4
The .svg that is raising the exception is:
http://code.google.com/p/pedoman/source/browse/trunk/data/pedoman-character.svg
This is the traceback
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: m
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 408.57143
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 468.07648
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: a
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 95.714287
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 87.14286
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: -191.42857
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 95.714287
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 87.14286
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 1
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 191.42857
Warning: SVG Parser (/Users/riq/progs/pedoman/data/pedoman-character.svg) - Unrecognised opcode: 0
Exception while parsing element <Element '{http://www.w3.org/2000/svg}path' at 0x177237e8>
Exception while parsing element <Element '{http://www.w3.org/2000/svg}g' at 0x177237b8>
Traceback (most recent call last):
File "run_game.py", line 4, in <module>
main.main()
File "/Users/riq/progs/pedoman/gamelib/main.py", line 29, in main
s = get_game_scene()
File "/Users/riq/progs/pedoman/gamelib/game_scene.py", line 372, in get_game_scene
gameModel = GameLayer()
File "/Users/riq/progs/pedoman/gamelib/game_scene.py", line 50, in __init__
self.init_background()
File "/Users/riq/progs/pedoman/gamelib/game_scene.py", line 58, in init_background
self.background = squirtle.SVG( data.filepath("pedoman-character.svg") )
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 253, in __init__
self.generate_disp_list()
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 299, in generate_disp_list
self.parse_doc()
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 399, in parse_doc
self.parse_element(e)
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 557, in parse_element
self.parse_element(c)
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 477, in parse_element
self.close_path()
File "/Users/riq/progs/pedoman/gamelib/squirtle.py", line 571, in close_path
self.loop.append(self.loop[0][:])
IndexError: list index out of range
you can try squirtle_mod, see
http://groups.google.com/group/cocos-discuss/browse_thread/thread/0e717b55a1859b6d#
http://www.pyweek.org/d/2676/#comment-5637
The download link is
http://groups.google.com/group/cocos-discuss/web/squirtle_mod_bugfix2.zip
It is based on squirtle, has a bit of fix and extension over standart squirtle.
Comes in two flawors: squirtle classic or cocosnode style.
http://groups.google.com/group/cocos-discuss/browse_thread/thread/0e717b55a1859b6d#
http://www.pyweek.org/d/2676/#comment-5637
The download link is
http://groups.google.com/group/cocos-discuss/web/squirtle_mod_bugfix2.zip
It is based on squirtle, has a bit of fix and extension over standart squirtle.
Comes in two flawors: squirtle classic or cocosnode style.
by the way, the svg you pointed is displayed ok with squirtle_mod
or, as a workaround: in Inkscape select the offending object and do 'object to path' ('objeto a trayecto'), under the 'Trayecto' ('paths'?) menu.
hint: arcs are not 100% ok in squirtle or squirtle_mod
hint: arcs are not 100% ok in squirtle or squirtle_mod
@claxo: thanks.
Ha. When I said 'I'll take a look at it", I also typed a sentence along the lines of "although people far more qualifed to do so are present, obviously", but that got lost somehow. :-)
tartley on
2009/09/02 15:12:
Oooh, my memories of looking at the squirtle code makes me think it *should* be able to draw circles. Am I wrong?If you want to post the exception it produces, plus the svg it's trying to load, I'll take a quick look at it for you - maybe there's a quick change can be applied to your copy of Squirtle (or your SVG?) to make it work.