Tuesday, January 8, 2013

The Math Behind Vision Cones in Unity 3D



Lately, I've been tinkering with with an early Unity 3D prototype of a top-down action game and I figured I should implement vision cones to add a stealth element to dealing with the enemies. My initial solution was to stick a cube collider in front of enemies to represent their vision.

Sunday, June 24, 2012

C# Delegates, Destructors, and Garbage Collection

Just this past week, I've encountered a very specific memory leak in Unity 3D that could happen just generally coding in C# as well. Basically the leak involves subscribing to a delegate in a class' Constructor and then unsubscribing to that delegate in the class's Deconstructor. Here's the gist of what I was trying to do.



I thought this class -- which did not derive from MonoBehaviour -- would act like MonoBehaviours and call its destructor when a scene was changed. That was not the case at all. When I ran the program, the SNController objects would stick around and the loggedIn and loginFailed functions would be called multiple times as I exited and entered scenes.

It turns out that -- because C# is a managed language -- destructors for objects are called when the objects are cleaned up by the Garbage Collector(GC).

So why didn't the GC destroy the SNController object? The problem was that the GC saw that this object was still subscribed to delegates from the FacebookManager class and would not destroy the object. Therefore, the Destructor would never be called, creating a Catch 22 situation.

I needed to unsubscribe from these delegates explicitly when I was done with the SNController object. To do that, I wrote a Dispose method.



Since SNController was instantiated as a member of a MonoBehaviour object, I would call SNController's Dispose method in the MonoBehaviour's OnDestroy method. This eliminated any extraneous references from the SNController object at the end of the scene and GC would destroy the object.

Sunday, January 30, 2011

Global Game Jam 2011 Post Mortem



Ah, my second Global Game Jam in a row. You can play our game Shadowless here. The theme this year was Extinction and my team decided to make a game about light struggling to fend off darkness. At the end of the day Sunday, we ended up with a half done game that only slightly resembled the original design ambitions. Global Game Jam is about experimentation, and what's experimentation without failure? Sure, half the team was also trying to run the our GGJ location while making the game, but we also made some mistakes in the game's development. Here are a few things I learned this year:

1. Design discussions should only go as far as what you can build now.

During the first night of brainstorming, we discussed too many fancy game ideas. At one point the game involved a traveling beam of light, wading its way through an ever encroaching darkness. When it came time to building these grand ideas we found ourselves empty-handed. We hadn't come up with any basic gameplay to hold any of our original ideas up. Questions like, "What is the player doing from second to second?" and "How is this light beam interacting with this light crystal?" were not answered. In the end, all that time spent talking went to waste and most of the original ideas were thrown out.

On Saturday afternoon we hastily reworked the premise into what the game is now. Inspired by endless survival games like Tilt-to-Live, our game would incorporate the core gameplay of frantically navigating through swarms of enemies while giving the player a primary goal of keeping a light crystal alive at the center of the screen.

2. Remote team members won't get the full experience.

My artist friend Mike wanted to participate in our jam remotely from California. While we were able to give him work, he missed out on all the bleary-eyed fun and final presentations. I could have streamed him in over Skype, but bandwidth was at a premium. Besides, he would've spent most of the time staring at my sleep deprived face.

3. We neglected sound.

I've done this during a smaller Game Jam before. In the thick of programming our heads off, we just couldn't be bothered to take a listen to the sound effects that were just submitted. As a result, we couldn't get revisions to the artist in time. Maybe having a dedicated project manager there to organize everything would have helped but -- in the fast paced Game Jam environment -- I imagine that person would end up sitting around bored a lot.

Saturday, July 3, 2010

Gaming is Play. Play is Learning.



At a recent game dev beer night here in Austin, a conversation I was having with my animator friend Jesse stumbled into educational games. Well, it didn't so much stumble itself as much as I steered it. We were talking about our ultimate goals in this industry and I said I wanted to have a positive effect on people beyond entertainment.

I've peeked into the world of productive gaming recently and the potential inspires me. There is movement in education toward virtual classrooms. Game development can be a "gateway-drug" for children to learn complex job skills.

Yet these examples don't involve game design for learning. In terms of games designed to educate the player, my friend countered that educational games just don't work. Exhibit #1: Our shared history in elementary school computer labs solving math problems to cartoon graphics. They didn't work.

I was then reminded of Bing Gordon's interview about founding Electronic Arts in Bill Moggridge's Designing Interactions.

"One of the first precepts of Electronic Arts, that interactive entertainment was going to be as big as traditional music and video entertainment, was driven by our belief that 'play' is a core human value; even a core mammalian value. We used this analogy that lion cubs learn to hung and fight by playing together. We asserted that interactive virtual world gaming would be a way that people could train in a bunch of different ways, socialize, and get same kind of richness that one can get in many aspects of real life, but without the risks."


When we play games, we are learning. Just look at how this concept can be applied to Microsoft Word.

I'd like to think my ultimate goal is to harness the power of interactive games to make the world a better place.

Sunday, February 28, 2010

Flixel Jam 2 Post Mortem

Photobucket

Last week's Flixel Game Jam came and went successfully. I have to admit, we didn't get as far at this Jam as we did in the last Flixel Jam. You can check out the fruits of our labor here. The idea was to create an RTS/Strategy game where the player casts miracles to convert dinosaurs to the player's faith. Along the way, the minions of L. Ron Hubbard seek to thwart you. It seemed like everyone had fun and learned something, but a few factors contributed to delays.

Monday, February 8, 2010

Transitioning to Box2D 2.1: b2Fixtures

My game development team got a bit of a shot a few weeks ago when found that our ActionScript 3.0 physics engine, Box2D had released the Alpha version for their 2.1 update called 2.1a. Strangely, the C++ version of Box2D has yet to release this update.

I actually stumbled into downloading the new version while looking for a way to create multi-shape bodies. I figured the examples that come with the Box2D source would show me how. Boy was I in for a surprise: what were all these b2Fixtures doing in the code?

Tuesday, February 2, 2010

Global Game Jam 2010: Post Mortem



I had a great time at last weekend's Global Game Jam 2010. Team Mound of Awesome managed to pump out a Flash stealth game in the 32 hours we had UT. The final build can be found here. For more games from the Austin location, check out the GGJ site.

This year's theme at our location was Deception involving a Man, a Plan, and/or a Canal.

Monday, January 25, 2010

Flixel Jam Postmortem

Photobucket

Phil's second Flixel Jam has come to a close. It was a lot of fun and I hope to see everyone again for another Jam. In the six hours, we managed to pull together a simple game about falling from the sky. Dubbed Terminal Velocity, the game is far from perfect: it's too hard and it needs about a weeks worth of polish. However, that wasn't the point. In six hours we organized a team of ten developers- many of whom had never met before- and created a proof of concept for a simple mechanic. The result of those six hours can be seen here. For those interested, here are links to our source code as well as our current build of the game.

Here are some things we've learned:

Monday, January 18, 2010

Getting started with Git Part 2: Branching and Tracking

Part 1 of Getting started with Git can be found here.

Now that we've pulled and pushed code with a remote repository it's time get more advanced. One of the more elegant features of Git or any source control is the ability to branch code and work without fear of breaking the original source. With Git's local and remote repositories, the options become even more robust.

Saturday, January 9, 2010

Getting started with Git

One of the toughest things to learn during this game project was actually our source control Git. Phil(our most experienced member) insisted we use Git because of its superiority to SVN and the like. Git allows you to create both a remote and local repository of your code. This means you can branch and merge code all you like on your local repository and only interact with the remote repository when you need to.

I've used SVN before so I didn't think much about learning Git. Ironically, after a week of trying to share code between the four programmers in our group, Phil was probably the least Git literate in our group. Git's cryptic interface can be pretty unforgiving, especially if you don't know Git's recommended workflow.

So I decided to write a guide to getting started with Git on Windows.

Monday, December 14, 2009

Listing Authors in a WordpressMU page

I'm trying to give my staff more of a presence on GamesPlusBlog. They need to feel ownership of their piece of the blog and their content within.

One way of doing this is recognizing when authors join the site. For awhile now, our About Us page only displayed the three founders of the blog - Tim, Mike, and me. Ever since we began bringing on new writers, Mike has suggested we list them on this page. Pragmatic programmer that I am, however, I didn't want to have a list to curate every time an Author joined the site.

The obvious solution is have PHP and Wordpress generate a list of blog authors and display them onto the About Us page.

Tuesday, October 27, 2009

Daily Routines blog

My sister passed me a link to The Daily Routines blog. Though it's currently stopped, it serves as a collection of interviews with professional writers about their daily routines.

It seems routine is the key to all creative endeavors. Here's what Michael Lewis has to say:

Is there any time of day you like to write?
I've always written best very early in the morning and very late at night. I write very little in the middle of the day. If I do any work in the middle of the day, it is editing what I've written that morning.

What would your ideal writing day look like?
Left to my own devices, with no family, I'd start writing at seven p.m. and stop at four a.m. That is the way I used to write. I liked to get ahead of everybody. I'd think to myself, "I'm starting tomorrow's workday, tonight!" Late nights are wonderfully tranquil. No phone calls, no interruptions. I like the feeling of knowing that nobody is trying to reach me.


See, even professionals have sloppy schedules. It's a comforting thought.

Tuesday, October 13, 2009

Motivation in the long haul

I apologize for any confusion, dear reader, that this blog's original mission statement and colorful banner may cause you. No longer is this a repository for my video game musings: those have found a new home. What's left is, well, everything else about my life.

I find myself at a crossroads of sorts. Or maybe I arrived years ago while deciding college major. I closed my eyes, pinched my nose and walked down my chosen path. Now, four years later, I open my eyes to find myself right back where I started.

In my quest to find my true path I've attempted to dedicate myself to long term projects. Yet how does one find motivation and discipline to achieve such long term goals? It's a challenge foreign to the typical day job. Where motivations come in pay checks and goals come from others.

I've noticed that independant webcomic artists are the epitome of this desire to break away from the infamous "Day Job." I stumbled upon this Webcomics.com forum thread about motivation.

Here are a few takeaways:

1) Have a goal. Maybe it's the ending to your story, or enough pages for a collected volume in time to print for the next big convention, or just the big party for yourself that you'll throw when you reach the 1-yr mark. Whatever it is, keep your eyes on the prize, man.

2) Make friends-- in real life, not just online-- with other cartoonists who are also just starting out, and keep each other motivated. Put up an ad in your local comic shop, for example. If you can't find anyone locally, then get to a convention (small ones are OK) and meet other artists there.

3) Be obsessed. Disturbing, but true. :-)


Advice applicable to any field.

Thursday, April 30, 2009

GamesPlusBlog!



If I even have any regular readers who are outside my close circle of friends, you must be wondering why I haven't been posting much lately. Well, I've been working my ass off to get a collaborative blog up called GamesPlusBlog. For now, it's just a blog with a few writers. We're still ironing out the design and functionality but hopefully, it'll grow.

My game writing will be moving to the new site. What will become of GameConn? I'm not sure. Maybe I'll make it a life blog. Ya'll wanna hear about cooking, music and programming?

Wednesday, April 15, 2009

Uuugh, BRAID.



Thinking with time is a lot harder than thinking with portals. Maybe it's difficulty isn't as elegantly balanced as Portal's but that was probably not Jonathan Blow's intention. I can't seem to take more than an hour of this game without getting a headache.

Wednesday, April 8, 2009

Fallout 3's ending



(Spoilers: This post discusses Fallout 3's missions and ending.)

Versus CluClu Land discusses the nature of our "domination" of games. Why can't I be this smart?

The articles got me thinking. Did Fallout 3's ending incite such ire because it violated the player's dominance of the game? The majority of mission outcomes are very much under the player's control.

Before reaching the end of the game, players decide the fate of Megaton, consider President Eden's ultimatum and make countless other choices. Is there any doubt players came to expect complete control over their game? But the ending effectively stripped all of that control from the player. What was a game so easily dominated and at the whim of the player suddenly and linearly forces him into death for sake of the story. What was such an ending doing in this game? The ending is so at odds with the open ended nature of the game that, even if the player possessed an unavoidable alternative to dying, the game bends over backwards to force you to die.

I can imagine meetings where developers argued about this ending. It makes sense, poetically. One could argue, perhaps pretentiously, that sacrificing the player’s character symbolizes the significance of his sacrifice and the impact of death. And the way the G.E.C.K.’s code was used managed to illicit an emotional response from me. In that way, Fallout 3’s main quest line succeeds. But we have to wonder if it was in the right game.

Wednesday, March 25, 2009

SXSW in tow, pt 3



(Pictures by Rama and Christina)

Let's talk about the image above. During last year's SXSW I overheard a friend's awe at the crowd in 6th street. I never made it there last year so I was unprepared to witness it on Saturday night. Imagine a downtown street as dense with people as a crowded bar. Imagine it being so crowded that someone decided they needed to chain their bike to the sign post above Mike's bike.

Anyway, I woke up Saturday morning tired, a bit jealous, and wondering about my criteria for good music. I was afraid I'd taken in too much. Like going for one too many helpings of mashed potatoes. Regardless, there was a lot happening today and I wasn't going to miss out. I figured following Rama downtown when he left around lunch time would make transportation easier than yesterday.

Once parked we made our way to the convention center for the guitar trade show. Afterwards, we sat in the SESAC day stage on the same floor as the trade show.

Natccu


"I am Natccu," she said before bursting into her first song. J-Pop rock with a healthy dose of gurrl. Really reminiscent of anime soundtrack music, so this one's for my anime watching friends. I was digging the show but Rama wanted to leave in the middle of it.

We made our way almost a dozen blocks toward Waterloo park. This year's Mess With Texas party was already underway.

Last year the party hosted 3 stages and introduced me to Yeasayers and Black Mountain. As dusty and crowded as the park was, a long list of prospective bands in one free venue was compelling.



I said in part 1 that you don't go to SXSW to see bands you've heard of. However in a venue this size, even shrunken down from last year, room is plentiful. Last year, Mike told me about an indie punk band called Cursive. He wanted to download them but they had removed themselves from emusic. Their song, The Recluse, found it's way into one of my Pandora stations and I dug it. I gotta say, they play The Recluse better in person than on the album. Rama wanted to leave in the middle of this performance too. I was getting tired of his watching habits.

I eventually found myself alone and watching the death metal band, Trash Talk. I actually find death metal fans more intriguing than the music itself. The mosh pits, the guys jumping at the microphone and even climbing on stage to scream lyrics with the band. There was a rather death metal looking gentleman to my right holding his dog's leash. He was bobbing his head, pumping his fist and shouting "Yeah!" on occasion. We were a few yards away from the mosh pit. "Damn dogs are the bane of my existence," he said. His dog lay on the ground, lazily sweeping sand over an electrical cord.

Thao Nguyen


I've been debating whether I should mention that she's Vietnamese here. On the one hand her name gives it away and it's kinda racist of me. On the other her deep, soulful voice was completely unexpected. It's reminds me of Cat Power or even Feist.

At this point I was simply exhausted from inadequate sleep and tons of walking. My shoes were covered in a fine layer of sand. King Khan & The Shrines, Japanater, Vivian Girls, and Thermals all probably deserving of some mention but at this point I could hardly parse the music anymore.

I needed a palate cleanser and it was 10 blocks away. Christina, Mike and Rama were in line for the movie 500 Days of Summer.



Gosh, I guess this is just how Rama rolls. That's Zooey Deschanel. The movie itself had surprisingly high production values for such a limited budget. During the post show talk the writers revealed that director Marc Webb's innovative techniques came from his music video experience.

With my pallet properly cleansed we walked down the 6th street I described in the first paragraph. Thumping base emanated form venues left and right. Bands with no gigs set up and played right on the street.

Mike looked into one window and saw interesting instruments. Christina looked in the SXSW brochure and determined Moriarty was playing. A friend's recommendation and a $5 cover was enough to convince us to go in.

Moriarty


What can I really say. They put on the best show I saw all SXSW. I guess I'm a sucker for talented folk music. But their stage presence was really the star. Clever coordination and a charming sense of humor.



You see the man in the red tie? He's preparing himself for an intense xylophone solo. During Mess with Texas Rama mused that small shows were better than big concerts. While watching Moriarty, it was hard to disagree. Intimate, live music is really the ultimate way to experience the medium. So much energy of a performance is lost when you cut out the band's presence. By the end of the set, I was sold.

SXSW in tow, pt 2



*UPDATE* The band Solid Gold now has a link.

(Photos by Christina)

Weekday day shows are probably the easiest shows to see during SXSW. Everyone's at work so there are are no lines and venues typically don't have cover at these times. That being said I only actually attended one of these shows last week. Wednesday afternoon, Mike and I were to meet Christina during her lunch hour. 6th street, the epicenter of Austin nightlife, was a sunny and blocked off corridor of music venues. Its concrete lay in wait for the ensuing crowds.

The three of us made our way to Emo's but Christina's first choice was a no show. Off to Plan B:

Here We Go Magic


Kinda psychedelic electronic elements mixed in with upbeat rock. They were interesting enough to get an emusic download from me. But now that I have the album, there's a bit too much psychedelic stuff here.

I've already written what I did that night. Thursday was busy with work. Friday was a half-hearted exercise in what not to do at SXSW:

My sister said again and again, for SXSW, you really need a bike. Imagine parking in any downtown. Now imagine parking in a downtown with thousands of people flocking to hundreds of simultaneous music performances. We began the day trying to figure out or little transportation conundrum. Mike had a bike, I didn't. We finally decided to take the bus downtown so Mike could bring his bike along.

After we met Rama at the Austin convention center for Flatstock Mike rode off to meet Christina. Rama led me the 5 blocks, he'd already walked a few times that day, towards 6th street. He complained about the further 7 blocks down 6th we'd have to walk to meet with Mike and Christina. We stopped and ate a $3 slice of pizza and a $4 bratwurst bought with money from an ATM with a $5 transfer fee. (Note to self: be more prepared next time.) He decided not to follow me the rest of the way.

After finding Mike and Christina we wandered around the "outskirts" of SXSW trying to catch some good free shows. We saw a band called Solid Gold but I haven't been able to look them up. Apparently they share a name with a psychedelic soul group. The band has since contacted me with a link to their site. More psychedelic than I remember the performance being. Sounds pretty good, though.

The people owning a house in this area had set up an art gallery in their front yard and a venue in the backyard. We were greeted with a goat. And these guys:

Flatcar Rattlers


Punk-country or something like that. Wish I knew the genre. Not really my cup of tea, though. After dinner Christina and Mike decided to call it a night. Our initial plan involved me running behind their bikes. Miraculously, an empty cab passed us as we considered this.

The next morning I awoke to hear Rama bumped into a few members of Delhi 2 Dublin and partied with them.



Bah.

Saturday would prove to be much better.

Monday, March 23, 2009

SXSW in tow, pt 1



(Photos by Rama)

Looking at the Austin Chronicle's SXSW insert, one can be easily intimidated by the music schedule. Like the classifieds of a desperate musical hell, thousands of bands in 9pt font reach at you to lift them from this dank obscurity.

I came to Austin in the hopes that some new music would find me. As I scanned the pages before me like some black and white Where's Waldo, I realized I would have to find the music myself... or at least stumble upon some. I was not disappointed.

Wednesday kicked off SXSW's 5 day musical... orgy. That night Rama and I were dropped off downtown and we made our way to a venue called Back Alley Social. Rama wanted to see Blue Scholars, a hip hop group. He'd heard of them before. In SXSW, if you don't have an expensive, all access badge, you don't come to see bands you've heard of. Any sliver of popularity will attract crowds the small bar venues are ill prepared to contain. The resulting line for 'Scholars quickly discouraged Rama. Off to Plan B.



Rama led me to a bar called Copa. The theme Wednesday was international music. Apparently he was interested in a few of the bands. Luckily for us, none with the notoriety to pack the venue. We found a seats in the venue's plentiful space and dug in for the night.

1001 Nights Orchestra
Photobucket


The band certainly lived up to the international theme. A variety of exotic instruments produced Middle Eastern and Eastern European folk music.

Ashu


Now this one's interesting. Ashu is a Bombay band named after it's creator, the guy in the middle with the red glasses. Apparently a music video is gathering them a bit of popularity in the Indian community. The venue was filling out at this point in the night. Rama glanced around the room and decried all the Indian faces, as if embarrassed to be at a family reunion.

The band itself had a surprisingly western rock feel.

Ashu ended their performance at 1am. I don't know if there's a correlation between dance music and the wee hours of the night. But when this next band's drummer incited dancing with his Indian drums during the sound check, it was obvious where this performance was going.

Delhi 2 Dublin


What do you get when you mix dance beats, a Korean sitarist in a kilt, a pink haired fiddler, a dhol drummer, and a lead singer flowing in Hindi? A damn good show, apparently. Delhi 2 Dublin brought the house down in spite of the venue's shoddy sound equipment. Energetic beats that get your head bobbing combined with folksy Celtic and Indian instruments. They were just the kind of innovative music I was hoping to find.

Tuesday, March 10, 2009

Battle Report: Losing

It's an odd feeling when you realize you're out of your league in a fighting game. Where you have no tactics or moves to save you from your opponent's torrent of moves. No branch to grasp as you fall down the side of the cliff. I wish Capcom would hurry up and implement the update that will allow us to record our matches. I'd be able to analyze what's going wrong.

My recent loses with Sakura have left me in a bewildered state. My old tactics are failing. Her moves don't seem as effective as other character's. I'm stuck in a rut. Naturally, I should pick up another character to gain a new perspective in the game. But it doesn't feel right. I love her for her personality but her moves aren't giving me the support I need. I guess we weren't all that compatible to begin with. It's not you, Sakura, it's me. All that time we spent together must feel like a waste. Hopefully we can be still be friends.



I'm trading in the spunky school girl for a Sumo wrestler. He's a charge character so he's more reactionary than Sakura's all out offensive mix-up style. Not that he has no offense. Tricking people into the Oichio throw should be fun. But picking a new character presents a new set of challenges. I have to spend time to learn Honda. Time that is such a commodity in adult life. Time that veteran Street Fighter players have already clocked. Where's the limit to my abilities in these games? How much time am I prepared to sink into this game?