Postmortem

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 #self.mq.lives=2
-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.

Duration
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).

Content
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.

(log in to comment)

Comments

Great game! I think it might be faster to just draw simple stuff like a quill than to hunt for it online though :).

Your todo-list is interesting, but I hope you do not plan on universally replacing the current behavior, but rather adding these new features in new levels or game modes. I like the game as is!
I have to agree with cyhawk, this game is very fun and interesting the way it is. I think the balancing between planning and reflexes was done quite well, and this is definitely a game with potential to be further expanded.

I'd be interested to see the version with copies of the flipped/rotated polygon in place of the edges; that should make it even more interesting.

I didn't realize I could jump at the last level, I missed the "z" hint. Only when I finally got to the last circle and realized nothing was happening, I tried pressing z.
If I were doing the engine for this game, I would have done collision detection by pixels. Pixel operations are quite slow, but in this case, you'd only be doing about 5 per frame, and that's very doable. Just draw the path with a slightly off-black color, say (0,0,1), and then check every pixel that the quill crosses in that frame. You said that your method worked fine, though, so that's good. It's just another idea to consider for the future.

Great job, by the way! I've tried making a (rather different) game on a particular hyperbolic space. It was similar to your last level. I'm curious how well it would work for you to paste copies of the base octagon around the perimeter. i gave up when I couldn't make it look how I wanted (locally Euclidean).
cyhawk: The problem is that I can't draw (even simple things). I just don't understand how to represent "real world" objects (either on paper or computerized). If fact, if I could draw, I wanted to add something to the title screen (currently, the bottom right is blank). Just a torus (made with shades of grey, pre-rendered somehow) with a quill on it (but the perspective angled so that it looks like its normal to the surface) with a trail going around the torus. Of course, I couldn't find that online. I already learned of the existence of Blender during the contest and managed to render a torus but wouldn't even know how to start drawing a quill. And I was definitely not going to find this online.

about the gameplay: Yes, any additions would definitely be put in another mode. Its mostly for when the player would get bored of the initial gameplay. I will try to release a post-competition version just to show what happens since there seems to be enough interest. It will have to wait until the end of the judging period (or maybe even a bit later) though since I'm now quite busy (Because of the game making and then all the game playing this week. But I don't think that's a bad thing.)

Cosmologicon: I hadn't actually thought of trying collision detection by pixel. Again, I'm probably worried about nothing, but couldn't something like this happen?

0001
0010
0100
100Q

Q001
0210
0120
1002

where 0 is empty space, 1 is a old piece of trail, Q is the quill's position and 2 is a new piece of trail that crosses 1 but goes undetected. Of course, I'd have to look into how pygame actually draws lines at an angle.

Come to think of it, its true that its not possible to tile the plane with octogons. But the theorem is true and all surfaces are locally homeomorphic to a disk so maybe I just have to pick the right representation (e.g., use an octogon that's not a regular octogon)? I should probably think about this some more. I hope that I'm not trying to do something impossible.
About the pixel crossover on diagonals, you're right, that's absolutely possible. The way you do it is, you have to test more pixels than you actually draw. When you test, you imagine the quill moves exactly one pixel in the x or y direction. You just need a sequence of dx's and dy's, each one only one pixel. Say you move n = 5 pixels in the x-direction and m = 4 in the y-direction. You take these five dx's and four dy's and sort of "shuffle" them together, to make sure they show up in more or less the right order. Something like this:

dxs = [((x+0.5)/n, (0,1)) for x in range(n)]
dys = [((y+0.5)/m, (1,0)) for y in range(m)]
[d for f, d in sorted(dxs + dys)]

Anyway, yes, it's definitely an extra complication, and it may make it not worth it, but it's still how I would have done it.

As for the octagon, you can definitely tile the hyperbolic plane with octagons. They just need to be the right size so that each interior angle is 45 degrees. This page shows it. What I don't know is whether it's possible to do this without seriously distorting your display somehow. Anyway, don't take my failure as a sign that it's impossible. I really didn't know what I was doing. I certainly didn't use any theorems. :-)
Cosmologicon: Thanks. I understand. So you basically just make the line thicker when detecting collisions. Its definitely something interesting to keep in mind for the future.

I looked at the link and its a very interesting page. At first I was a bit confused when you mentioned geometries (because I was only thinking in terms of topologies). Admittedly, I am not very familiar with and had completely forgotten about the Gauss-Bonnet theorem which "is an important statement about surface which connects their geometry (in the sense of curvature) to their topology (in the sense of the Euler characteristic)." (taken from http://en.wikipedia.org/wiki/Gauss–Bonnet_theorem)

Also, the argument about the sum of angles is a short proof that what I was originally trying to do was impossible (have Euclidean geometry everywhere).

Anyway, that applet at the end of the page (and the updated(?) one in the link which also draws the dual) is very nice in visualizing what needs to be done. In retrospect, I've actually been shown this applet before! But it was someone asking me about an open problem about free groups (and I believe they weren't especially interested in the geometric part). I'm a bit worried because of the curves being used to draw the lines in the applet. When I will have time (probably not anytime soon), I will take a look at the source code and see if I can make an octogon level like that. I'm thinking that it will basically "feel" like you are on a sphere but when you try to turn, something unintuitive happens.