Building a Hierarchy
by Brian Gefrich on February 2, 2011
One of the first issues I ran into with prototyping this game concept was with building out the Controller/Pawn hierarchy. In the UDK, pawns represent the physical “characters” in the game, whether they are players, missile turrets or scampering wildebeests just added in to fill the world. The controller represents an abstract entity that does not appear in the game, but rather takes inputs and issues commands to the pawn. Think of it as the body and the mind. Except in this case, the mind can control multiple bodies – you can assign more than one pawn to a single controller. For example, say you have a game where there is a single player with a gun and a bunch of randomly placed zombies. The undead aggressors, when they can’t see the player, will occasionally turn in some direction and amble for a bit, and then go back to looking around for something to chew on. When they happen to catch sight of the player, they start moving directly towards him or her until they get killed or get a mouth full of brains.
In this scenario, the enemy actions are pretty simple and you could easily create on Controller (extending GameAIController or just AIController) that controls all of the zombie pawns. Each tick, the AI controller could iterate through the pawns and check to see if any of them can see the player or wants to move around. If any of the zombies have their bCanSeePlayer flags set, they run at the player until they are close enough to attack.
Pretty simple and in that case, each zombie has basically the same kind of simple actions and the overall command of the enemy AI can be handled by one controller.
In the case of Fleet, I decided to go a different route. In a multiplayer UT3-style shooter, each player controls his pawn directly. Your inputs get translated directly into pawn actions. With this game, I wanted the individual pawns to be able to act a little more autonomously after being issued a command, and with that in mind, I am giving each one their own controller. Once given a command from the PlayerController (or the AIController), the pawn’s controller kicks in and commands the pawn to complete the motion.
Making a new game vs. extending an existing one
by Brian Gefrich on February 1, 2011
One of the cool things about the Unreal Development Kit is that it comes packaged with basically a full game. There is a small but substantial version of Unreal Tournament 3 included in the UnrealScript code provided when you download the kit. While the team at Epic has taken strides to refactor as much of the core elements out the UT game into a separate part called UDKGame, the UTGame code is there available to learn from, or if you are so inclined, to extend off of.
If you are working on a first person shooter or want similar functionality to a game like UT3, it might be beneficial to have your game type and other objects extend the UTGame classes. In that specific circumstance, it can definitely save you a lot of work re-inventing the wheel – and provides a deep set of features to build off of.
However, if you are making any other sort of game, or (like me) want the experience of starting fresh and learning as you go, then extending from the base UDKGame may prove better in the long run. Of course, you could take it a step farther and start from the classes that UDKGame extend from (living in the GameFramework folders or even the Engine folder) and build up from there, but UDKGame has a nice portfolio of features that make it worthwhile.
So, to get started, I created a folder in my Development/Src directory with the name ‘Fleet’ (the code name for the project). Like with all UnrealScript folders, you then put a ‘Classes’ directory in there. When this gets added to your config files, it takes all of the files inside and builds a package named after the folder the code is in. Inside that folder, I create a new UnrealScript class to hold my new game type. In the interest of organization, I’m prefacing my class names with ‘FLT’, so this would be FLTGame. It looks a bit like this:
class FLTGame extends UDKGame;
static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
return class'FLTGame';
}
function PostBeginPlay()
{
Super.PostBeginPlay();
}
DefaultProperties
{
}The important part is in the class declaration at the top, where I indicate that FLTGame is extending UDKGame. The ‘SetGameType’ function is just another way (in addition to config files) to make sure that when you run the game, it sticks with FLTGame and doesn’t try to load another game based on map prefix or anything. Although, if you wanted to, you could have multiple game types extending your game type and switch them based on a parameter or the map that is loaded.
Anyways, that’s just a framework. I’m using a plugin on wordpress to do syntax highlighting, but it doesn’t specifically work for UnrealScript, so we’ll have to make due with C#. We’ll see how it goes.
Once you get your game type going (there’s plenty of good references on setting up the config files and all that), you’ll want to work on your Pawn and Controller classes. That was the next step for me. I’m a bit ahead of myself when it comes to development over blogging, so I have some catching up to do. Until then, here’s a recent progress update video to show where I’m at with moving a pawn around.
My UDK Development Environment
by Brian Gefrich on January 22, 2011
The first step to any project like this is organization. There’s just too many moving parts in a video game, especially one based on a system like the Unreal Engine. You’ve got code and maps and materials and flash files and 3D models. It’s a lot to keep track of. So I’m going to go over how I organize everything.
1. UDK
The first step is actually getting the Unreal Development Kit. It’s pretty simple – you go to http://www.udk.com/download and download the big-ass exe (1.2GB, thanks to all the new demo content and iOS stuff). The UDK is updated almost monthly, however you don’t have to update every month. In fact, it may make more sense not to upgrade often unless a needed feature or something is added or you need a performance boost that a new build might provide. Otherwise, you will find yourself running into errors where your old code doesn’t work with the new framework, and you may end up spending a lot of time making sure that it does.
For me, I am working with the Dec 2010 build, and it’s working fine for me. Any code samples I put up here will be based on that build until I say otherwise.
Once you get it downloaded, install it somewhere. The folder you choose is going to hold all of your assets, so I would suggest not hiding it away too far. I have a second hard drive for storage, so I created a folder off the root for my development projects and stuck the install in there. You can leave the default name (which is based on the build date), but I usually name the directory after whatever I’m working on. You’ll end up with five directories in the folder you point it at: Binaries, Development, Engine, MobileGame and UDKGame. Binaries holds, as you would expect, all the .exes and .dlls for the engine and toolsets. Development has all of your UnrealScript code and some ScaleForm flash stuff. This is where most of the work for me happens. Engine has a bunch of stuff I don’t touch. MobileGame you can leave alone unless you are developing for the iPhone or iPad and UDKGame is where all of your content and config files for the game goes.
A note about multiple UDK installs – each time you install a new build of the UDK, it adds a new Start Menu entry and a new set of shortcuts. Make sure if you have more than one version installed that you are opening the right tools.
2. Source Control
Let me tell you a story: A long time ago, I was stupid and just stored a single copy of my source files. I would go in and make a bunch of changes and break stuff and then couldn’t go back and sometimes wasn’t even sure about everything I had changed. Then my friend Joel introduced me to Perforce and I am no longer stupid.
Actually, while I had used source control for work before, I never really applied it to any personal projects, and paid the price. So now I use Perforce which is free (for two users) and pretty easy to use. My Perforce workspace starts from the root directory of the UDK install, but I don’t include anything outside of the UDKGame and Development/Src folders, as that’s what I’ll be changing.
I am probably not the best person to give advice on setting up Perforce though, I always just muddle through it and get it to work. It’s not difficult, I’m just not an expert and there’s plenty of those out there.
3. Visual Studio
Without any bickering and arguing about what is the best IDE for any given situation – I use Visual Studio 2010. I’m lucky enough to have a MSDN subscription so I make use of it. It works fine with the right tools installed for UDK development.
The right tool in this case is nFringe – a plugin for Visual Studio that provides all sorts of support for Unreal Engine development. It not only gives you proper syntax highlighting and Intellisense, but there’s also a solution file you can download that is almost completely set up for coding and debugging. It works pretty well, and you can set the map you want to load up and some other options.
It’s free for non-commercial projects. And if you don’t have Visual Studio, you can get the free VS Shell (integrated mode) which it also supports.
4. 3D Modeling/Image Creation/ScaleForm
I’ll cover these together, as they go into more of the asset creation side of things. I’m not terribly experienced with 3D modeling, but I’m going to give it a shot, and for that purpose, I’m using the free program Blender. I’ll get to the pipeline for importing that stuff into the UDK when I actually reach that point, but I’m sure it will be an adventure fraught with me screwing things up.
For 2D work and Flash, I’m lucky enough to be married to a woman who just finished college courses in graphic design, so Photoshop and Flash from the Creative Suite are the order of the day, via student pricing. There are plenty of alternatives, Gimp being the front runner in free graphics programs and this post on the UDK forums outlining a few additional choices for SWF and ActionScript editing (although Flash has a 30-day trial and is pretty cheap with a student discount).
That’s pretty much it for my setup. Now you can know what to expect when I start detailing my workflow. In the next post, I’ll go over digging into the code for the first time.
If you wish to make an apple pie from scratch…
by Brian Gefrich on January 21, 2011
You must first invent the universe.
I have been playing around with the Unreal Development Kit from Epic Games since it was released more than a year ago, but never in a very serious context.
This changed recently as I took on what I think will be a fun project. Although I’m not really going to go into the specifics of the game (it’s a surprise!), I thought it would be helpful for me as a developer and maybe for some people trying to get started with the UDK if I captured my experience with the toolset on this blog.
Hey, at least it will get me updating.
Some of the features of the game that I’ll be implementing and covering:
- Third person (free) camera that rotates around an origin point
- Getting started with the ScaleForm UI system
- Freeing the mouse input from the camera and creating a mouse cursor
- Selecting objects in space with the mouse
- ScaleForm UI elements and using the mouse to select them
- Multiple pawns for one PlayerController
- Moving pawns to waypoints
That’s probably enough to start with. First I will go over my dev environment and source control.
There’s a long road ahead, but it should be fun and hopefully informative.
Welcome Twitter, don’t give me a virus
by Brian Gefrich on September 22, 2010
I’ve updated and finally fixed the Twitter Tools plugin on here, so hopefully it will update my feed when I actually write something here, driving tens of thousands of followers here and making me rich off of the views of my non-existent ads.
So, yeah, this is a bit of a test post, sorry.
In real news, the Space Shuttle Discovery is on its way to Pad 39-A for its final flight into space, before becoming a giant water park in my backyard. What can I say, NASA was selling them cheap.
Thanks to twitter, I was treated to this wonderful image of the beautiful ship on its last rollout.
Enjoy
(Turns out I have to turn it on first, good job, dumpass)
Well, hell
by Brian Gefrich on September 22, 2010
Hello, Brian! Just stumbled upon your website from the penny-arcade forums. I read the whole article and I think you make some interesting points, agree with most of them.
Just wanted to point out that at the end of MGS4 they don’t completely remove control from the player’s hands “on the parts that matter”, you know?
Because you mentioned how bad it would be to “stop the interactivity with the player and then have the character they are portraying do something really cool” but in fact, most of the cutscenes depict nothing but dialogue.
The “game” portion ends with an epic battle between hero and villain on top of an emerged submarine (or something like that, I forget) and does so in a truly epic fashion, then rewarding the player with an hour long cutscene.
I’ts like the ending to Return of the King, you know? Action, action, action and then you ease it out, a purposefully long outro signaling the end of a series. Which brings me to the point that it’s really unfair that you picked the ending cutscene of the final game in a series of 4, man… eheh what did you expect, anything less than an hour would make the players furious.
Maybe it’s just me but when I finish a game I expect to sit back and just watch shit explode and the story unfold and Master Chief’s funeral and all that. That’s how a good series ends.
Worst blogger ever. 20 days later, I find a comment on my blog that I missed.
I haven’t played MSG4, so I can’t really objectively judge it, I am mostly going off of what I’ve read from other sources. It seemed like a good example. It may not illustrate the point at all, but I thought it served to show the proliferation of cut-scenes.
There are a few things I want to write about, so I will, and I am going to be making some changes to the format. I feel like limiting myself to writing specifically about writing for games is keeping me from actually working on updating unless I feel like I have something really important to say. And since I haven’t played many games recently, it’s become more difficult.
The Role of Narrative in Modern Games
by Brian Gefrich on April 28, 2010
I could say that I don’t think there’s anything wrong with video games these days the same way that you could posit that there’s really nothing wrong with family vehicles. They might serve some purpose and maybe they even do something really well, but at the same time, they don’t have the horsepower to really excite you the way a sports car might. Are games exciting? Sure. Video games are nested in immediacy granted to them by the very fact that they are interactive. Your input drives them in an exciting way and the big budget productions and the (often) head-to-head matchups lead to high-adrenaline moments that compare with the best roller coasters and Hollywood summer blockbusters.
So what is missing? Obviously the answer I’m reaching for here is story. There have been exhilarating moments in some of my favorite games, and some truly memorable characters. Even though my wife didn’t play a second of Mass Effect, she felt a bond to Wrex just by being around when I was playing. The action and sometimes the characters aren’t lacking, but it takes more than that to create an effective narrative. We need to see the characters being dynamic, we need insight into their complex motivations through their actions and interactions with supporting characters designed to highlight those aspects of them and most of all, we need to see the consequences of their choices. I feel it is the last part there, consequence, that separates the great narratives we’ve experienced in books and movies from the mediocre fare that has waddled out of video games.
Why is there such a discrepancy? The first and most obvious reason is because games are young. This is something I hear all the time to explain any shortcoming in the industry – video games simply haven’t been around to mature as long as our cousins on the screen or between the pages of a book. While this might excuse some level of developmental immaturity in technology or how games are made, the lack of focus on such a core element of all other forms of storytelling entertainment must come from something else.
The truth is, story just isn’t considered important. The bulk of content in games is the gameplay, not surprising at all, which is considered to be a wholly separate entity from the delivery of the plot. Games are expected to have stories and it is accepted that a mildly compelling narrative will add quite a bit to most games, but the mechanism for giving us that is mostly underwhelming and seldom provided in a way that really connects us to the actions taking place.
The question becomes, to me, how do we make the story part of the game? Not just something that happens in parallel to the gameplay, but an integral part of the experience. Is it just a question of writing better stories? I think there’s more there than that. Gaming allows us the ability to take on major roles in the worlds we play in. We can have drastic impacts and experience the full consequences of our actions in the context of the events that will play out during the course of a narrative. With the right design, the story can be made into the core gameplay experience.
The plan here is to explore this and flesh it out and experiment with it. I have plenty more in the way of thoughts, so look for that to appear, and some design tests using the Unreal Developers Kit.
Happy Storytelling,
Brian
Dates of Distinction
by Brian Gefrich on April 9, 2010
Today, I am significantly old.
Looking at what I accomplished in my 20s and what I have planned out ahead of me, I don’t think I’ve done half bad so far.
Let’s all gather back here on April 9th, 2020 and see how I feel about turning 40, and if I’ve made any progress in changing the way narratives are presented in games.
Inter-blog Choose Your Own Adventure Storytime Super Narrative
by Brian Gefrich on April 7, 2010
I thought this would be a fine way to inaugurate the new blog, however unfinished it is.
The way this works is that Barry started a Choose Your Own Adventure story on his blog. At the end of his story, he provided the reader two options, just like in the books you used to read, the ones where you’d try to jump away from the pirate only to fall in a pit and die in a fire. In this case, each option links to another blog where another writer has continued the story from that option. In the end, this story promises to snake you across the internet on a wonderful journey until you fall in a pit and die in a fire.
If you are moving along, you would have come from Valerie’s magnificent writing blog (http://candleinsunshine.com/asthemoonclimbs/challenge/choose-your-own-adventure) , having chosen option 1.
Your story continues below:
1) Go to the grocery store for supplies.
******
Loose gravel crunched under Michael’s foot and the expanse of the parking lot echoed his nervous steps. Latoya gulped next to him and her voice trembled.
“You see that too, right?” she asked.
“Uh-huh” Michael replied.
Emerging from the top of the Save-On-Food was a giant pickle. Michael blinked at it twice, hoping it would go away, but it was still there. Green tentacles slithered out from the sides of the disgusting alien gherkin, across the demolished roof of the grocery store and down to the cars parked below.
Toby scratched at his wild beard.
“Well don’t that just beat all.”
From the far end of the parking lot, hiding behind a parked car, Michael tried to imagine what the function of this horrible green monolith could be, but before he could ask, one of the tentacles feeling about on the ground wrapped around grey minivan. It lifted the vehicle straight up into the air like it was weightless and tossed it towards the giant pickle’s mouth like a piece of popcorn.
To Michael, the fact that the huge silo had a mouth was not the weirdest thing about his day.
“Is it eating…cars?” asked Latoya.
“Sure looks that way,” said Toby. “I bet that’s how it powers its mind control rays. Or its death ray.”
Michael and Latoya looked over at Toby. “They have a death ray?” Michael asked him, wide-eyed.
“I don’t know. But if they do, they’d probably power it with minivans!”
The pickle swallowed the chewed up van and started to expand, curling the roof back and sprouting more tentacles.
Latoya pointed and said “Look, it’s growing!”
Toby grunted. “I guess we won’t get any supplies after all.”
Looking around the parking lot, Michael spotted a group of Mendigans stacking groceries and cleaning supplies in a pile. More aliens came out with full shopping carts and brought them over to be added to the growing mound.
“Over there! There are the supplies we’re looking for!” Michael said.
Toby watched more microwave dinners and paper towels added to the heap. The Mendigans didn’t seem to be sorting the goods, or even worrying about damaging anything. Michael thought it was just like when he cleaned his room by pushing the mess someplace out of the way. Yes! That must be it! They are just clearing space inside for the giant pickle to grow. They probably didn’t even eat cereal, with those weird mouthslits.
Toby crawled to the edge of the car and peeked out at the aliens. “We could probably get over there and get the supplies we need from that pile.”
Latoya looked at the Mendigans and asked “How are we supposed to get past those guys?”
“We’ll have to distract them or wait until they leave,” Toby replied.
Michael was transfixed by the giant pickle monster again. “Shouldn’t we try to figure out what that is? It might be the key to the whole thing! We can sneak around the cars and get into the store that way.”
Toby grunted and considered the monster. Michael knew that they came for supplies, but this thing looked important.
“I’ll leave it up to you,” Toby finally said.
“Ok then. Let’s do this…”
1) Sneak into the store to investigate the giant tentacled pickle
or
2) Distract the Mendigans and search the pile for supplies
(Links to the next parts coming soon)






RE: “Story-Driven” Games
by Brian Gefrich on April 28, 2010
Adam writes in the comments to my last post:
I plan on looking at specific examples in future posts, and RPGs are certainly going to be covered. I was just going to reply in the comments, but it got long enough to warrant a new post.
“Story-driven” is a term used to describe games that have heavy and deep narratives, but the games themselves are hardly “driven” by the narrative portions. Compared to shooters, maybe the action is more closely bound to the story, but almost all games follow the same template, which is that a narrative portion happens, usually with minimal or no interaction from the player, and then gameplay happens for a while. Take your standard Bioware or Baldur’s Gate-style RPG. You talk to a ton of people, getting a lot of information to flesh out the setting, which is gameplay of a sort, and then you go kill monsters in a dungeon for a while. Once you finish that task, you get another narrative burst, in many cases, just more dialog.
That’s the standard. Long stretches of the core gameplay bookended by exposition. This is why the narrative is secondary to other aspects, because the meat of the play is taken up by running around shooting zombie nazis or slaying the dragon. This means that if you just want to be involved in a good story, you have to be willing to sacrifice a lot of time into doing the other portions to get to it.
When we were kids, we played make-believe all the time. Hell, I still do. I have some friends who love to dress up as their favorite characters and go to conventions and pretend to be in other worlds. One of the things I miss the most about my life in Milwaukee was the fantastic role-playing games I was involved with. The reason we love it and continue to find ways to do it is because we want to be put into a fantasy world to make our own adventures. If it’s just a little self-insertion while watching Iron Man (guilty) or pretending as a kid that the floor is made of lava. What video games give us is the opportunity to make those worlds more real. Will Wright has talked about the desire to turn the literal sandbox of our youth into a gameplay mechanic, and I think we can do the same thing with playing cops and robbers or spacemen.
When a game is “on-rails” like HL2 (by far the best example), the story is completely locked in stone. It is 100% the artist vision of the writer and in no way influenced by the decisions or desires of the player. When they insert you into a blank slate character like Freeman, all you are really giving the player is a slightly more immersive movie screen to watch cinema on. And then they break up that movie with hours of shooter gameplay. What’s really amazing is how well it works. We get to watch a fun movie and play a fun game at the same time, but this is remarkably far from the “imagineering” we did as children, or even in pen and paper RPG groups today. It’s only by the fact that both elements of HL2 were produced so well that the game succeeds as much as it did.
One way around the issue of the separation of narrative and gameplay is to reduce the story aspect to its simplest form. When Valve produced Portal, breaking the mechanics of everything down to the barest components seems to be the core of their design process. The play in Portal was complex and challenging and dynamic throughout the puzzles, but never in the way you played. The game was remarkably simple in that respect: Create an entry portal, create and exit portal, go through the portal. The depth of the game was what they were able to do with that mechanic in a very short amount of time. They follow a similar format with the story. There are deep threads throughout it, especially if you know the rest of the Half-Life story, but these are not played out directly, they exist in the details and are implied by the setting. The actual story of the game is one person’s, the player’s, interaction with a brilliant antagonist. It is the perfect one-act play to HL2′s Hollywood Blockbuster. While the story is no more affected by your actions than in Half-Life, because it is distilled to such a fine and potent aspect, it dominates the game and drives it forward. While it has become an internet meme, when has a game tortured the player and pushed them to do something they didn’t want to do as much as the Companion Cube segment of Portal? It is the most mentioned part of that game because the game is really about the psychological torture GlaDOS wants to put the protagonist through, and that is some great storytelling. When you ask someone what Portal is about, they tell you the story first, and then talk about the puzzle game that allows you to progress through the amazing character study.
On the polar opposite of that spectrum is Metal Gear Solid 4. Full Disclosure: I have never played it, I only recently got a PS3 and was never terribly interested in the game anyways. So this is coming from all the reviews and comments I’ve read online about it. This game had hours of cutscenes. In the course of making it through this series-ending (?) epic, you essentially stop playing and watch several full length movies. I’ve always wondered – do people just put their controllers down? How is it still a game at that point? Some people have told me that the story was engrossing and deep, and wrapped up many lines of narrative in very satisfactory ways. If that was the goal, couldn’t the movie have been released separately? Or at least found a better way to present the story that didn’t take the controller out of the player’s hands. The worst thing I think a game designer can do is to stop the interactivity with the player and then have the character they are portraying do something really cool. Isn’t that why we are playing the game? So that we can do those things, at least in a mildly connected way? How destructive to the immersion of a story, where you have vested yourself in being that character, when he or she (or it) performs an incredible feat that it would have done if you weren’t even watching?
Obviously, I have some strong views on the nature of the cut-scene in video games.
Also, I really dislike Michael Bay’s work. But that’s a different topic.
I hope this helps expand on some of the topics I brought up in earlier posts.
-Brian