New Year’s Resolution

I don’t really like New Year’s Resolutions, but I think in this case, I’ll make an exception. I want to make an in-depth post about every game that I finish/play over the course of the year. I’ve been wanting to do it for a while, so hopefully this will give me the impetus to do so.

Games of 2013

I beat 19 games this year, which is more than any other year since I started keeping track in 2006. What’s most interesting to me is that there’s only one that I wouldn’t consider indie (The Legend of Zelda: A Link Between Worlds). I’m really close to beating Dishonored, but I didn’t get around to finishing it before the year ended. I think it’s mostly because I don’t actually spend a tremendous amount of time gaming these days, so I really like shorter games that I can finish in a couple of play sessions rather than giant RPGs or something similar. I also tend to like new games (not sequels) because I value unique gameplay over almost everything else. I love seeing new game ideas done well or a tweak on something old to make it feel fresh. Sequels rarely deliver that, so I tend not to play them as much.

Now for the awards!

Worst Game of the Year: Starseed Pilgrim

I picked up this game because Jonathan Blow said it was one of the best he’d played in a while, and I generally value his gameplay opinions. Starseed Pilgrim is one of those “I can’t tell you anything about the game because it’ll ruin it” type games. It’s also an exploration game. Unfortunately, it’s incredibly painful to play, and not in a Dark Souls type of way. It’s just more frustrating than enjoyable, and even though I found myself getting decently far, I wasn’t really having fun. I was incredibly disappointed with this game, especially because of it’s high praise from Blow.

Most Enjoyable Game That Made Me Work: Papers, Please

Remember when I said I enjoyed new gameplay ideas done well? This is the shining example of that. I had fun doing work, and it was all because of the environment that existed in the game. Am I going to be arrested for letting someone through a checkpoint when I shouldn’t? Who is the quirky guy that keeps giving me obviously fraudulent passports? What is the “right” thing to do? I know a bunch of people didn’t like this game because it felt like work, but I think that was an absolutely necessary component of the game in order to get you to feel the pain of the decisions you had to make. This game is going to be one in which people will point at it many years down the line as something truly unique and charming.

Game I Love Watching More Than Playing: DOTA 2

I really only played maybe 10 matches of DOTA 2 last year, but the number of hours in which I watched people play it has to be over 1000. I love incredibly complex games that also require teamwork and a ton of skills, so DOTA fits the bill. What I don’t like is how my behavior changes when I play those styles of games. I get angry at people and frustrated to the point where it ruins my day. Watching people play, however, rarely does that. Putting The International‘s finals on my big screen TV and watching them was one of the highlights of my year. That was such an amazing tournament to watch. Competitive gaming has come a long way. The game itself is a testament to how Valve can still put out quality games. Everything about it is top notch from how well it’s balanced to how it looks and how well supported the community is. Having played DOTA for over 8 years now, I have to say I’m still not tired of it. Such good stuff.

Best Throwback Game: The Legend of Zelda: A Link Between Worlds

My favorite game of all time is A Link To The Past, so I pretty much had to pick up A Link Between Worlds. This is the first game I’ve played for more than five minutes on my 3DS, and while I enjoy the system, I don’t think it’s something I’d have bought for myself. The game itself is quite fun, but I was slightly annoyed that the layout of the world in ALBW is incredibly similar to ALTTP. That being said, I enjoyed myself immensely and recommend this game if you like 2D Zelda games.

Best Multiplayer Game: Towerfall

The OUYA console is a piece of shit, but my coworker picked one and brought it to work to play Towerfall. If you ignore the system it’s played on (by getting ps3/xbox controllers), this game is an amazing multiplayer game. The depth to a simple mechanic of having limited arrows, one hit kills, and powerups is quite amazing. Towerfall reminds me a bit of Super Smash Bros. in the best possible ways. I can’t count how many times we had people pick up the game for the first time and fall instantly in love. I’m excited to see that it’s coming to the PS4/PC in 2014 as more people need to experience this game.

Favorite Game of the Year: Thomas Was Alone

The premise of you being a bunch of blocks with different abilities seems weak at first, but then when you actually play the game, you realize how well executed it is. The game is gorgeous, and that’s a really strange thing to say considering it’s mostly just blocks and simple levels. The way the story is told, and the puzzle mechanics that are created from these simple blocks are really well done. In the same way that I have Bastion’s narrator’s voice forever stuck in my head, I have Thomas Was Alone’s as well. The game was a delight to play the entire way through; I wish I could do it again anew. I highly, highly recommend Thomas Was Alone.

For reference, here’s the list of games I beat this year:

Android
     Clash of the Olympians
     Ridiculous Fishing
Nintendo 3DS
     The Legend of Zelda: A Link Between Worlds
PC
     Dear Esther
     Gone Home
     Hotline Miami
     Legend of Grimrock
     Little Inferno
     Monaco: What’s Yours is Mine
     Papers, Please
     Rogue Legacy
     The Swapper
Playstation 3
     Guacamelee
XBox 360
     BattleBlock Theater
     Brothers
     Dust: An Elysian Tail
     Mark of the Ninja
     The Walking Dead: Episode 2

Here’s the other games I played but didn’t beat (or couldn’t “beat”):

Android
     Candy Crush
     Kingdom Rush
     Punch Quest
OUYA
     Towerfall
PC
     Don’t Starve
     DOTA 2
     NightSky
     Starseed Pilgrim
XBox 360
     Bioshock 2
     Runner 2

Smash Brothers Documentary

This documentary is surprisingly good to the point where I liked it better than most real documentaries I’ve seen. It’s quite long, but pretty damn good all the way through.

I can remember playing Smash Brothers Melee for hours on end during my Freshman year in college. I was never particularly good, but it was an enjoyable game (except when Ross would destroy us repeatedly). This documentary brought back all those awesome memories.

Beer and Programming: 2

Beer:

20131002_205031
20131003_205928
20131004_202003
20131005_193830

Idjit! – Dugges Ale- & Porterbryggeri AB: I generally love stouts and especially imperial stouts, but Idjit just didn’t grab me. It was incredibly thick (at points almost feeling chunky) and just had too heavy of a taste. It felt like they tried to make the imperial stouts to end imperial stouts but just went too far. Not really worth picking up.
Punkin Ale – Dogfish Head Brewery: Dogfish Head always puts out one of my favorite pumpkin beers, and this year is no exception. As far as pumpkin beers go, it’s on the lighter end with the pumpkin flavor not overwhelming you, but instead being a nice accompaniment to the brown beer. I think I still like the Elysian’s: The Great Pumpkin better, but that’s just because it matches the styles I tend to like more. Good for a pumpkin style beer.
Flipside Red IPA – Sierra Nevada Brewing Co.: Reds are my favorite beer type, so seeing a Red IPA was intriguing to me as I’d never known that was a thing. At first taste, it definitely reminds you of a solid red, but then you notice a bitterness to it from the IPA part afterward. It’s definitely a decent beer, but I think in the end I’d rather have a red or an IPA, I don’t think they need to be combined. Good for a red IPA; something to try once, but not a regular beer.
Narwhal Imperial Stout – Sierra Nevada Brewing Co.: I can’t speak highly enough of Narwhal. It’s one of my favorite Imperial Stouts, if not my absolute favorite. It’s thick, but not especially so like the Idjit. It has hints of coffee, but isn’t overpowering. And lastly, it’s fucking delicious. I love it so much, I’ve picked up two four packs to put in my beer cabinet to save for later when I can’t get it anymore. Pick up this beer if you see it, you won’t regret it.

Programming:

I haven’t done much, if any programming at home this week, so I thought I’d talk a bit about some stuff I’ve already worked on in my engine. One of the first things I worked on was a memory manager, since C++ is not terribly good at tracking memory and letting you know when you’ve leaked it. Memory management is one of the hardest things for people to learn when using C++ if they’ve come from a managed language before and for good reason; it’s not something you learn via learning the language, but instead you learn by messing it up so many damn times that you get into a rhythm when programming new things. On windows, there is a very easy way to see when you leak memory when exiting the program (and potentially during, if you want to do snapshots).

As a primer for how Windows handles memory leak detection, you can read MSDN’s page about it, which has fairly good samples. The short of it is, you can include this code, and it’ll automatically spit out stuff at the close of the program to tell you which bytes are leaking.

If you were to do an: int* int_ptr = new int;
That will spit stuff out like:

Detected memory leaks!
Dumping objects ->
{570} normal block at 0x00E26948, 4 bytes long.
Data: < > CD CD CD CD
Object dump complete.

Unfortunately, this isn’t terribly helpful! It might be if the data were a string, but when the data is an object, the output is relatively worthless. If you get lucky, the leak will occur at the same time every time, and if that is the case, you can put breakpoints on the creation of the data (the 570 in this example means it was the 570′th memory allocation).

So where do we go from here? A memory manager is the next step. We want to be able to both track our allocations better, and optimize how memory is created at run-time so we don’t have lots of little allocations slowing us down. There are two real ways to go about doing this; you can either overload the new operator or create an insertion point into which all memory is allocated and track it that way. The former is easier, but a bit messier, and the latter is something you probably want to do in the long run. I’ve done both before and in this instance I decided to go the easier route by overloading new and delete.

You can track all uses of new by doing:

You have to not just overload those functions, but all of the different types of new/delete (including the ones you created by redefining new as DBG_NEW). You can see all of them here. I’ve had some odd problems with code that overloads new, but doesn’t include the throw() part in the functions (even when I have no exceptions turned on), so it may take some fanangling before they work, but they should be good.

For the internals of the AddAllocation and RemoveAllocation functions, they’re pretty simple. They’re just a map of the pointer to the data that was allocated (size, filename, and line number).

Record all of that information and you’re good to go! The example we had above with the integer being allocated (but not deleted) now looks like this when we spit the information out on close of the application:

c:\programming\sideproject\source\main.cpp(48): Memory Leak at 0x00E26948 size: 4 bytes

This is MUCH more useful. This still doesn’t get us all the way to complete usefulness, however. What if you have a function like:

That line and file will always be the same and never return what is actually important, the original caller! So how do you find out the important information? You get the callstack and keep that around in addition to the other information. I haven’t done that yet, as it’s platform specific (and in some cases a pain in the ass), but Google is your friend. It’s next on my list if I need to make any additions to my memory manager. This will allow you to see where all allocations are created from.

So how does this break down and why did I say it was the lazy way to go? Good questions! First, it breaks down when you have things like different libraries or third party dlls that will allocate/deallocate memory. It depends on how they’re created, but generally speaking you shouldn’t expect third party code to ever allow you to track these kind of allocations. In addition to that, because you’re overriding new, that means that other people are able to override new as well (including your coworkers or friends)! This means that if you compile with code that’s not yours and it does bad things, it could completely negate what you’re trying to do. It’s the lazy way to go because it works if everything you work with uses new. As a counter example, the standard library, like std::vector, will not allocate via new, so you can never see memory stats via that method of memory allocation. C++ is really hard to track all memory allocated in a program. Be wary of static allocations as well.

In the end, this is a very easy way for C++ applications to track memory allocations, but not expend too much time to write a true memory allocator like the Bitsquid engine.

Please give me ideas and/or comments about this post as I’d like Beer and Programming to become a weekly post. It takes a lot of work for me to do, but I enjoy it so far, so I’m going to continue it until I either run out of ideas or people stop caring about my posts.

Beer and Programming: 1

Beer and Programming: 1

I’ve been lamenting the fact that I don’t regularly update this blog, and I think the best way for me to fix that is to post about the things that I’m actively doing. I love all different kinds of beer, and I learn as much as possible about programming, so why not combine the two into a weekly roundup? I can talk about the different beer that I’ve had during the week and the different programs I’ve worked on as a professional and a hobbyist.

This week, let’s start off with the beer. First off, I tried out the Epic Imperial: Red Ale.

20130929_183938_h6wjfbbzag

It was exactly what you’d expect from an Imperial Red. It was a Red, with a bit of a kick to it. I think I need to come up with some sort of rating system for beer, so I’m going to say there’s the 3 ratings of:

    * Amazing and you should pick up regardless of what else you see
    * Good for its type or good for a different type of beer
    * Not really worth picking up.

Epic Imperial Red Ale leans toward the amazing and you should pick up, but not quite getting there. It’s a solid beer that is done really well, but not exceptional.

The second beer I tried out was the Elysian: The Great Pumpkin.

20130929_200157_cgw1ph2e6m

I love pumpkin beers, and this is no exception. I’d tried their stout pumpkin and been underwhelmed, but this one was quite good. The Great Pumpkin was solid without being overwhelming. If you can pick it up, I’d say it manages to come in the bottom of “Amaazing and you should pick it up”. If you don’t like pumpkin, you should stay away, but otherwise, it’s pretty damn good.

On to programming. I’ve been trying to learn OpenGL lately and have been having a hard time finding tutorials that are focused more toward people that know how to program, but don’t know how to program graphics. It’s surprisingly hard to do so. Right now, I’m using rastertek.com‘s and arcsynthesis‘s examples. Neither of which is particularly good for how to structure a game’s graphics engine, but they each teach OpenGL in their own way that helps out a little. I wish I could find an OpenGL for game programmer’s website, but, alas, I have been unable to do so.

Work on the engine has been going well, however, as I’ve been understanding more and more as of late. I enjoy the knowledge even if I sometimes hate how hard and different it is from my everyday, normal programming. As of now, I have a triangle rendering, but soon hope to have textures or generic polygons.

Beer and Programming: 2