Decimal, hexadecimal, octal characters and their usage in HTML, CSS and JavaScript

Character encoding is a lot like regular expressions. Every time I need to know how it works, I have to learn it all over again. The real reason for this post is to provide a cheat sheet for those times, but first I’ll give you the skinny on character encoding.

Consider the quotation mark character (“). There are many ways this character can be represented on a computer. Ultimately, like any character, the quotation mark boils down to a series of zeros and ones that can be understood by the various electronic doodads connected to your motherboard. To those doodads, the quotation mark is simply 100010.

How would you like to type that every time you needed a quotation mark? Just think, if you wanted to quote Monty Python and the Holy Grail, you’d have to type:

100010 101001 1101110 1101111 1110100 1101000 1100101 1110010 100000 1110011 1101000 1110010 1110101 1100010 1100010 1100101 1110010 1111001 100001 100010

Every binary number has an equivalent decimal number as well as a hexadecimal number and an octal number. The binary number 100010 is equal to the decimal number 34. It’s also equal to the hexadecimal number 22 and the octal number 42. Don’t think about it too hard, just take my word for it:

100010 = 34 decimal = 22 hexadecimal = 42 octal

This makes it much easier to quote Monty Python, but it’s still kinda cryptic and painful to type it in decimal:

34 41 110 111 116 104 101 114 32 115 104 114 117 98 98 101 114 121 33 34

Fortunately for you (and especially for me, since I quote Monty Python a lot), there are layers and layers of software that run on top of the hardware in your computer that can translate for you. So you almost never have to type anything in binary or decimal anymore. These days, you will almost always be working with a character set, which maps each of those zeros and ones to their respective glyphs to make them easier to use. You can think of a character set like this:

" -> 100010
A -> 101001
n -> 1101110
o -> 1101111
...

A Unicode character set will map those characters to hexadecimal numbers instead of binary numbers:

t -> 74
h -> 68
e -> 65
r -> 72
...

Except instead of hexadecimal numbers they are called Unicode points, and they look like this:

s -> U+0073
h -> U+0068
r -> U+0072
u -> U+0075
...

Then some other layer will take care of mapping those hexadecimal numbers to zeros and ones for the sake of the doodads we mentioned earlier.

Most character sets have a lot more characters than you can see on your keyboard. If you’ve ever needed to use one of them, you either had to punch in a super special secret code (like holding down the alt key and pressing 0 1 6 9 on the number pad for the copyright symbol), or – specifically if you are a web developer – you had to look up a magic string to use in your HTML (like ©). There are actually several ways to use these special characters in your HTML, involving their decimal, hexadecimal and octal representations. Here’s another way you can add the copyright symbol to your pages:

©

In normal fonts like Arial or Times, the decimal number 169 corresponds to the glyph for the copyright symbol. You can also use the hexadecimal number A9 pretty much the same way but with the letter x in front of it:

©

Or you can use the hexadecimal number in your stylesheet instead. This is the approach taken by Dave Gandy when he created Font Awesome:

<style>
  .copy:after {
    content: '\00A9';
  }
</style>
<span class="copy"></span>

Finally, you can use the octal number in your JavaScript:

<script>document.write('\251');</script>

The reason I needed to do this (and you might find it useful too) was so I could see all the characters a font contained. I couldn’t use the Character Map utility in Windows because it didn’t allow me to adjust the font size, and I didn’t want to spend all day looking for a replacement. I found it much easier to simply print all the characters to a page using some JavaScript:

<script>
    var i;
    
    for (i = 0; i < 2048; i++) {
        document.write('&#' + i + '<br/>');
    }
</script>

How to enjoy Fallout (part two)

I know I said that having fun in the wasteland was pretty simple, but I finished it this weekend and decided there are a couple more tiny pieces of advice you could really use in order to maximize your enjoyment with the game. Don’t worry, I won’t spoil anything major here and I won’t simply tell you how to play the game a la a proper walkthrough. But you can call this The Absolute Minimal Fallout Walkthrough for Pros if you wish and I won’t get offended.

I already told you to 1) not read any walkthroughs and to 2) read the manual, so here’s 3) and 4).

3) When you start running out of time to find the water chip, you might as well just ask Google. The game itself will give you absolutely no hints on how to accomplish this, so there’s no shame in looking it up. Afterwards you’ll be free to go about exploring and exploding enemies like blood sausages at your leisure.

4) If you try to beat the game and decide to go the violence route without first obtaining power armor, then you’re in for a world of pain. Do yourself a favor and look that one up too.

I believe that’s it. I almost told you to 5) go ahead and let your companions die, which will spare you the tedium of managing their inventories and of keeping them alive, but I have mixed feelings about that so you can take it or leave it. Actually, that goes for all of my advice. I’m a decade or so short of being a Fallout guru.

How to enjoy Fallout

It’s been a while since I advised anyone on the proper way to play a game. That post made me look like a Skyrim apologist: “Skyrim might seem boring – the combat is clunky, the interface is awful, looting and managing inventory is tedious, and the quests are unrewarding – but you’re probably just playing it wrong. Just don’t do anything the game tells you to do. Yeah, all the containers are full of stuff to loot and inspect, but don’t bother looking in them because none of it is any good. What? Don’t ask me why they put it in there. Yeah, I suppose they could have spent the development time making better quests or fixing the broken AI but… just leave it alone, alright? Oh, and ignore all that dragon stuff. It’s anti-climatic. Learn to enjoy fetch quests instead, then it will be fun.”

Hey, I’m sure every blogger has posts they’re ashamed of, right?

UR PLAYIN IT WRONG!!1

UR PLAYIN IT WRONG!!1

Needless to say, my final impressions of Skyrim were not nearly as glowing as my initial ones. (“No way – I can go anywhere and do anything? What fun! Wheeeeeeeeeeee! You need me to do what? I’m the friggin’ Dragonborn! Get your own stupid thingama- ah, this sucks. I’m bored.”) From what I’ve read, this is a pretty common response to the game.

My gaming preferences have changed quite a bit since I wrote that article. I blame this on playing too much Demon’s Souls and reading too many articles about classic RPGs like Baldur’s Gate, Gothic, and Fallout.

No, not that Fallout:

A first person shooter with Fallout stuff in it.

A first person shooter with Fallout stuff in it.

I’m talking about this Fallout:

The original Fallout.

The original Fallout.

It turns out that gamers with a lot of classic RPG experience (read “hardcore” gamers) have little to nothing good to say about Bethesda’s re-imagining of Fallout. Yet many hold the original game in reverence, some even citing it as the supreme RPG. Get a load of these reviews on GOG.com:

Fallout is one of the few games that can truly be called a classic. Modern games today fare poorly to what Fallout provides… This game is a must for any RPG lover, or someone looking for an introduction to the genre.

Playing this game has been a revelation… if you ever needed an illustration of why shiny graphics should take second place to gameplay, Fallout is it. The depth of the game is incredible…

A fantastic RPG game set in a post-apocalyptic world filled with survivors, mutants and interesting locations, considered by many to be the best game in history… Fallout is a game with a rich world and countless possibilities. Personally I believe that every gamer should play it until the end at least once. I definitely recommend this game to everyone!

Or check out what critics have to say about Fallout:

[Fallout] has the best replay value of any game I’ve experienced to date.

This is one of those rare games that oozes quality from every pore.

When you start the game you’ll be treated to with one of the most chilling, well-written introductions a game has ever been blessed with.

In an age where many are predicting the death of traditional RPGs at the hands of multiplayer extravaganzas, Fallout is a glowing example of the genre, one which positively radiates quality.

You get the impression: If you haven’t played Fallout, you probably should if you want to have a better appreciation for RPGs. I’ll be the first to admit that I was initially turned off by the outdated graphics. What really got my attention, however, is the amount of praise Fallout receives from gamers who are jaded with modern RPGs like Skyrim and Mass Effect. I’m in that camp, so I should definitely enjoy Fallout, right?

Wait for it…

Yes! I totally enjoy Fallout. And you can too if you give this game a fair chance. But before you go and buy it and start playing it, I have one tiny piece of advice. I know I said I wouldn’t tell you the proper way to play a game again – Fallout doesn’t need that anyways – but hear me out.

First, don’t use a walkthrough. There are lots and lots of them around, so you’ll have to be careful in order to avoid them. At times, it will be especially tempting to just glance at a walkthrough. Don’t do it!

You see, part of what makes a game like this so great is the opportunity it gives you to discover things on your own. A walkthrough – particularly the type that tells you every step you should make, every skill point you should invest, every perk you should choose, etc. – robs you of that chance. Unlike modern RPGs that hold your hand, making it impossible for you to lose and taking away all sense of risk and reward in the process, there is no hand-holding in Fallout. Your mission is to find a water chip. “Okay, great!” you say. “I’ll head for the nearest quest marker.” Lo and behold, there is a marker, but you won’t find anything there. At this point, you could consult the nearest walkthrough, but you would be robbing yourself. Go explore! Go get killed! Learn lessons. Make mistakes. Meet people. Ask questions. Gain companions. Figure it out.

I’m willing to bet that most people who have such fond memories of Fallout didn’t have a walkthrough when they played it, since the internet was hardly a thing then.

Second, (and finally) read the manual. Fallout is an arguably complex game. This is a good thing. The manual is your friend.

The Fallout manual is also occasionally hilarious.

The Fallout manual is also occasionally hilarious.

Also, the GUI is rather counter-intuitive. So the manual is worth a read for that section alone.

That’s it. See? A pretty simple guide to having fun in the wasteland. So go give Fallout a chance. You won’t look at RPGs the same way after.

Boxy design is for squares

Take a look at this awesome website:

A common way to design websites.

A common way to design websites.

Aside from the nice use of contrast and alignment, impeccable taste in high quality stock photography, and intricate combinations of words related to bacon, this website design is extremely generic. You might have a lot of problems with how it looks, but what I want to rant about specifically is the overuse of boxes in this boxy design.

How many boxes can you count on this one page? I count at least 20. In case you actually took the time to count them up, I highlighted the ones you probably missed:

Don't forget the huge empty white columns on either side of the main column in the middle.

Don’t forget the huge empty white columns on either side of the main column in the middle.

Maybe you missed some others, but the point is that there are way too many boxes on this single page. This is not an uncommon design – now that I’ve pointed it out, you’re likely to spot it all over the internet.

There are still two more boxes that we are forgetting that are present on every webpage. Can you think of what they are? I’ll give you a hint, you can see them right now (I mean before you look at the picture)…

It's a box within a box within a box within a...

It’s a box within a box within a box within a…

The edges of your monitor form a box around everything on your screen. That’s one box you can always count on being there, whether you’re on a PC, a Mac, tablet, smartphone, or whatever. The browser window also forms a box around everything in your browser. Granted, you won’t have one if you’re on a tablet or smartphone, but otherwise you will. This renders the main column above (the huge box in the middle groups that everything on the page together) rather pointless.

So I have to ask: Why is boxy design still so common? Let’s get rid of some of those boxes already!

A few less boxes makes a big difference.

A few less boxes makes a big difference.

Why does this work? The purpose of the boxes that were in the background was to group the content together, but the content is already grouped together because related content is in close proximity to each other! We know that picture of the squirrel goes with the text beside it, and that “A Chunk of Content” goes with the text beneath it. Further, we can tell that it is the title of the article because of how the information is arranged – the title is bigger, and it’s at the top. Our brains are wired to disseminate information like this, so the boxes really didn’t add anything to help us.

Notice that I didn’t remove all of the boxes on the page, only the ones that were totally unnecessary. I still like the contrast provided by the black buttons, so I left those alone.

Also, notice that there aren’t as many things cluttering up the background of the page, so I freed up the color palette. I can use the color I was using in the background as the color of my headers, which adds another dimension of contrast.

Now I’ll be the first to point out that this still isn’t a great looking page, but it looks a lot better than it did when we started. If you’ve got other ideas that could improve this design even further, I’d love to see them!

Slightly fewer boxes, slightly more creative flair.

Slightly fewer boxes, slightly more creative flair.

By the way, I’ve mentioned this before, but almost all of my good design ideas came from The Non-Designer’s Design Book by Robin Williams. Even though I make nothing from advertising, I highly recommend this book to anyone who even occasionally has to do design stuff.

Why is Demon’s Souls so good?

I’ve talked about Demon’s Souls here before. That was about a year and a half ago. As it was one of the main reasons I decided to purchase a PlayStation 3 instead of an Xbox 360, it was one of the first games I bought after acquiring the system in 2010. In other words, I’ve been playing this game for almost three years now, and I keep coming back to it for more. There is something about Demon’s Souls that is genuinely compelling, more-so than any other game I can remember from the last few years. In fact, Demon’s Souls is so good that it’s turned me into somewhat of a game snob. The same kind of thing happened when I became accustomed to strong ale, in particular Arrogant Bastard Ale by Stone Brewing Co. After drinking enough of that stuff, everything else kind of lost its taste. The way Stone describes its beer is intended to come off as elitist and arrogant, which is hilarious in itself, but it’s also funny how closely it describes the way I feel about Demon’s Souls (with a few tweaks):

This is an aggressive [game]. You probably won’t like it. It is quite doubtful that you have the [skill] or sophistication to be able to appreciate [a game] of this quality and depth. We would suggest that you stick to safer and more familiar territory – maybe something with a multi-million dollar ad campaign aimed at convincing you it’s [the most awesome thing ever], or one that implies that their [multiplayer and social features] will give you more [friends]. Perhaps you think multi-million dollar ad campaigns make things [more fun]. Perhaps you’re mouthing your words as you read this.

Of course, I’m kidding. But it’s kind of sad that so many people only ever drink tasteless fizzy yellow beer, and so many people only ever play games that are backed by major corporations, that lack any element of challenge or creativity, and that are purely motivated by sales numbers and review scores. Demon’s Souls is not a perfect game. There are a few things From Software could have improved. But my list of complaints is relatively short, so let’s get those out of the way first:

  1. Corpses shouldn’t be all that animated. I can understand if a body moves when you step on it, but why do they have to flail about so much?
  2. Often, the only practical way to figure things out is to read the wiki – particularly when it comes to some of the bosses (such as Flamelurker, Maneater, or even Leechmonger), unless you enjoy starting over at the beginning of a level with your health reduced to half and nothing to show for it.
  3. The interface is rather clunky, especially when comparing weapon and armor statistics. Again, your best bet for choosing the right weapon is probably to read the wiki.

It actually took a fair amount of head scratching to come up with that short list, which should speak volumes on behalf of the quality of the game. Now let’s look at what Demon’s Souls does right.

Hard but fair

Every game should balance its difficulty in such a way that it is neither too easy nor too hard. That much is obvious – and I’m sure it’s easier said than done from a development standpoint – but where most games totally fail at this, Demon’s Souls gets it just right. When I purchased Demon’s Souls, the guy behind the counter cautioned me, saying that “it was a real controller breaker” for him. I have to say that I never had the urge to crush my controller to pieces or throw it at the wall while I was playing Demon’s Souls. I have experienced that level of frustration with a number of other games. For instance, in God of War, there is a section in Hades where you have to climb these spinning columns covered with spikes that kill you in one hit. It’s nearly impossible to climb to the top. If you’ve played the game, you will definitely remember this part:

Pure evil.

Pure evil.

The reason I remember it so well is because I had never been so frustrated with a video game in my life… until I played Dead Rising 2 and I had to fight this piece of crap:

Possibly the worst boss fight ever.

Possibly the worst boss fight ever.

Actually, all of the boss fights in Dead Rising 2 are tedious and cheap. Some other rage inducing games (off the top of my head) include Uncharted: Drake’s Fortune, Deus Ex: Human Revolution, Killzone 2, Resistance 2, Psychonauts, and Assassin’s Creed. These games are generally very easy with the exception of a few segments where the difficulty is increased to such an extreme level that it requires more luck than skill to get past. To alleviate this problem, these games usually give you a checkpoint right before you are sure to fail, so you can experience the frustration of that segment over and over again until you get the timing exactly right (or whatever it is you have to do) and make it to the next checkpoint. Demon’s Souls never does this. Don’t get me wrong – you will die if you aren’t careful. But, if you are careful, chances are you will make it through most of the game alive.

Don't be like this guy - he's not being careful.

Don’t be like this guy – he’s not being careful.

Blogger Nick Burgener explains this point very eloquently:

While virtually every press release has touted the game’s challenging difficulty, and many gamers have accused it of being exceedingly cheap, tedious, and frustrating, the simple fact of the matter is that Demon’s Souls is not that hard, as long as you approach it intelligently… It can be very challenging at times, yes, but I think Demon’s Souls represents an ideal for challenging gameplay; it’s not afraid to punish you for your failures, which makes your successes that much more meaningful, and it rewards you greatly for playing well. The challenge is neither tedious nor frustrating; it’s intelligent and personal. As long as you play intelligently, it becomes a surprisingly easy game. (source)

I wouldn’t say Demon’s Souls is ever easy. Aside from that, I couldn’t have put it better.

The story takes a back seat

I’m not of the mindset that games should never have stories. Good games usually benefit from good stories. But some games are so heavy-handed with their stories that their gameplay suffers as a result. Take Dragon Age 2, for example, where the gameplay was dumbed down so badly that all that remained was a shell of an RPG – the only choices to be made in the game are superficial at best; the combat is simplistic and repetitive; the player is shoehorned into following a predetermined path. Apparently, BioWare thinks it’s more important that their game tells a mediocre story than that it implements solid RPG mechanics and interesting gameplay.

dragon-age-2-strategy-who-needs-it

We could talk about Mass Effect as well. But BioWare is not the only developer that is guilty here. The Witcher is a pretty solid RPG – there are a lot of choices to make that have interesting repercussions throughout the game; the skill tree is immense; it would take multiple playthroughs to experience everything the game has to offer. But the story, as profound as it’s supposed to be, is boring and trite. These people and the world they live in are screwed no matter what you do, because reality is grim and dark and all that. Normally I can overlook this kind of thing in games, but The Witcher beats you over the head with its story, its lore, its characters, its morality and philosophy to the point of exhaustion. I love the way Dr. Atomic puts this on his blog:

Consider Geralt’s two swords; as a monster hunter, he carries one made of steel for use against men, and one made of silver for use against monsters. Ah, but as Geralt says, “both are for monsters.” Do you get it? Humans are monsters. If you didn’t catch that, the game will ram it down your throat against and again with all the subtlety of a sledgehammer. Poor Geralt can’t swing a sword without hitting someone prattling on about “Hey, remember that time we raped/murdered/slaughtered that entire village? Good times, mate!” or spewing a stream of profanity that would make a sailor blush. (source)

Most of the game (aside from running fetch quests) amounts to choosing dialog options and watching cutscenes. It asks you to make some really tough decisions, but it’s hard to care about any of the characters because they all suck so bad. Geralt is no better. His personality can be summed up in one word: indifferent.

These people are all jerks, but Geralt doesn't really care and neither should you.

These people are all jerks, but Geralt doesn’t really care and neither should you.

Demon’s Souls, in contrast, doesn’t get bogged down with its story. There’s actually a great story and a heap of lore to be found in the in-game descriptions of characters, items, and locations, but the better story is the one that’s told through your actions. The gameplay is exciting! The boss fights are intense! These are things I actually want to share with other people – Did I tell you about the time I beat Maneater with a shred of health left? I was literally jumping up and down!

One of the toughest boss fights in the game.

One of the toughest boss fights in the game.

No dialog trees

There has got to be a better way to role play than choosing conversation responses. I can appreciate a game that gives you different ways to develop your character, and I realize that the dialog tree is a long established RPG tradition. But every time I see one of these I physically cringe:

Oh crap, dialog tree...

Oh crap, not another dialog tree…

This could be a matter of personal preference, but if I wanted to read a book I would pick something with a much better story than this. What do I really need to know about Moira from Fallout 3? And why is she so eager to discuss her life story with me? For all she knows, I could be role-playing a murderous psychopath. It’s either that or a wussy pushover since there’s usually not a middle ground when it comes to conversation options.

The neutral option is generally preferred.

The neutral option is generally preferred.

In contrast, what does Blacksmith Ed tell you about himself? Absolutely nothing! He’ll tell you about his profession, but only what you need to know: “If you need a blacksmith, bring me demons’ souls.” The result: less of my time wasted on boring plot and character details.

He even tells you to get lost. I love it!

He even tells you to get lost. I love it!

Deep, complex RPG mechanics

While most developers are busy stripping RPG mechanics out of their games to provide a more streamlined experience to the casual crowd (Skyrim, Dragon Age 2, Mass Effect), it’s possible to spend hours deciding how to customize your character and equipment in Demon’s Souls. Will you put all the souls you accumulate into increasing your magic power or increasing your capacity for magic spells? Will you spend all your precious upgrade stones acquiring a better spear or a more powerful bow? Chances are you won’t have enough to do both in one playthrough, so you have to decide. Will you give the Yello Demon’s Soul to Blacksmith Ed to forge an incredibly powerful catalyst, or to Sage Freke to learn an unstoppable magical attack? Of course, you could simply consume it for a ridiculous amount of souls. It sure is tempting…

You won't be getting another Yellow Demon's Souls anytime soon, so choose wisely.

You won’t be getting another Yellow Demon’s Souls anytime soon, so choose wisely.

These kinds of decisions make for a compelling meta-game that you could be playing for years to come, which is why so many people are still playing Demon’s Souls. SnapSlav summarizes my points thus far very well over at No Mutants Allowed:

Demon’s Souls immediately sets itself apart from other RPGs in its unique design. Unlike many RPGs, Demon’s Souls avoids lengthy narrative and exposition, in favor of giving the player full control of their destiny. As a whole, the distinct and creative mechanics of the game are so vast that entire Wiki articles have been dedicated to fleshing out and explaining each particular one. (source)

Not convinced yet? Check out the articles on character tendency and world tendency on the wiki, and there’s a lot more where that came from.

Creative use of multiplayer

Between Quake 3 Arena, Unreal Tournament, Battlefield, Call of Duty, the Enemy Territory games, and a plethora of Half-Life mods, I’ve sunk literally hundreds of hours into multiplayer gaming. I started to lose interest when perks became a popular feature in multiplayer games, after which it always felt like a grind to unlock the next weapon or powerup. Players that have unlocked better perks have an unfair advantage over players that haven’t, which enables them to unlock even more perks, which gives them even more of an advantage. This is by far the most popular model in multiplayer games today.

You want these, don't you?

You want these, don’t you?

There’s also a groupthink mentality that is present in multiplayer games today. I believe this is why the Xbox 360 is arguably more popular than the PlayStation 3, and why games like Halo and Call of Duty sell better than other games that are better in almost every respect. If you have an Xbox 360 and play Halo and Call of Duty, then you are part of a huge group of gamers. It means you suddenly have something to talk about with the people that play those games after school or work, even though there’s not much worth talking about in those games.

Remember that time the red guys were on the ATVs, and the blue guys were shooting at them? That was awesome.

Remember that time the red guys were on the ATVs, and the blue guys were shooting at them? That was awesome.

I won’t describe all the details about the multiplayer in Demon’s Souls, since you can read about it on the wiki. Suffice it to say that it’s totally unique. Playing a level with a blue phantom could mean the difference between life and death, and being invaded by a black phantom is an absolutely terrifying event if you aren’t prepared for it.

Victory in Demon's Souls is worth sharing.

Victory in Demon’s Souls is worth sharing.

Finally, I can’t tell you how many times I was saved by a message that warned of an imposing ambush. No other game encourages you to help other players by leaving messages for them in their worlds.

A refined experience

These days, developers are always trying to up the ante when it comes to the scope of their games. “You thought Rome was big in Assassin’s Creed: Brotherhood? Wait ’til you see Constantinople in Assassin’s Creed: Revelations!” “Forget Constantinople, Skyrim is so big it will take you hours to cross on foot!” (Don’t try this at home, it will literally bore you to death.) I actually gleaned a lot of enjoyment from Skyrim before I realized how irritated I had become with it. But there is an inherent design problem in games where the player can “go anywhere and do anything.” How do you quality test a piece of software like that? The only practical way is to draw a line once you feel you’ve eliminated enough bugs. And, seriously, don’t get me started on the bugs…

'nuff said.

’nuff said.

As for infinite quests, they are hardly something to be desired when they amount to nothing but fetch quests and random, meaningless encounters.

Do me a favor and tell that guard over there you never saw me. Or don't. On second thought, it really doesn't matter.

Do me a favor and tell that guard over there you never saw me. Or don’t. On second thought, it really doesn’t matter.

Demon’s Souls may not have a map the size of the Amazon Rainforest, but it also has a lot less bugs as a result. (See what I did there?!) It may not have infinite quests, but the quests it does have are worthwhile. It may not have thousands of fully voiced NPCs, but the characters it does have are memorable and charming. It’s a rock solid game with relatively few, minor bugs. The only one I can think of that ever bothered me was the corpse behavior I mentioned earlier.

Bucketlist

This post has gone on long enough, so I’ll just briefly mention some other things that make Demon’s Souls so good.

  1. The atmosphere is totally creepy, and is far scarier than games that are supposed to be scary (Dead Space, F.E.A.R., Resident Evil…). Fantasy horror might be my new favorite combination of genres.
  2. The level design is smart and unique. What other game has a level like Tower of Latria, or Shrine of Storms, or Valley of Defilement (my absolute worst nightmare)?
  3. The graphics (or aesthetics, if you prefer) are extremely polished. Lots of games that tout realism as a strong point (Skyrim, Assassin’s Creed…) look like garbage next to Demon’s Souls, even though it’s several years older.
  4. The soundtrack is subtle and beautiful. Most of the time, you don’t hear any music at all, which sets the mood appropriately given the places you find yourself in.
  5. Cutscenes are few and far between. When there are cutscenes, they’re short.

Conclusion

Unfortunately, there are not a ton of people that are willing to give a game like Demon’s Souls a fair chance, which means we will only get more shooters and dumbed down RPGs in the years ahead. I’m optimistic though that developers like From Software will always be around to provide those of us that are willing with these kinds of unique, engaging experiences. Failing that, we can try picking up a programming book or two and creating something special ourselves. PS: Despite what it may sound like, I am not at all religious about video games, and I don’t mean to offend anyone who enjoys the games that I criticize. This is just an opinion piece.

How do you pronounce mingw?

There are some things in life that are important. This is not one of them. But this is something you could argue with your co-workers about for days on end.

By the way, is anyone hiring?

A beginner’s Visual C++ tutorial

A friend of mine who just started learning C++ ran into a build error on his first program, which looks likes this:

#include <iostream>

using namespace std;

int main()
{	
    cout << "Hello world!" << endl;
    return 0;
}

This is the type of program you’d expect to see in just about any beginner’s C++ tutorial. What they usually don’t tell you is that this program won’t work in Microsoft Visual C++ without some additional configuration.

Visual C++ displays the full error message in the Output pane (bottom)

Visual C++ displays the full error message in the Output pane (bottom)

You can see the full error message in the Output pane, which is normally docked at the bottom of the window. Here is the rest of the message:

1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>  ConsoleApplication1.cpp
1>e:\code\visual c++ projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp(1): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>e:\code\visual c++ projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp(10): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Right away, there’s a problem with line 1. We know this because the line number is shown in parentheses after the filename in the Output pane. This is followed by the warning code, which is C4627, and the rest of the warning message. Visual C++ is pretty clear about what the problem is, but if you’re completely new to programming or to C++ then these words probably don’t mean much to you.

Beginners often get flak in programming circles for not reading or understanding error messages – in this case, a search for warning c4627 would get you pretty far – but I think this is a bit unfair. We don’t normally expect anyone to read, much less understand, something in another language. There’s a lot of vocabulary here for a beginner to learn. So let’s break this error message down, starting with:

'#include <iostream>' skipped when looking for precompiled header use

Basically, the compiler didn’t bother to include the file we asked it to (it skipped it). What’s a “precompiled header?” It’s just another C++ file that has some code that we need in it, plus it’s already been compiled. We don’t need to compile it again because it is not going to change. (i.e., iostream will probably never be updated.)

Add directive to 'StdAfx.h' or rebuild precompiled header

A “directive” is an instruction we can give to the compiler. In our program, #include <iostream> instructs the compiler to look in the iostream header file for things like cout. We could add another directive like this to stdafx.h, another header file which is included in our project under “Header Files” in the Solution Explorer pane.

(By the way, are we having fun yet? Get used to debugging errors if you want to become a programmer. i.e. don’t get discouraged. At least 50% of my time at work is spent debugging errors.)

Visual C++ reports not one but two problems with our code. The second error message comes from line 10, error code C1010:

unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?

Here, the compiler is telling us it kept looking for our precompiled header ’til it hit the end of the file. It never found it, but it thinks it could be in stdafx.h. Unless you’ve been reading ahead, it won’t find it there either. It doesn’t know either way because we never told it to look there. i.e., we didn’t #include "stdafx.h" at the beginning of our file.

Want to know something freaky? Our program compiles without a hitch in Code::Blocks.

This is because new projects in Visual C++ are configured to use precompiled headers, but not in Code::Blocks. That tutorial we got our code from probably assumed we weren’t using Microsoft tools but standard tools like GNU Make. In fact, Code::Blocks normally comes with a version of GNU specifically for Windows called MinGW (Minimalist GNU for Windows). That solves that mystery.

But how do we fix our program? I’ll tell you how to change your project’s configuration to get up and running quickly, but I’ll also tell you how to take advantage of precompiled headers if you want to do things the Visual C++ way.

First, if you want Visual C++ to behave like Code::Blocks, right click on your project in the Solution Explorer pane and go to Properties:

The project's context menu as seen in the Solution Explorer pane.

The project’s context menu as seen in the Solution Explorer pane.

On the left side of the properties window, drill down to Configuration Properties > C/C++ > Precompiled Headers. Change the first option, simply named Precompiled Header, from “Use (/Yu)” to “Not Using Precompiled Headers,” then click OK.

We don't need no stinking precompiled headers... except for when we do.

We don’t need no stinking precompiled headers… except for when we do.

Now you can run your program!

If you want to use precompiled headers instead, simply change the first line of your program:

#include "stdafx.h"

using namespace std;

int main()
{	
    cout << "Hello world!" << endl;
    return 0;
}

Then add the missing directive to stdafx.h:

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

#include <iostream>

Now, run your program and celebrate. You are a programmer.

Did you see the console window appear for a brief second and then disappear? Typically, console programs do their thing and then close immediately. You can tell your program to pause and wait by adding a call to system("pause") before the line return 0:

#include "stdafx.h"

using namespace std;

int main()
{	
    cout << "Hello world!" << endl;
    system("pause");
    return 0;
}

That way you’ll have time to admire your beautiful program before closing it.

For extra credit, modify your program to print something awesome to the console.

For extra credit, modify your program to print something awesome to the console.

How to play Left 4 Dead (and Left 4 Dead 2) in split screen mode on PC

Although this has been documented elsewhere (see here and here), the instructions are mostly geared towards people who want to use a gamepad for one player and a keyboard/mouse for another player. If you are fortunate enough to have two gamepads for your PC, then playing Left 4 Dead in split screen mode is surprisingly easy to set up.

Step 1: Download this Xbox 360 controller emulator by Evaldas Jocys. The file you want is named something like x360ce.App-2.0.2.158.zip, give or take the version number. (Sound familiar? This is the same thing we did for Dead Rising 2.)

Step 2: Extract the zip archive to your Left 4 Dead executable directory, which will be something like C:\Program Files (x86)\Steam\steamapps\common\left 4 dead.

Step 3: Run the x360ce executable file. When the program launches, it will prompt you to create the x360ce.ini file. This is the file that holds the configuration settings for the program. It will also prompt you to create the xinput1_3.dll file. This is the library file that gets compiled along with the configuration settings and will enable your gamepad to work with the game. Click Yes on both of these prompts to create the files.

Step 4: At this point, you should be looking at a new window that says “New Device Detected.” Leave the first radio button checked – the one that says “Search automatically for settings” – along with the checkbox that says “Search the Internet” and click “Next” at the bottom of the window. Finally, click Finish at the bottom of the next window to import the settings. If the program displays a green box on the tab for the controller you have selected, then you can continue to step 5. If it displays a red box on the tab, then see the troubleshooting section below.

If you’re using two gamepads, repeat this step for the second one.

Step 5: Click Save at the bottom-right corner of the window and close the program.

Step 6: Go to your Left 4 Dead bin directory, which will be something like C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\bin. Rename the xinput1_3.dll file to xinput1_3.dll.old.

Step 7: Launch the game. Click on Options, then on Keyboard/Mouse. Make sure “Allow Developer Console” and “Gamepad” are both enabled. Then click Done.

Step 8: Hit the tilde key (~) on your keyboard to open the console and type:

ss_map mapname

Replace mapname with the actual name of a map. Auto-completion in the console should help you out here.

That’s it! You’re done. Unless you are playing Left 4 Dead 2. In that case, enter this command in the console once the map has finished loading:

connect_splitscreen localhost 2

When you’re done using a controller and want to use your keyboard/mouse again, go back into Options, Keyboard/Mouse, and disable the gamepad.

Have fun!

left4dead

What if x360ce doesn’t recognize my gamepad?

Since I normally use a fairly ubiquitous gamepad (Logitech Wireless Gamepad F710), I had never encountered this problem until I tried my other one (PS3 Afterglow Controller by PDP). If x360ce doesn’t recognize your gamepad, it will display a red box on the tab for that controller and the controller diagram will be all grayed out:

Go to the Settings Database tab on the top row of tabs. Under Controller/Device, select the gamepad that’s having problems. Then click on the Global Settings tab to get a list of available configurations from the internet:

I have my list sorted by the Users column. I think that, by default, x360ce will use the highest ranked configuration for your gamepad settings. In my case, it was using the top one in the list, with 5C1EA9F1 under SID and 11 Users. To use a different configuration, double click on another entry in the list. Then click Yes to import the settings. A couple of seconds after that, if you picked the right one, the red box on the controller tab should change to a green box:

At this point, you should be able to push the buttons on your controller and see the corresponding buttons light up in the diagram on the controller tab. This will tell you for sure if your gamepad settings are working. Do the same for the joysticks to make sure those are working too.

If everything checks out, then you can resume from step 5 above.

A cat using a Linux notebook

I put way too much work into this not to share it:

An adorable cat on a great operating system.

An adorable cat on a great operating system.

This is how it started:

An adorable cat with bad taste.

An adorable cat with bad taste. (via)

After some color correction (which I am not very good at), I began to replace the Apple logo with Tux the Penguin:

Vectorized Tux.

Vectorized Tux. (via)

He doesn’t glow very well, but Inverted Tux should!

Inverted Vectorized Tux!

Inverted Vectorized Tux!

I added Inveted Tux as a layer to my cat image and placed a solid black layer below. Then I skewed the two layers together to approximate the correct perspective:

Photoshop trickery.

Photoshop trickery.

Finally, I removed the solid black layer and blurred Tux a little bit.