March 1, 2010

Old Spice steps up the game

When was the last time you’ve seen a commercial? Probably about a week if you watch tv. Most times you either jump to a different channel or if you TIVO, you just skip them. Of course, there isn’t anything WRONG with that, at least from our point of view. Our TV Shows (however strange and drab) can be considered works of art, simply because they are. Someone has a vision for the show and they set about assembling all the pieces so that they (hopefully) fit together and portray the directors/writers vision. That’s why we love shows. They follow a story line, they allow us to connect to the characters because they mirror us as hyperboles.

But then again, they do have a minimum of 30 minutes to do so. Commercials – they don’t get the same treatment. Marketers and Advertising agencies have a maximum of 30 seconds to wow us, pull us in and convince us we need something. The only thing commercials have is that you can see them every 15 minutes.

So we can see, commercials clearly have a hard time doing what they’re supposed to do. But they make it even harder on themselves by sticking to the standard flow of commericals. For example, any commercial for hair-care products for women have the same formula

  1. Girl with not shiny hair
  2. Girl with non shiny hair uses *INSERT PRODUCT*
  3. Girl with non shiny hair now has shiny hair which she ties into a knot (why?)
  4. Girl flips her hair over her shoulder, smiles at the camera and the commercial ends.

This pattern has been presented so many times to us that we don’t need to see the whole thing anymore. At any of the steps we can quickly identify the type of commercial. Of course, it’s not just womens commercials that follow this. Think of beer commercials aimed at men

  1. Girls
  2. Girls with less clothes
  3. Party with girls with less clothes
  4. Average Joe

They’re all the same, every commercial will follow the pattern of another commercial done before it.

There are of course a few who try and separate themselves, but most times they fall flat. Some notable ones of course, include Pepsi’s commercial featuring Jimmy Fallon and Parker Posey’s dancing through the street.

And now, out of the blue, Old Spice throws its hat into the ring. Creative agency Wieden and Ross (widen and Ross)  have created what I think is one of the best (if not THE best) commercials on TV. Not only do I not mind watching it, but I actually Youtube it because it’s great. It’s nonsensical in an awesome way. Just.. just watch.

February 11, 2010

Blagging about the iPad

At the request of a friend I decided to put up my pre-hands-on review of the iPad. I thought about getting it, but then I figured a magnifying glass and an iPod would be cheaper. But then I realized, I’m not a fan of iPods, so I did the next best thing. Look for reasons not to like it. And boy were there a ton.

What’s in a name

Everything. Bill had it wrong. When you meet someone, you ask for their name. In your mind, it will forever be their name. When you see someone with similar characteristics you will say “Hey, thats like [NAME]” or “Hey, that isn’t what [NAME] would do at all”. When you first hear about a new product, they call it by name. When you talk to your friends about that great new feature of ____, you need to use it’s name. Names are about building associations, so why does it seem like your naming convention for your big “game-changing” product follows a Munroe comic about mispronouncing words? Not to mention the fact that images of various feminine products swim through my head whenever I hear or see someone talking about it.

If I can't see your hands when you're using your iPad, stay away

If I can't see your hands when you're using your iPad, stay away

There, now you’ll forever be scarred by the iPad. The funny thing is, I didn’t even think about this particular definition of the iPad. I saw the Munroe jokes about blagging. A friend pointed this out and now it’s the only thing I can think of.

Features

So you can enjoy your Home Screen, because it's a feature.

I heard you like Home Screens, so we put Home Screens in your Home Screens.

The iPad actually really shines in this department. As much as I rail on Apple, I always say I can hand it to them when they do something good. The iPad runs Safari no problems, has a mail app, can play videos (obviously not HD but not even laptops can do that for a decent price) and it can Youtube (since.. I guess that’s different from videos). It also “iPods”..which I’m guessing is some sort of fancied up classic iPod interface, or dumbed down iTunes interface. It has a notes app for jotting down quick tidbits of thought (such as “Why the hell did I buy this?”), a calendar (for such appointments as “throw iPod at mailman @ 8:30am”, a contact app and my personal favourite the Home Screen! That’s right, apple took what I loved about the home screens (namely that they exist) and put it front and center on the iPad!

Now, let me just cross off the ones on that list that I can’t run on my Blackberry and what you’re left with is a cornucopia of… wait. You’re left with..iPod and Home Screens.

iPod was sort of a given, considering it’s your iPad, but the Home Screens were something no one expected Apple to flaunt.

In Apples’ defence they are touting the iPad as a happy medium between phone and laptop. You get all the portability of a laptop, with all the features of a phone. And Home Screens. You get Home Screens.

However, for all their pluses, Apple gets a few (more) negative points as well.  You can only run two of these apps at any time. And it has to be the Mail app and another app. That’s it. You don’t get to listen to music while watching a how-to video about how to set up the Mail app properly.

It also shits on the face of standards (it’s Apple, did you expect any different?) You’ll find no USB port here for hooking your iPad up to your desktop. You’re stuck with a “30-pin dock connector”. Of course there isn’t a webcam on it, but I can’t really complain about that. My laptop doesn’t have a webcam. And it does have to make concessions to fit that multi-touch screen into it’s very thin packaging. It doesn’t have any expandable memory slots and it’s LED-backlit which is just geek talk for “good luck using it outdoors”.

Oh how we have evolved

Oh how we have evolved


The Apps!

This is where Apple will REALLY be making its money. It pretty much has the final say in whether or not your app makes it to the public and that can be a good thing. After all how many booby apps can one person purchase right? Since this is where Apple really shines they really pulled out all the stops on development. Not only did they make it so that you can use the old iPod/iPhone apps on your iPad, you can scale it up to full screen and they run even better because of the great new hard-ware! Too bad, you can still only run mail and one other app.

In all seriousness however, I will commend Apple on this. Good job developing the API for the iPhone/iPod/iPad line. It was a genius move on their part and hopefully they will continue to ride on its success!

The official iPad ad campaign


The Verdict

The price is win. At 499$ it puts it right at that “I need a new laptop but I’m just going to be using it for work” price point that most people seem to be at. As well, the fact that it advertises itself as portable means that users are definitely going to attempt to lug it around leading to increases in iPad theft rates and thus generating news about the iPad.

Apart from that though, it’s a fail. It touts it self as cheap and easy to use but that puts it in a niche that you and I don’t occupy. The iPad isn’t for you the blog reader, or me the blog writer. Or to anyone who knows how to work a computer. You know who it IS for? Old people. Because they can’t see, so the bigger iPhone interface makes it easier on the eyes. And that have terrible motor control so poking at icons on the great Home Screen is easier than navigating a mouse.

I left my Home Screen in my other sweater...

December 21, 2009

Aggro Detection with Javascript

So you want to make some games? Sure it sounds easy, but until you dive into it you’ll never notice all the little things that go into the backend of it that make or break your game. While this isn’t as big a deal in current browser-based games (they’re either muds, flash or static maps) things are changing in the browser. Everything is getting faster, and things like javascript based animation is actually feasible! So what is an aspiring game developer to do except buckle in and start programming their games?

Once you begin researching you’ll notice that while a lot of browser-based text games take into account Collision detection, they seem to be missing Aggro detection. Aggro stands for either aggravation or aggression and is essentially a way to tell if a monster will attack you or not.. As you’ve probably noticed some monsters tend to rush at you from across the map, while others seem to completely ignore you until you attack them. This is Aggro.

One of the easiest ways to detect aggro is to simply add a variable to your monsters to signify “sight”. This sight variable will dictate how far away you need to be before a monster will attack you. Set this to 100 to have a monster rush at you from across your map or set it to 0 so that it will never attack unless you attack first.

Detection aggro is as simple as following two formula’s. The first will be to figure out the distance between you and the monster and the second will simply be a quick check to see if you fall within the monsters aggro radius. To start off, you need to grab the jQuery javascript framework. While you CAN do this from scratch, jQuery lets you do it a lot easier, plus you can probably add a bit more jazz to your current game if you’re not already using it. If you’re unsure of how jQuery works, take a look at our quick intro to jQuery or just check out the jQuery documentation. Now just cobble together a quick webpage and include the jQuery library. I’m using the minified version 1.3.2 of jQuery, so if you’re not using the same one, make sure you replace that line.

<html>
<head>
	<title>Collision Detection</title>
	<style type="text/css">
	table#grid{
		border-style: solid; 
		border-width: 0px 1px 1px 0px; 
		border-color: #CCC; 
		padding: 0px;
	}
	table#grid tr th{
		border-style: solid; 
		border-width: 1px 0px 0px 1px; 
		border-color: #CCC; 
		text-align: center; 
		color: #333; 
		font-size: 0.7em; 
		font-weight: bold; 
		font-family: "Arial";
		background-color: #EDEDED;
	}
	table#grid tr th.run{
		width: 12px;
	}
	table#grid tr td{
		width: 50px; 
		height: 50px; 
		border-style: solid; 
		border-width: 1px 0px 0px 1px; 
		border-color: #CCC; 
		text-align: center; 
		color: #E0E0E0; 
		font-size: 0.7em; 
		font-weight: normal; 
		font-family: "Arial";
	}
	table#grid tr td:hover{
		color: #333;
		background-color: #F3F3F3;	
	}
	.player{
		background-color: #333; 
	}
	.monsterA{
		color: #333; 
		background-color: #AA0000;
	}
	div#debug{
		border-style: solid; 
		border-color: #333; 
		border-width: 1px; 
		float: right; 
		border-color: #EDEDED;
		text-align: left; 
		color: #333; 
		font-size: 0.9em; 
		font-weight: normal; 
		font-family: "Arial";
		width: 300px; 
		padding: 10px;
	}
	.monsterN{
		background-color: #00AA00;
	}
	</style>
	<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
</head>
<body>
 
</body>
</html>

You’ll notice a bunch of CSS in there, but you can ignore that. It’s pretty straight forward and really it’s just meant to pretty things up a little. Now we’re going to add a quick grid so that you can get an easy visual representation of where you are and where your monsters are and if they will aggro or not. You can copy and paste the following line a few times, and change the y coordinate (x,y) to match which row you’re on.

<tr>
	<td>0,1</td><td>1,1</td><td>2,1</td><td>3,1</td><td>4,1</td><td>5,1</td><td>6,1</td><td>7,1</td><td>8,1</td><td>9,1</td>
</tr>

Finally, I’ve just added a “debug” section, so you can get a textual representation of what’s going on. It’s just a div placed above the grid.

<div id="debug">
	<b>Debug</b><br><br>
</div>

The Code
Now for the code that will give us a visual representation of our player and our monsters. First off we are going to initiate a few variables that we will be using throughout our script. They’re pretty self explanatory.

var playerPlaced = false; 
var monster = []; 
var player = [];

Now we’re going to set it up so that when we click a square it will check if our player is already placed or not. If he is NOT placed, then we are going to place him and update our “debug” section.

$('#grid tr td').click(function(){
	var distance;
});
if(!playerPlaced){
	player['loc'] = $(this).html().split(','); 
	player['sight'] = 0; 
	$(this).html('@'); 
	$(this).addClass('player'); 
	playerPlaced = true; 
	$('#debug').append('Player: '+player['loc']+'<br>');
}

Notice that we’ve set player['sight'] to 0. Why? Simply because your player doesn’t have an aggro radius. He may or may not attack at your discretion, so it’s irrelevant. A monster however, will ALWAYS attack if you get within its aggro radius (assuming no other modifiers).

The next bit will just place our monsters if there is already a player on the field. When we do, however, we are going to call some functions that will take care of calculating distance and checking if the monster will aggro. We’ll go over those first, since they’re more complicated.

Distance
To calculate the distance of two points we are simply going to take the x,y coordinates of both our monster and player and perform some math on them. The formula that we will be using is actually the distance formula between two points (and you wondered when you would ever use it…) and something that’s been drilled into us in every math class. The formula itself is a basically sqrt(sq(x1-x2)+sq(y1-y2)) so translating that to our game code it will look more like

sqrt(sq(player[x]-monster[x])+sq(player[y]-monster[y]))

The squaring and square rooting would take us a lot more work, if JavaScript didn’t already have those built in! Our actual distance formula in JavaScript (after being placed in a function) will look like this:

function getDistance(from,to){
	distance = Math.floor(Math.sqrt(Math.pow((from[0]-to[0]),2) + Math.pow((from[1]-to[1]),2))); 
	return distance; 
}

Intersection
Basically intersection in our scenario will take a look at the player and see if he falls within the aggro radius of the monster. It’s a very simple check that just goes if (distance < aggroRad) then it will aggro.

function willAggro(aggro,distance){
	if(distance > aggro){
		return false; 
	}
	else{
		return true;
	}
}

Monster Insertion
Finally, we’re going to do our check to see if a monster will aggro a player or not depending on its distance to the player.

monster['loc'] = $(this).html().split(','); 
monster['sight'] = 1; 
$(this).html('X');
 
distance = getDistance(player['loc'],monster['loc']); 
if(willAggro(monster['sight'],distance)){
	$(this).addClass('monsterA');
}
else{
	$(this).addClass('monsterN');
}
$('#debug').append('<b>Monster:</b> '+monster['loc']); 
$('#debug').append(' <b>Distance:</b> '+distance+''); 
$('#debug').append(' <b>Aggro:</b> '+willAggro(monster['sight'],distance)+'<br>');

And that’s all there is to it. If you run this page and take a look, you’ll notice that clicking a grid will place your player and clicking anywhere else will cause the monsters to appear in either green (if too far away to aggro) or red (if it will aggro). This is also noted in the debug section!

Here is our completed javascript section

$(document).ready(function(){
	var playerPlaced = false; 
	var monster = []; 
	var player = [];
 
	$('#grid tr td').click(function(){
		var distance;
		if(!playerPlaced){
			player['loc'] = $(this).html().split(','); 
			player['sight'] = 0; 
			$(this).html('@'); 
			$(this).addClass('player'); 
			playerPlaced = true; 
			$('#debug').append('Player: '+player['loc']+'<br>');
		}
		else{
			monster['loc'] = $(this).html().split(','); 
			monster['sight'] = 1; 
			$(this).html('X');
 
			distance = getDistance(player['loc'],monster['loc']); 
			if(willAggro(monster['sight'],distance)){
				$(this).addClass('monsterA');
			}
			else{
				$(this).addClass('monsterN');
			}
			$('#debug').append('<b>Monster:</b> '+monster['loc']); 
			$('#debug').append(' <b>Distance:</b> '+distance+''); 
			$('#debug').append(' <b>Aggro:</b> '+willAggro(monster['sight'],distance)+'<br>'); 
		}
	}); 
}); 
 
 
function getDistance(from,to){
	distance = Math.floor(Math.sqrt(Math.pow((from[0]-to[0]),2) + Math.pow((from[1]-to[1]),2))); 
	return distance; 
}	
 
function willAggro(aggro,distance){
	if(distance > aggro){
		return false; 
	}
	else{
		return true;
	}
}

This is a very simple way to check aggro and the reason I placed it in its own function was incase you needed to modify it in any way (for example if a monster was under 10 levels its aggro would be 0 always).