EarthBall Post Mortem

After a less than impressive finish in the LD26 competition, I decided to develop a game for the the mini LD42 called EarthBall. I now have a little more experience with Unity after writing Amish Brothers for LD26 and Genetic Disorder for #1GAM, but I’ve still got a lot to learn.

When I saw that the theme for mini LD42 was the destruction of the Earth, I thought about the ending scene in Men in Black where the entire galaxy was contained in a sphere, which turned out to be just a marble used in a game of marbles.

Instead of using the entire galaxy, I decided to just focus on Earth. Marbles isn’t a very interesting game, so I decided to create a pinball game, since I’ve never written one before. Using the Earth as the ball and having it fall into the sun if missed by the flippers seemed to fit the theme perfectly.

I found a great tutorial video by nickdingle which stepped me through the process of making a pinball game in Unity. Of course, I wrote mine from scratch using C Sharp instead of Javascript, and only used the videos and examples as a guide. Now that I had a working pinball game, I needed to make it more interesting. The bumpers were dull, so adding planets instead for bumpers seemed to be a logical choice.

There seems to be a running educational theme in many of my games, so I decided to do some voice recording so that the name of the planet is called when the Earth collides into it. I did this using my USB headset and Audacity. I gave it more of a robotic sound by using a method explained in this video by Maniac Metro C0p. First, I changed the pitch by -25, Duplicated (Ctrl + D) twice, changed the 2nd layer pitch by 10, and the third layer pitch by -10.

As far as the graphics go, I created the starfield background using this Gimp tutorial. Next, I created the title graphics in Blender using this method described by 5teven94. I also added lights that flicker when the plunger is released and when the planets are hit. On the title screen, I added the option to disable the flickering lights for those who may be sensitive to it.

Finally, there didn’t seem to be any real objective to the game so I added a score so that points are awarded when a planet is hit. To give the game a little more of an overall objective, I added a 50,000 point bonus for hitting all of the planets. I decided to add the points scored and planets hit as displays at the end of the playing field like a pinball machine.

So like most of my games, EarthBall was a learning process. The day that I don’t learn something from making a game is the day that I quit making games.

Amish Brothers Time-lapse with Guide

This is a time-lapse video of my development of Amish Brothers for Ludum Dare 26. The video footage was taken from my Twitch.tv stream.

Generating a time-lapse video from a Twitch.tv stream is not a trivial task. I will describe the process that I used to create this video. This is only a suggested method, and I do not suggest, promote, or advocate any of the software packages described below. Use all software at your own risk.

First, you will need all of your Twitch.Tv video clips. These can be downloaded from http://bashtech.net/twitch/download.php . You will need to connect your twitch.tv account with your username and password. I believe the authentication is through Twitch.tv, so it should be safe, but don’t hold me to that. To be on the safe side, make sure your Twitch.Tv password is unique from any other passwords that you use.

Then start pressing the Next button until you get to the videos that you want to use for your time lapse. If you’re like me, you named these videos something like Ludum Dare. Now for the monotonous part, start downloading each of the video streams into a folder of your choosing. These videos will be saved in FLV format. Unfortunately, this site provides your videos in 30 minute chunks, so there may be numerous video files to download. If you are clever, you can probably script a process to speed up the download process using a web file grabber like wget or curl.

Download and install the VLC video player from http://www.videolan.org/vlc/ .

VLC can be used to generate snapshots of an FLV video as specified frame intervals using a command like the one below from a Windows command prompt.

> vlc C:ludumdaremyvideo.flv --rate=1 --video-filter=scene --vout=dummy --start-time=1 
--stop-time=1800 --scene-format=png --scene-ratio=24 --scene-prefix=snap 
--scene-path=C:ludumdarescreens vlc://quit

This tells VLC to generate a snapshot every 24 frames for the first 1800 seconds (30 minutes). This works okay, but the stream has to completely play through the entire 30 minutes to take the snapshots. Therefore, it will take the total amount of casting time to grab all of the snapshots for the time-lapse video. This method could take hours for to grab all the snapshots out of the stream videos.

Note: The path to VLC must be in your PATH environment variable. This can be done in a command prompt using a command such as the one below. Change the value accordingly for your VLC installation.

set PATH=%PATH%;C:Program Files (x86)VideoLANVLC

To make this process more efficient, we only want to play the video at the points where we will capture a snapshot. This can be accomplished by changing the start-time and stop-time values. When specifying those values, VLC will start generating snapshots at that number of seconds into the clip. However, there is an apparent bug which makes VLC also generate a snapshot at the beginning of the video as well.

Now to generate all of the snapshots, we will need to execute VLC setting the start-time parameter to the value of the position where the snapshot should be taken. Repeat this process by incrementing the start-time parameter by the interval between frames in seconds. I set the stop-time to the start-time + 1, since we only want to capture one frame at that time. Be careful to make scene-ratio the value of the frames per second for the cast, so that only one snapshot is taken for the one second interval. In most cases, that value will probably be 24 frames per second for Twitch.tv.

I chose to take one frame every 30 seconds for my Amish Brothers time lapse video. I scripted this process in Ruby, so that it automatically calls VLC with the correct time parameters. This made the total time to generate the snapshots for a 30 minute video 60 seconds (2 snapshots generated for each minute of footage at one second each), but maybe a little longer due to some overhead of starting and stopping VLC.

That is good, but I had 37 videos to process, which is still tedious. With a little more scripting, I was able to loop through all of the FLV files that I had downloaded into my video directory. After the script is complete, it puts all of the PNG image files in the “screens” directory. However, there is that bug in VLC that generates an image at the start of the video, so with a simple DOS delete command I removed all of the “*00001.png” files, leaving only the correct snapshots remaining in the directory.

Below is the Ruby code for generating the snapshots with VLC.

USE AT YOUR OWN RISK AND ONLY IF YOU KNOW WHAT YOU ARE DOING!

iFramesPerSecond = 25
iSecondInterval = 30
iFrameCounter = 1
Dir.foreach('.') do | strFile |
  if (strFile =~ /.flv/)
    iStartTime = 1
    while (iStartTime < 30 * 60)
      strFrame = "%05d" % iFrameCounter
      strCommand = "vlc #{strFile} --rate=1 --video-filter=scene --start-time=#{iStartTime} 
--stop-time=#{iStartTime + 1} --vout=dummy --aout=dummy --scene-format=png 
--scene-ratio=#{iFramesPerSecond - 1} --scene-prefix=#{strFrame}f 
--scene-path=.\screens vlc://quit"
      puts "Running #{strCommand}"
      system(strCommand)
      iFrameCounter += 1
      iStartTime += iSecondInterval
    end
   end
 end

Next, I went through my snapshot directory and removed unneeded images, such as when I was eating or away on a bathroom break.

Now I needed to put the snapshots back together in a video file. Some people have recommended Chronolapse, but I tried it and the video quality was really poor and there were no options to increase the quality. Therefore, I used VirtualDub (http://virtualdub.org/), which can also make a video out of image files.

The only problem with VirtualDub is that it expects the filenames to be in sequential order (0001.png, 0002.png, 0003.png, etc), and the filenames generated by VLC can only be specified by a prefix, and it gives each file an unchangeable ending, which is based on the frame number. To resolve this, I wrote another Ruby script which looped through all my snapshot images and renamed them to sequential file names. I’m not sure if the files are looped through by lexicographical order or timestamp order by default, but it worked so I’m not complaining.

USE AT YOUR OWN RISK AND ONLY IF YOU KNOW WHAT YOU ARE DOING!

iFile = 1
Dir.foreach('.') do | strFile |
  if (strFile =~ /.png/)
    strNewName =  "%05d" % iFile
    strNewName += ".png"
    puts "Old: #{strFile} New: #{strNewName}"
    File.rename(strFile, strNewName)
    iFile += 1
  end
end

Now all of my images are in the directory in sequential order by file name. The images can be imported into VirtualDub by selecting File > Open Video File and selecting the first image. It will automatically add all of the other images in the directory. I also added an audio track using some of the music from my game, by selecting Audio > Audio from other file. It is important to note that VirtualDub will not loop your audio, so I had to manually loop the audio myself by extending the audio track in Audacity.

Finally, I added a credits screen at the end, which seemed to be more trouble than it was worth. There is no way to slow down or copy frames in Virtual Dub, so I had to make another video file containing my credits, and then used File > Append AVI segment to add it to the end.

Now I just needed to encode the video, but it turned out to be about 5 Gigs in size, which I believe is too big for YouTube. This was fixed by selecting Video > Compression from the VirtualDub menu. It gives a few different compression methods. I didn’t really have a clue as to which one is best, so I just selected Microsoft Video 1. It reduced the size to around 400 Megs, so it did the job.

Finally, I previewed the video and uploaded to YouTube. It seemed to a be a lot of trouble just to make a time-lapse video, but this was my method since I didn’t not use a screen capture program and I didn’t want to spend a lot of money on a professional video package.

 

References:

http://wiki.videolan.org/How_to_create_thumbnails

http://code.google.com/p/chronolapse/

http://support.twitch.tv/discussion/2391/frequently-asked-questions

http://www.ludumdare.com/compo/2012/09/09/how-to-make-a-good-timelapse/

https://wiki.videolan.org/VLC_command-line_help

Amish Brothers Complete

Who are more minimalist than the Amish? Welcome to Amish Brothers where you play as Brother Jebidiah, who must return all of the farmyard animals to the barn. Ten levels of sheep catching action!

amishbrothers03

This is my first game created in Unity. The development environment has a little bit of a learning curve, but once I got the hang of it most of it made sense. I really like Unity’s ability to import Blender (.blend) models directly into the project. This is something that I have been fighting with in XNA for over six months. The biggest trick was figuring out that I had to select the “Legacy” option under the model’s “Rig” settings. Getting the models to rotate the correct way was also a bit of a challenge, since rotating at the incorrect place will cause the movement vector to change as well.

It was a really enjoyable experience creating all of the assets for the game. All of the models were created in Blender. The music was me playing the guitar with touch-up done in Audacity. The sheep sound was also me, with some pitch and speed distortion in Audacity.

I’m really anxious to hear what people think of the game. I’ll admit that it isn’t the most complex game, but I think it appropriately fits the “minimalism” theme of this Ludum Dare competition.

amishbrothers01

Play the game here: Amish Brothers

Contact me @GaTechGrad on Twitter