Archive for the ‘geekery’ Category

How to Make a Timelapse

Wednesday, December 21st, 2011

Timelapses are videos where many successive pictures of a subject are put together, ordered by date.

The first one I remember seeing was that guy who took pictures of the front of his home, every day, for a couple of years. There is another very cool one of a guy who travels around china, always taking pictures of his face. Those videos of crossings in large towns, where you see everybody moving very fast, are also a sort of time lapse.

Besides having a very cool effect, time-lapses can show in a pleasant and interesting way how something was made. One example are the games of Ludum Dare (a challenge to make a game from scratch in 48 hours), that are often followed by a time lapse of how the game was made.

I wanted to add a timelapse video of my own entry to LD, and at first I thought it would be a very complicated affair. Turns out it was really simple.

First thing you need to do is to set up your system to take regular pictures of your desktop. You can do this with a single command using xwd, imagemagick and date:

xwd -root | convert xwd:- -resize 800x800 `date +%d%H%M%S.png`

This will create a screenshot of whatever is on your screen, and name it “dayhourminutesecond.png”. The 800×800 part resizes the screenshot so that the largest size will be 800 pixels (you don’t want full-sized screenshots, unless you don’t care about running out of disk space).

Now you need to set up your system to run the above line every minute. I tried to get CRON to do that, but it * * * * * wouldn’t work for some reason, so I wrote a shell script and left it running in the background:

#/bin/bash
while true; do
i=`date +%d%H%M%S.png`
xwd -root | convert xwd:- -resize 800x800 $i
sleep 1m
done

No magic here.

After you are done with your screenshots, you need to put them together in a video. You do that using mencoder. I took this line from the Cenolan blog (originally for web cam time lapsing):

% ls -1tr > files.txt
% mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o test.avi -mf type=png:fps=10 mf://@files.txt

Note the bolded part. You need to change these lines if you save your pictures as something other than pngs, and if you want a different speed to your timelapse. I find that anything under 10 fps gets a bit too slow. The script runs surprisingly fast for 3.000 pictures.

Now go make some time lapses! Here is mine.

Ludum Dare, I did it! :-)

Tuesday, December 20th, 2011

If you graduated in computer science or computer engineering, you have, at least once, thought about writing a computer game.

And if you are like most people, and like me, you never went through with that idea. What a shame, I know how it feels.

But this weekend, I was vindicated. I decided to plunge into the Ludum Dare. The Ludum dare (or LD48 as it is also know), is an open challenge to develop a game in 48 hours. The game must be done from scratch: code, graphics, sounds, everything. Also, each edition has a theme, that should be followed. The theme this time was “Alone”.

Since I’ve never completed a game before (and I suck at GUI programming), I was not very confident that I would be able to complete the dare. Fortunately, that was not the case at all. Not only I completed my game, but I was also rather proud of it, given the constraints, and I also got very excited about the whole LD48 community.

I think one of the big things that helped me along was having a friend do the dare with me. My Milked Eek, from the Mafia Scum Forums, participated in the Dare too, and we would exchange messages every time we had a problem, or reached a milestone, or just had a lol-worthy thought. That helped me keep my motivation up in those 48 hours.

It was a great experience. I managed to learn a lot about Java, and about Slick, the gaming library that I used. I gained a lot of confidence in my programming skills. And I made a game! I made a gaaaameeee :-)

So, here are some links:

Maze Explorers, my Ludum dare entry. You run it with Java. Works in Linux/Mac/Windows

A time lapse video of me making the game

Courage Quest, a fantastic entry for this edition of the LD48. If I didn’t tell you, you couldn’t say that this game was made in 48 hours.

Stay tuned!

Getting Myself into Trouble — Ludum Dare

Saturday, December 17th, 2011

So I decided to participate in Ludum Dare this weekend.

Ludum Dare is an event that happens about 3 times per year. It challenges you to build a complete game, from scratch, in 48 hours. By ¨from scratch¨, I mean everything: design, code, image assets, sounds. A theme is picked and you have to follow this theme.

It is a great opportunity for game developers to show off, and for common folk to try and finally complete that pong reimplementation. Guess which category I´m in ;-)

To record my adventure, I decided to make a time-lapse video of my desktop: something I have never done before. Hey, if I can learn one thing, I can learn two at once, right? So my idea is to take a screenshot of my desktop every minute this week, and put all the images together into a video in the end.

The problems started there…

I found on the net a nice spell to take screenshots from the command line using xwd. Then I tried to put it on cron. Nothing happened. No error message either (if you don´t have a mailing agent installed, where does cron send its error messages in ubuntu??? :-( ). Since I only have 5 hours to the start of LD, and I have other important preparations to make (like writing this blog post), I decided to write an infinite loop script to do this for me, as a quick fix. Here it is, for the curious:

#/bin/bash

while true; do
i=`date +%d%H%M%S.png`
xwd -root | convert xwd:- -resize 800x800 $i
sleep 1m
done

I´ll post more about LD this weekend, stay tuned!

“Correlation Does not Imply Causation” is not as simple as it looks.

Thursday, December 1st, 2011

This year I gave lectures to three different classes about introductory statistics. One of my favorite classes was Correlation and Linear Regression, because It allowed me to talk to students about more practical applications of the usually very mystical concepts of statistics.

In all three lectures I talked about the “correlation vs causation” dillema, and in all the exams I included the following question: “A group of scientists find out that the rate of use of product X has a strong correlation with the rate of hairlessness in people. Is this result useful to say whether product X causes loss of hair? What arguments or experiments could you use to determine if X and loss of hair have a casual relationship?”

It is a very open ended question, I wanted to pick at my student’s brain and gauge how much of the class they assimilated more than I wanted an exact answer with an exact score (there were other questions for that). The results were very interesting.

As for the first part of the question, a very large number of students in all classes misunderstood the meaning of the word “useful”. They would answer that either the correlation does not prove the causation, which is correct, but is not what I was asking. Of course correlation does not prove the causation, the question itself states that! But still, it is useful information, because if the correlation was 0, we could exclude a direct causation right out of the bat.

As for the second part of the question, many, many students suggested tests with control groups to test if the causation really exists. This shows a fundamental misunderstanding of either what control groups are really about, or what about what correlation really means. If you have already stablished a strong correlation between X and hair loss, the logical conclusion is that a control group that is not using X will not show hair loss. The control group will simply confirm the correlation we already know about, and teach us nothing about the causality (or lack thereof) of X and hair loss.

This is not exactly an easy question — even though it uses no numbers or asks for no formulas! — but since I said they could use arguments instead of experiments, they could suggest different X with and without causality relationship with hair loss, and compare them. For instance, they could say that X could be either an anti hair loss product (and the causality relation would actually be inverse in this case!) or a shampoo with a bad chemical balance (and in this case there would be a causal relation) - the “experiment” in this case would be to actually investigate X and how it relates to hair loss in chemical/biological terms, and not something as simple as “Do a Z-test/double blind test/whatever”.

Things to keep in mind for the next time around…

Amazing Universe!

Monday, November 14th, 2011

We need more people in space, making more stuff like this. I find it particularly impressive the many blue flashes from thunderstorms seen in the time lapse.

Earth | Time Lapse View from Space, Fly Over | NASA, ISS from Michael König on Vimeo.

  • Categories

  • Archives

  • Meta


  • ""Most of the game makers aren't living off the revenue from those old games anymore. Most of the creative teams behind all those games have long since left the companies that published them, so there's no way the people who deserve to are still making royalties off them. So go ahead--steal this game! Spread the love!""
    Tim Schafer, developer of Day of the Tentacle, Full Throttle, among other games.