Monthly Archives: January 2014

On Treasure.

Treasure Planet will always be a special movie to me. I watched it first a very long time ago, when I was rather little. Maybe 10 years old. I liked it for a few reasons. I had just recently read a comic version of Robert Louis Stevenson’s Treasure Island, on which this movie was loosely (but also surprisingly thoroughly when not loosely) based. I also fell in love with this idea of building upon a story. I used to think of stories as immutable objects that were told. After this, I made up my own stories set in worlds that I had read about. Or invented worlds for characters I liked. I don’t think I can go so far as to say my love of science fiction stems from this movie, but it sure didn’t hurt!

The movie didn’t do too well at the box office, or so Wikipedia tells me. It’s a pity really. The story is quite good, both the original and what they’ve done with it. It has two of the best songs ever. Tangent:

I’m Still Here, and Always Know Where You Are. Those are the two songs. The first plays over a montage that shows Jim and Silver bonding like father and son, and the second plays over the credits. I fell in love with these songs the instant I heard them. I wanted so badly to listen to them again, but I was young and this was before I knew about the internet. So I used to wait for the Disney channel to air the movie. I watched it every single time it did. After my fifth or sixth viewing, I thought I would record it. Mother had just got herself a fancy (by 2003 standards anyway) phone with a camera that takes videos. So I recorded the end credits one time. It was awful. I loved it. I listened to that racket for hours on end.

When I did find out about the internet, I still didn’t know I could get these songs. I didn’t know what they were called. I don’t think I knew what Wikipedia was. So one time, while I was in an Internet cafe for no real reason, I googled “treasure planet songs” until I found a website where I heard it playing. I was so happy. I didn’t know how or even if I could download it. I just listened. It sounded so crystal clear and perfect.

These songs have played quite important roles in my life. They sum up so many emotional events so succinctly. Even their titles invoke such deep memories — I’m Still Here. Whenever I mean that, when I talk to someone, I capitalise those words.

Why am I writing about this? I just watched it again. For what is probably the fifteenth time ever, but the first time in years. And I’m currently looping over the montage with I’m Still Here.

Nostalgia. Sigh.

On the lack of regular updates here.

I should write more often. I want to. But, to be honest, I’m not sad or lonely or empty enough (or happy or excited or giddy enough) to. I need some non-neutral emotion fuelling my writing.

Why am I writing this? Good question. I suppose I feel guilt. Someone read my blog yesterday and all they read was the umbrella post. Call it hubris if you will, but I want that person to have been able to read something better. Or longer.

Have I not been up to much? On the contrary. I’ve been up to loads. Or at least, enough that I will find it a chore to document now that the excitement has worn off. I won’t tell you just yet because I don’t want to leave you hanging. More on this, hopefully, later.

Anyway. What to do now? I don’t know. Let’s see.

On Umbrellas.

Yesterday, I was walking back to my hostel when it suddenly began to rain. I pulled out my umbrella and carried on walking. After about five minutes, I noticed no one else around me had an umbrella. I was the only one that I could see. In the ten minutes it took to get to my room, I saw exactly one other person, an old man on a bicycle, with one.

I always have my umbrella with me. Why? Because an umbrella is an easy thing to always have with you.

On Santa Claus and the Tooth Fairy

I used to believe in the Tooth Fairy. Not Santa Claus though. I’m not quite sure why. I remember when I lost my first tooth, or maybe my second, I put it under my pillow before I fell asleep. Next morning, tooth still there, no money. So the tooth fairy was not real.

That literally was what happened. I concluded that she didn’t exist, and calmly shrugged it off. The first time I heard of Santa Claus was in a fairly sceptical environment, so I must have vaguely felt that he wasn’t real anyway. But the tooth fairy was different. I was as naive as they make them, and I simply assumed it was true, without even thinking about. And of course I threw away that assumption easily.

I don’t quite know why I’m writing this. I’m watching Modern Family and someone happened to mention the tooth fairy and all these random memories came rushing back to me.

Wouldn’t it be so nice if we could put on and throw away ideas and beliefs as easily as that?

This was #… ah forget it. No more counting. I’ll talk about this next.

On learning by tinkering, part 2.

There is always a profound sadness associated with the end of anything, be it a book, a tv show, a year, or an era. Projects are no different. And now that I’m done with my game (I can proudly christen it v1.0) I am incredibly sad. Bordering on depressed, even. I cleaned my room (I keep it dirty just to have things to clean when I’m like this). I rearranged everything. I brushed my teeth. I made an OS X build of my game, and then a Windows one. I don’t have Linux. I got a guy to mop my room down. I paid him with the surprisingly plentiful change hidden in books and crannies in my room. I sat down. I looked at the screen, with Sublime Text (my newfound favourite text editor) staring back at me blankly. I closed the laptop, and asked my mother how to clean a mug. I didn’t have detergent, is liquid hand wash okay? I cleaned my mug. I had five or six mugs of tea yesterday. I spent 14 or 15 hours at the computer yesterday. Coding, looking things up, making mistakes, fixing mistakes. Learning.

Having fun.

I just spent the last fifteen minutes looking at the pictures my code generates. My code. (Knot atlas’s knots, but still!). There’s something mesmerising about losing yourself in your work. Music helps too, and I have Broke for Free playing right now. They’re on Bandcamp. Have I mentioned Bandcamp is awesome? It is.

I am nowhere near done yet. Oh no. This is just v1.0. This shall be a very ongoing project. I have oodles of ideas for game modes. Arpit had a brilliant idea, too, but I need to math it out to see if I can implement it or not.

What now? A log. Of retroactively named versions of my game. Thank you for reading.

Idea is nebulous. Kawauchi shows us his game and I think about it for the next few days. I don’t quite know when exactly I wanted to make it. But I began doodling in class once. I drew the tiles I would go on to use in the actual code. I figured out how to convert arc representations into matrices. I stopped doodling.

I find cocos2d and make the bare bones display window appear. I muck about till I get a hardcoded arc representation to become a diagram.

I’m home now, and I’m back to doodling. This time it’s to toggle the crossings. I spend a full day thinking about it. I code it in one go the next day. Now the hardcoded knot toggles. I have one level of my game. It’s boring.

The episode with Knot Atlas. I yanked 250 representations from their website. I wrote some code to go back and forth between knots. I changed from the “over/under” images for the crossings to “on/off”. And these are assigned randomly, to improve replayability.

Squashed a bug I didn’t realise was there that had to do with duplicate regions being spat out by my code. Now is neat. Also the outside is now a region.

Now I’m in Roorkee. There’s no internet. I can’t update/jailbreak my phone to put my game in it. Impatient. I begin coding it from scratch in Python. Find Tkinter, which I subsequently fall in love with. Rapidly get it up to speed, to v0.4 in one day. Or maybe two.

I learn more Tkinter stuff. I make more windows. And buttons. And victory screens. I send the code to people. They either can’t or don’t want to play it. No matter, I try making it better.

Changed a function that was updating every 0.1 sec into a static thing that checked only when something happened. Huge speed increase. Cool. Put in a help screen. Helpful help screen. Polish code a little bit.

Added a counter that told you how many moves you’ve made so far vs. what the minimum is. Took a while to code. This was what I was doing yesterday. Made the counter slightly fancy with colours and stuff. Gave you the option to retry the same random seed, or to try a different seed.

Got bored and added a Cheat button that shows you exactly which regions you need to tap in order to win. This is for when you’re too frustrated with a level or when you simply don’t believe the minimum number. Also, this is a wonderful gauge of difficulty. A 1, 2, or 3 turn level is incredibly easy and a 7, 8, or 9 turn level is deliciously hard. I love playing them. Can lose myself for hours.

Used py2app to make an OS X app. Used py2exe to make a very messy Windows executable with a bunch of junky windows dlls and what not.

Shall use py2objc to make an iOS app. When I eventually jailbreak my phone I shall get it on there.
Should probably care about Linux. But eh, they can build from source.
Write some code that goes through ALL the combinations for all the knots and sorts them by minimum turn required. Each knot has an average of say 12 crossings, and there are 249 knots, so that’s at least 1,000,000 levels. Yes, a million.

Jesus, a million.

Game modes. Like a time limited one. Or to get to a particular configuration. Or loads more. More info when I get down to coding them.

If you’ve read this far, you’re hopefully interested in the game. So here:

That contains the image tiles used to generate knots, the plist containing the codes I took from Knot Atlas, and the Python script itself. You’ll need Python 2.7 installed on your computer for the script to run. Leave all the various files inside the same folder. And you’re good to go!

Do let me know what you think. If you read the source, don’t hesitate to tell me all the ways I code horribly. Must get better.

On people’s voices inside your head.

No, I don’t mean the schizophrenic kind.

I was just reading this article and halfway through it I realised I was reading it in a woman’s voice. As in, I assumed the author was female, and proceeded to have it “read out” by her. I had no basis for this assumption. She had not mentioned her gender so far. But I turned out to be right. It was a woman.

Then I got to thinking. What voice do I read other articles in? I was reading another woman’s blog earlier about her attempts at building a roguelike in Python. I knew it was a woman though, because her blog is named after her. I don’t, however, remember the voice I read it in. And I have subsequently been stymied in my attempts to “listen” to those voices on other articles because now I’m interfering with myself. Kinda like Heinsenberg uncertainty.

I would like to think I read things in my voice. And that the above is a random aberration. But. I just don’t know. The more I think about it, the murkier it gets. So.

What voices do you read with?

When you’re texting someone you’ve spoken to, do you read their texts in their voice? I know I do only when their voice is different. Like if they had a peculiar accent, or a verbal tic. A regular Indian basic accent I read in my voice.

Abrupt ending.

This was #19.

On my opinions.

Yesterday, on how everyone learns things vs how I think everyone should (mucho paraphrasing and editing):

People these days, if they want to learn something, they go buy a book. That book tells them to buy a toolbox and they do. The book then goes on in immaculate detail about the origins of each tool (screwdrivers are for screwing screws into things), where it was made (a factory in magicland), the materials used to make it (magic plastic), amusing anecdotes about their creators (“Philips was a dick!”), and so on and so forth. Twenty chapters and eight months later, you are expected to know everything about every tool you now possess.

Then what? Your door hinges broke. What do you use to fix it? A screwdriver? Which one? Or you want to build a little kennel. Where the fuck do you start? You don’t know anything about wood. Is there a book for that? Or your microwave is toast. Electrical stuff?

Knowing about those tools uses precious memory overhead that isn’t worth it in the first place. Not everyone needs the same tools. Not everyone needs more than one. It depends!

I know it sounds clichéd and lame to say “don’t think, just do!” or “don’t prepare, just go for it!”, but the reason it’s so often repeated is because it is in fact very good advice. There is something to be said about a bootstrap requiring a boot in the first place, though, but I digress for the boot here is the internet.

Chuck the books. They’re useless for the most part. After they introduce the bare essentials, you’re done. Anything else is just junk you need to wade through for what exactly it is that you need. And there are better ways to find what you need. Google it.

You don’t need to know shit. You don’t need to know “all the topics”. You just need to know everything about whatever it is you want to do.

Google the hell out of it. I needed a GUI module for Python to display the game on-screen (by the way, it’s going rather well). So I googled that. And I came to Tkinter. And a bunch of other things. Tkinter was inbuilt so I picked that. I didn’t know how to make an image appear onscreen. I googled that. I could make an image appear onscreen. I didn’t know how to track where the user clicks with the mouse. I googled that. I could track where the user clicks with the mouse. Repeat ad infinitum.

You should do this because you want to, because you like to, because the end result makes you happy. If you do it because you have to, because it’s an assignment that’s worth a grade, because you want to impress the people interviewing you, stop and take a long hard look at yourself. Is this really what you want to do? When you could be enjoying doing something else?

(Apologies for the suddenly sanctimonious turn that took.)

This was #18.