Benedict’s Babeldom

things I like, things I make, and what I think

HTML 5 Mute / Wordpress Code Highlighting

with 2 comments

It’s great to put something out that friends can just try out in their browser. At first we were going to have music for the game, but it never worked when using it as a chrome extension. I assumed it was just some issue with chrome extensions integrating html5. But today when my roommate opened up the game, the music started playing. The tune was made by Blot for the Assemblee Competition and can be found here.

The game’s purpose is to be something quick that you can play while doing something else, or waiting. Of course, music playing in the background can be quite annoying if you’re trying to multitask, or are already listening to music.

Here’s what the original code looked like:

  <audio src="resources/shortgametune.mp3" loop="true" autoplay="autoplay">
  </audio>

This code just loaded the song, and played it on a loop. At first I added the built in html5 audioplayer so the user could pause/play, and adjust volume. Overall I found that too distracting, so I built a mute button. Here’s what the code looks like now:

  <script type="text/javascript">
    function mute(){
		var audio = document.getElementById('song');
		if(audio.paused)
			audio.play();
		else
			audio.pause();
    }
  </script>

  <audio id='song' loop autoplay>
    <source src="resources/shortgametune.mp3">
  </audio>

There isn’t a cornucopia information out there on the audio tag, so hopefully this might help someone if they’re looking to do something similar. I’ve also updated the source code that I posted earlier after adding the changes, and cleaning everything up a bit.

You may have noticed the slick code highlighting on the above samples. I looked around for a while trying to find a good code highlighting plugin for wordpress. The one that I am now using is SyntaxHighlighter Evolved. The best explanation of how to use it is here.

Written by benedict

February 11th, 2010 at 4:34 pm

Posted in coding

Avalanche!!

without comments

I uploaded a small chrome extension this evening. It’s a small game called Avalanche. I coded the game together with my friend, Alex Langenfeld (who is a genius). It’s based off the classic avalanche game that everyone enjoyed on their TI-82s throughout high school and middle school. As it says in the description, the game is based on code from this tutorial, and uses an art asset from this forum post.

The platformer code from the tutorial provided the basics for animation, collision, asset management, and game state management. First we boiled the game down, taking out extras we didn’t need. We then added code for the falling icicles, code to generate the icicles, score management, and a couple other things. The worst part was dealing with the pixel art and animations. Overall it was pretty simple, and fun to develop!

The best part of making a chrome extension was how simple it was. All we had to do was include a simple json file with some metadata, and chrome did the rest! The process of adding it to the chrome extensions website was also extremely simple and rewarding. Check out the source code if you’re interested!

Written by benedict

February 10th, 2010 at 8:59 pm

Posted in coding, games

The Path

without comments

The first time I played The Path I just ran to Grandmother’s house. I selected the emo-type character, sullenly sitting at the table in the center of the character selection room, for the trip. I shortly arrived at the house, and found Grandmother in her bedroom. The game then told me I failed for not finding any items, and not encountering the wolf. What?

My next trip into the woods I picked the tot with the little-red-riding-hood bonnet. Frustrated with my previous results, I thought I’d show The Path I wasn’t as conventional and boring as my first attempt may have painted me. So upon arriving at the path into the forest, I ran right back down the road where I had presumably come from. There I found a phone. Upon walking up to the phone, my red-hooded character called someone to pick her up, and bring her back to the character selection screen. They had beat me again.

Third attempt. I pick the girl pushing around chalk on the floor. I actually have no idea what she was doing. But that’s what it looked like. I arrive at the top of the path, and do what I was guessing the designers wanted me to do from the very beginning: run into the forest. I enter the foreboding thicket expecting wild hallucinations of wolves, magical mushrooms, and rabbit holes. The wild indie, artsy experience I had been expecting! But nothing happened. There were some pawnprints that appeared on my screen every once and a while, but then disappeared. Sometimes I ran a little too long, and my character would have to stop running, and I’d hear her heart pounding. Several minutes in I discovered a foggy marsh, something cool was bound to happen! But no, some text appeared on the screen: “this would be a perfect place to hide from everyone.” And that’s exactly what it was. It was so perfect that I no longer had any idea where I was. I started running back in the direction I had come from in hopes of finding the path again. From there I could hopefully enter a part of the forest that seemed more promising. After a couple more minutes of running through the never-ending forest, a map appeared on the screen. It displayed a horseshoe-shaped dotted line and informed me: “this is where you’ve been. every 100m we’ll show you this.” Sadly it didn’t tell me where on the dotted line I currently was, so I was still extremely lost. I ran a while longer, didn’t find anything that looked new or interesting, and closed the game.

I really wanted to like this game. I had played The Graveyard from Tales of Tales when it was an entry for the IGF, and really enjoyed it. I thought it was beautifully done: short, and sweet. There less involved, but it was considerably more enjoyable for me. There was really only one path to walk down, so I could enjoy the beautiful scenery more. I wasn’t busy looking for something that I really didn’t feel any motivation to look for. Playing as an old woman, I felt their somewhat awkward control scheme really made the experience more immersive. Feeling hindered just trying to walk and look around, in a game involving exploration, as presumably healthy, young kids is just frustrating.

It felt like The Path was attempting to present a linear narrative in a non-linear fashion. It doesn’t have to be fun, it doesn’t have to be rewarding, but it should be interesting. I don’t think I was very impatient while trying to find something worthwhile in this forest. Give players something to guide them. Present something that actually would lure me off the path. Something that would make me feel tempted to disobey the game’s instructions. If the intriguing portion of the game is discovering something, don’t make it so difficult. I don’t want to have to work to experience the interesting parts of a game.

Maybe I’ll be inspired to give The Path another chance, but overall I was pretty disappointed with my first taste tonight.

Written by benedict

February 10th, 2010 at 12:54 am

Posted in games

Shoes

without comments

shoes

I’ve been trying to start a small project to teach myself ruby. Unfortunately, I decided to do this right when _why disappeared from the internet. I had been planning on using Shoes, his ruby gui toolkit, but all his sites disappearing has made it a bit more difficult.

I spent a couple days wrestling with getting everything working. It retrospect it took an embarrassing amount of time once I knew what to do, but when isn’t that the case? Here’s the steps I took in case anyone else is interested. I did this on Ubuntu, so I use apt-get. For other os’s, check the why repository mirror on github at http://github.com/whymirror.

1) sudo apt-get install ruby-full :: I was missing some dependencies required for shoes when I didn’t get the full ruby install the first time I installed it. I spent a lot of time hunting around for what I was missing, but this seemed to take care of everything.

2) sudo apt-get install shoes :: I originally downloaded shoes off of the github mirror, but using apt-get makes the process much simpler.

From there I recommend reading why’s shoes tutorial/guide/novel, “nobody knows shoes”. This guide disappeared along with everything else related to why, but it has been reposted in other places. This post has download links for both “why’s poignant guide to ruby” and “nobody knows shoes.”

Written by benedict

August 25th, 2009 at 12:03 pm

Posted in Uncategorized