Screenshot 2

yield None


Every surface obtained from a polygonal region by pasting its edges in pairs is homeomorphic to either the sphere, the n-fold torus or the m-fold projective plane.


Give this entry an award


Ratings (show detail)

Overall: 3.9
Fun: 3.8
Production: 3.5
Innovation: 4.3

Respondents: 27


File Size Uploader Date
The previous version should work fine on any computer less than 5 years old. This version runs at full 30fps on my PIII 866mhz (except in minor cases). Also added fullscreen toggle with the f key.
1.3 MB Pig 2009/09/06 14:33
File containing license and attribution for resources used. Or at least the ones I could track down.
1.7 KB Pig 2009/09/06 01:50
Screenshot 2
21.6 KB Pig 2009/09/05 23:54
Fixed debug. Final.
1.3 MB Pig 2009/09/05 23:53
Final version
1.3 MB Pig 2009/09/05 23:48
900.1 KB Pig 2009/09/01 18:49

Diary Entries

What in R^n?

Well, coming in first was definitely a nice surprise. There were some very fun, elaborate and well made games that I played during the judging period. Congratulations to all the other entries! I enjoyed playing them.

Since I had never released a game to the general public before, I wasn't sure how well it would be received. I'm very glad that people enjoyed my game. It is especially satisfying to see from the comments that players liked various aspects of the game, some of which I thought might be overlooked. So thank you for all your comments!

I am of course hoping to release a post-competition version but as usual, there isn't that much free time to do this so there may be a short delay. But given the feedback, I definitely want to work on this some more.


Comment and questions.

Post them all here.

Add a comment


It would probably be better if people played the game before reading this. But there are probably no major "spoilers" in here.

So I originally intended to only work on this the first and last day since that's the only time I really had any time for this. Well, actually, I didn't intend on participating at all since it was during a very busy week. But then I got a good idea the first day and felt complelled to implement it.

I ended up working on this for 3 more evenings during the week and also took some time during lunch to find content.

Answers to some never asked questions
-I start story mode and nothing happens. I just see a screen with keys and what they do.
The game starts out paused (Delta t=0) so just press p to unpause.
-How do I jump on the last level?
Press z. You can't jump in the previous levels.
-Why can I jump only once?
You can jump more than once but it takes quite some time for it to recharge. When you can jump, a "z" appears at the top right of the screen.
-Is level 7 really possible?
Yes, but I have to jump twice. Once after w=8 and once for the final jump.
-This game is too hard. How to I cheat?
Uncomment the only line that says
-Why does the animation in level 3 look wrong?
See the first point in the To do list at the end.
-Why does the quill move forward and turn slowly? Isn't this an action game.
I wanted this game to be more about planning ahead than about reflexes. But actually, it turned out that many levels can be solved if you are either good at planning or have good reflexes (except possibly the last level, where you might need a bit of both).
-Why can't the shapes/polytopes solve their own problem?
They only exist "on paper". Initially, I wanted to make it more obvious that the quill and S^20 only communicate with each other through the surface the quill is on (and then the sphere would only see the shadow of the quill and of course, vice versa).

Collision detection
I originally thought that having collision detection would be too slow because of the number of line segments to intersect them with. This wasn't even close to being a problem so its good to know for the future that drawing continuous lines using line segments is a very doable thing (I was already start to think of ways using fewer segments and circle arcs).

What did cause a problem with collision detection was the arithmetics (see previous journal entries for this). No more problem occured after that. I meant to but didn't have time to implement the suggestion.

I think that I (accidentally) made the right choice in picking a project that I originally thought could be done in one day. I got more and more ideas as the week progressed (many of which I didn't have time to implement). The original idea was just a quill pen drawing on various topological surfaces. If I participate again, I'd want to make a game of approximately the same complexity (unless there were other members, of course).

I knew well beforehand that I couldn't generate graphics, sounds or fonts. And this is not because I lack the time to do so (although, I do lack to time to do that). What came to a surprise was that content that was appropriate was very hard to find (needed it to be some kind of free license and have it all fit together somehow). Even the quill itself took some time. In fact, I spent a lot of time removing transparent pixel from the one I did finally find. It would definitely be interesting to know where other participants find their resources (and why these sources are good). I used the links on the pygame resources page but I think there are better things out there.

Complex numbers
Using python's built in complex numbers worked surprisingly well for managing 2d points although I don't think this is their original purpose. This also made rotating easier later on (e.g.,:*1j for pi/2). It was also useful when I wanted to specify a point in polar coordinates rather than Cartesian.

To do list (which time did not permit)
In approximate order of "priority":
-Show the line "This animation has been modified to fit your monitor and mind." to the animation at the beginning of level 3. I kept forgetting to add this and it ended up not in the current version. This is the explanation for not seeing higher dimensional polytopes despite the text refering the them (in fact, the code itself does allow the drawing of the higher dimensional ones).
-Add an ending screen. I already vaguely know what I'd want to put there but its far too specific to be found on the internet (except maybe for copying and pasting).
-Add a second ending screen (There are currently two very slightly distinguishable endings for those who've noticed. That's because two endings were intended.)
-A boss level.
-Fix the level menu so that the "Back" button isn't drawn off-screen.
-Add more game modes, each of which includes some of the following features.
--More shapes with effects when you are inside (e.g., increase/decrease (turning) speed, springboard that makes you automatically jump)
--Don't make you "teleport" when you hit a pasted edges. Instead, just rotated/flip n copies of the base n-polygon and paste them there.
--Use the camera to scroll (its implemented but never used in the current version).
--Together with the above two features, don't draw the boundaries anymore (the player has to figure out the topology by seeing their own trail, which they can of course draw in a specific pattern for easier recognition).
--Together with the above, make the screen turn rather than the quill.
--Make the bounding polygon change (like in story mode, but randomized or make it increase its "difficulty" periodically so there is an advantage in acting fast.)
-Allow players to enter a scheme and play a custom level. This is almost implemented but currently, the code needs to be changed manually by either changing the "allschemes=.." line or the "self.scheme=..." line for story mode and survival mode respectively.


"Fatal Python error: (pygame parachute) Segmentation Fault"

I'm posting this fix in case others have run into the same (or similar) problem.
I don't know if my own game has this issue or not but I ran into it quite a bit in other games.

The problem:
At some (early) point, the game exits with
Fatal Python error: (pygame parachute)
Segmentation Fault

Quick fix
Find a copy of freesansbold.ttf and copy it to the pygame directory. Mine was in /path-to-pygame-source/lib

My system:
Ubuntu 8.04, originally with pygame 1.7.1release
But this problem arise when I built pygame 1.9.1release from source.

How I built pygame 1.9.1 (because I might have done it wrong and maybe that is why I have this problem.)
Downloaded pygame-1.9.1release.tar.gz
Got all the SDL dependencies through "apt-get install".
tar xzvf pygame-1.9.1release.tar.gz
cd pygame-1.9.1release
python build (because I wanted to keep v1.7.1)
cd /path-to-game/
ln -s /somepath/pygame-1.9.1release/build/lib.linux-i686-2.5/pygame pygame

How the bug was found:
Using pdb and "step", a lot.

What the source of the problem seems to be:
First, it seems that freesansbold.ttf is not copied from pygame-1.9.1release/lib to pygame-1.9.1release/build/lib.linux-i686-2.5

Second, it seems that the file is actually found (without copying) but then the wrong directory is appended to its path before loading so that the "File not found" error is not triggered but an error occurs when pygame/freesansbold.ttf is loaded.

Add a comment

Speed fix

I've been reading other diary entries and speed "fix" (final-fast). If this is not allowed, please judge with the previous version.

I realized that drawing (pygame.draw) directly on the display surface was much faster than drawing on another surface first and then blitting it. Maybe its because my surfaces were sparse. I was only using the other surfaces to manager layers.

If it is still too slow for someone, there are some more layers than I can draw directly so I can add another version if anyone needs it.

Add a comment

4 mins left

Still have to find the license for everything I've used (they are all different kinds of free). Might have to add it later. Sorry.


Day 3 part 2

-Finally added the main sprite.

That took far too long. Still need an alpha to greyscale conversion to avoid transparency where there shouldn't be. Also it probably won't be animated because its downloaded free clip art. I don't suppose there's a place to find animated clip art on the web.

-Probably won't do much for this project until the last day.


Retroactive journal entry

Day 3 part 1

-Retroactively updated journal

-Added screenshot.

Day 2

-Too many other things to do. Really shouldn't be working on this.

-Experimented with pygame.mixer

Seems to work ok.
Still need to find sounds that's not just those on the hard disk. Although they do come from open source programs.
Also have to find something to use for the main sprite (this should really be a priority).

-Added some story element triggers.

-Spent yet another hour on the line segment intersection algorithm...

Day 1

-Completed basic mechanics

-Spend 1-2 hours on determining if two line segment intersect(!)

Shouldn't there be some well known numerically stable algorithm or a module?

-Other things seem to be taking less resources than expected.

-This is nowhere near done and there is not much time left.

Originally, only 1 day was planned...