Bomb Squad Day One

With the first day of Ludum Dare 27 almost complete, I have made a good start on my entry Bomb Squad. The objective is to disable as many bombs as possible before they explode. When a bomb appears, you have 10 seconds to disable it.

bombsquad02

I originally planned to have the player enter a sequence of wires to cut to disable the bomb. Implementing this wouldn’t be too difficult, but the problem would be displaying the wires to cut to the player. I would rather not have to display a sequence of buttons over the bomb, but trying to display small wires on a bomb would make it too hard for the player to see the sequence. I thought about having a popup view display whenever the player gets close to the bomb, which would show the sequence. However, I decided for now just to color the entire bomb with just one color that needs to be disabled. I think this is a good design decision, since 10 seconds is not a lot of time to run over to the bomb and disable it, especially with multiple bombs active at the same time.

The controls are simple, with the control stick and arrow keys moving the player. Once the player gets close to a bomb, the countdown number will turn green, indicating that it is the bomb that the player is trying to diffuse. If the player enters the correct color, then the bomb is diffused. The mapping between colors and the game pad buttons and keyboard keys are displayed in the upper right corner of the screen. If the player selects the wrong color, then the bomb will explode and the player’s suit will take damage. If the countdown reaches zero, the player will also take damage if they are near the bomb.

bombsquad03

The amount of damage the player will take is dependent upon how close they are to the exploding bomb. If the player is directly on top of the bomb, then their suit will take 20% damage. The player takes 2% less damage for each world unit they are away from the explosion. The player will also be thrown backwards from the explosion, using Unity’s create explosion force method.

Last night, I created three tracks using Garage Band on my Mac system. In my opinion, it’s a little more difficult to use than Pxtone Collage, but it has better instrument samples. However, most of the instruments sound like John Tesh new age music. I also recorded some voice samples, which announces the title, game over, and level complete. Using Bxfr, I created sounds for the bomb exploding and a beep for disabling the bomb. I’ve always had problems getting 3D sound working, but I was able to get it to sound right by changing the volume rolloff in Unity from logarithmic to linear. Now explosions on the left will come out of the left speaker, explosions on the right will come out of the right speaker, and the volume will correspond to how far away the player is from the explosion.

So what’s left? The terrain textures are really blurry, so I really need to fix those. I haven’t had this problem in the past, so I think it must be due to using as 1024×1024 texture size. I will try recreating it will a 256×256 texture. I tried changing the tiling options for the texture, but it didn’t help. I would also like the touch up the player model, since I think the arms are too long and the hands are too big. There also needs to be more contrast in the suit, since it’s hard to tell the difference between the dark blue and gray. Also, the model needs to be scaled down in Blender to about half the size, since I have to scale it down in Unity. However, I learned that any mesh or scaling changes in Blender can really mess up the model, especially if it has already been rigged, animated, and texture mapped.

I would also like to add various “junk” around the play area (like cars, signs, and trees), which can also be damaged by the bombs when they explode. There will be a dollar value attached to each item, and after each level the player will get a total property damage value. The objective will be to keep the property damage value low. However, the physics engine started acting strange when I added a few test objects, by throwing the player up in the air when the player collided with an item. Overall, the player model seems to be stiff as well when it is affected by an explosion, probably because I’m just using a simple box collider for the player. Finally, I need to update the explosions, since I am just using a default Unity particle system right now. I would also like smoke to appear after the bomb has exploded, which could make it harder for the player to see the game area, which would give extra incentive to not let bombs explode.

One other problem is still passing data between scenes in Unity. This is a problem that I’ve always had with Unity, and have solved it before by passing the persistent data to the DontDestroyOnLoad method. However, it is not possible to associate that object with the newly created objects when a level is loaded. I’ve heard that it is possible to pass data between scenes using a player preferences object, so that may be the route that I take to solve the problem. This will be essential to pass the game score data to the level complete scene, as well as incrementing the level number after a level is complete.

 

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

How to make a good timelapse

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