Categories
Game Design Game Development Geek / Technical Linux Game Development Personal Development

LD20: Prototyped Game Play

I used my trusty graph paper and my handy-dandy game design prototype toolbox to see if the game rules I came up with could be any fun.

Prototyping!

In this image, the hearts represent pedestrians walking across the plaza. They are oriented in the direction they are going, a nice characteristic of heart tokens as opposed to circles or stars.

The star represents the person you need to deliver the package to. The package is represented by the red gem, which is held by one of the three couriers represented by the Mans. The barrels represent the agents trying to stop the couriers.

Playing with the game in this way, I realized there were questions that needed answering:

  • If two pedestrians try to walk into the same empty tile, what should happen?
  • Should pedestrians always try to go to the opposite wall they start on, or should they just go forward until they are forced to turn?
  • Should shoving be a second phase after moving your couriers, or should it be a result of moving into an occupied tile?
  • Should couriers be faster than agents? Than pedestrians? Slower?
  • Would randomness involved in the creation of pedestrians (where they spawn, what type they are, etc) be enough to prevent making the game mathematically solvable and therefore boring?

And finally, what is in that package that seems to be so important to the agents in the first place? B-)

I played around with various solutions, and I was able to get a feel for what made the game more complex/confusing versus what made it simple and straightforward, especially from the player’s perspective. Part of the game is being able to quickly read the status of the board and making moves with predictable results, so complicated shoving mechanics might not serve my goals. For example, if you shove an eastbound pedestrian north into a westbound pedestrian, should the westbound pedestrian get pushed east by the eastbound pedestrian? And if the westbound pedestrian is shoved into an southbound pedestrian, and if your couriers can be shoved back, it means that the end result is the eastbound pedestrian is in the same position it started from! The chain of shoves can get windy and interesting, but maybe it would be more straightforward and intuitive to force all shoves in one direction, so a chain is really just moving all pedestrians in a line.

There is one day, 9 hours left in the compo. I don’t think I need to solve all of these problems. I can always play with them as the game is developed. I have enough to start breaking ground on the code. Let’s get to work!

Categories
Game Design Game Development Geek / Technical Linux Game Development Personal Development

LD20: Good morning! And Design Thoughts

I woke up this morning, and unfortunately my dreams didn’t help me come up with a cool game concept.

I started the day with a typical breakfast.

Start the day right.

After my shower, I put on my custom Ludum Dare t-shirt.

I'm wearing my custom LD shirt

I wore that shirt at the Ludum Dare Meetup at GDC 2011. And as I type this, it has been covered in white cat hair. Thanks, Diego. B-(

Throughout my morning, I’ve been thinking about game mechanics that wouldn’t require a full AI engine or physics or anything else complex. At first I was keen on getting rid of any entities besides the player’s avatar. After all, you’re alone, right?

But then I realized that I could make other entities follow simple rules. There doesn’t have to be decision-making or goal-driven actions or complex evaluations. Enemies or hazards can simply follow basic rules, so any decision-making is in the code when I write it.

And more and more, I’ve liked my Hot Potato idea that I mentioned last time. So here’s what I’ve come up with so far:

Your crack team of couriers have to delivery a very important package to a very important man who works for a very important organization. This man is standing in a busy plaza in the hopes of blending in with the crowd to avoid detection from secret agents who hope to intercept the package.

The plaza will be tile-based grid.
The play will be turn-based.
And hopefully the AI will be quite simple and dumb, yet effective. B-)

Some basic rules:

  • Entities can move into adjacent tiles if they are free.
  • Entities can also shove other entities into other tiles.
  • A shoved entity pushed into an occupied tile will shove the other entity in the direction he/she is facing.
  • Secret agents can’t be shoved.
  • The very important package can be passed along to a teammate directly.
  • Alternatively, if the package handler shoves a chain of people who end up shoving a teammate, the package can be passed through the chain.
  • The very important man can only receive the package from the package handler directly. No chain can be used.
  • If an agent gets the package instead, it’s game over.
  • If the agents shove the package handler, it’s game over.

I think it can be an compelling game. My intent is to design the game so that if you try to deliver the package using only one courier, the agents will easily stop you, so you must rely on passing off the package to get it past the agents. The crowd may or may not grow/shrink in size as the game progresses. I don’t know how it will turn out, but I’ll have to do some paper prototyping to see if it has a chance of succeeding. BRB.

Off to go prototype, brb

Categories
Game Design Game Development Geek / Technical Linux Game Development Personal Development

LD20: I Was Not Expecting This Theme

So the theme for Ludum Dare 20 is “It’s Dangerous To Go Alone! Take this!”

I’m not really sure about it. I was really hoping for “Traps”, but you play the hand you’re dealt.

I haven’t thought too much about the theme yet (I was busy play Jeopardy! for the Wii with friends when the compo started), but here are some first draft game concepts:

  • Your Guardian Pet: Think Ico, only you’re the helpless one, and you have to leave your protective dog sometimes to find a way to get it into areas you need to go.
  • Shove Off!: You’re among a crowd of prey (sheep?), and there are predators (wolves?) circling. You need to maneuver yourself into position to push, kick, or shove the other prey out of the crowd so the predators eat someone other than you. It’s more like “Take THIS!”
  • Hot Potato: There is a very important item, and your team needs to deliver it, but there are agents trying to stop you. If a team member gets isolated while holding the item, you lose, so try to pass off the item to someone else before the agents can corner you.

One thing I want to try to do is avoid complexity, and while I’m more familiar with artificial intelligence, I’d rather not have to code up pathfinding or goal-driven agents. I’ll try to focus more on player-controlled mechanics and system interaction than on building a living, breathing world.

For now, I’m going to sleep on the problem, and in the morning, I’ll start prototyping some ideas. Good night, Ludum Dare!

Categories
Game Design Game Development Geek / Technical Linux Game Development Personal Development

April Update. Also, Ludum Dare 20 is here! #LD48

I haven’t updated my blog in the last month. Let me explain.

First, last month I wasn’t in the country. My blog posts in March were scheduled to be published while I was traveling through Europe for 18 days.

One highlight: in a moment of certainty and confidence, I proposed to my girlfriend on the balcony of Neuschwanstein Castle in Germany.

She said yes.

So now I’m engaged, and there’s wedding planning to do, which is apparently a lot of work and full of stress.

Second, after 24 hours of flights to get back home, I spent the first week or so feeling sick. I wasn’t doing much in the way of productivity. Heck, I don’t think I felt well enough to play “Minecraft” either. It was a miserable time, but I did get to catch up on what I call “Movies No One Wants to Watch With Me.” Have you seen Arena, the 1989 sci-fi film featuring a who’s who of Star Trek and Babylon 5? It’s kind of bad and cheesy, but I enjoyed it.

Third, upon recovery, I was dealing with tax preparation. Having a CPA do the work for you and answer questions is great for peace of mind.

Fourth, I’ve been a lot more active in the Association of Software Professionals this year. As a board member, I had a lot of catching up to do when I got back from Europe, and there have been some big decisions recently. There are some exciting plans in the works, and I don’t know how much I can say publicly here. If you’re an indie game developer and are not a member of this professional trade organization, I’d urge you to join to learn how to make your games more marketable and sell more effectively by joining the ASP today.

Fifth, I’ve been hard at work on Stop That Hero!. My goal was to have a friends-and-family playable (not for public consumption) version of the game ready by the end of this month. I’ll be short of that goal before Ludum Dare starts, but I’m quite happy with the progress I have been able to make in the last two weeks. I’ll write more about it in another post next week.

Sixth, Ludum Dare 20 starts tonight! If this blog has been quiet this past month, it will be the exact opposite this weekend. As usual, I will be live-blogging my participation in the 48-hour game development competition. Consider this post a warning that you’ll see a flood of updates soon.

Ludum Dare 20 will be a nice break from working on STH!. I’m hoping that the theme “Traps” wins, but there are some other good ones in the running, too.

The keynote is already live, and I think Sos did a great job on it! It’s like a call to arms for game developers!

While I didn’t submit my own video to it (I’ve been busy, as I’ve mentioned above), let it be known that I’m in.

Are you participating in Ludum Dare 20?

Categories
Games Geek / Technical

What Is This Ninja Game?

And why does it look so fun? B-)

I saw some people playing this game earlier during GDC outside of the IGDA booth, and I wish I hadn’t pulled a back muscle recently so I could participate.

I recorded this second session, which was much bigger. I had to stop recording since the Moscone Center was closing for the day and I was not a volunteer, but I tried to capture the thrilling conclusion to this session:

I need to hang out with playful people more often! B-)

EDIT: Ah, it’s an Indiecade thing! Free Ninja

This post was scheduled to be published at a time when I will not be able to access the computer. I’ll respond to comments when I return at the end of the month.

Categories
Game Design Game Development Games Geek / Technical Marketing/Business Personal Development

The After GDC Glow

Last week I attended my first Game Developers Conference, and I guess the best way to start the recap is to say that I had a blast!

The Independent Games Summit was full of different groups of indies. Some knew each other from TIGSource. Others have been around forever. And since we’re all indies, we each had our own unique story and reason for being there. Even so, it felt as if everyone knew each other and were fairly supportive. It was like a very odd yet loving family.

I only had a Summit & Tutorials pass since it seemed to be in the sweet spot between the too-expensive All Access Pass and the “let’s hang out with people who want to find a job at the Career Pavilion” Expo pass. While I couldn’t attend a lot of the cool talks and panels in the later half of the week, I was still able to attend any of the summits.

At one point, I skipped out on the IGS summit for an AI summit talk on pathfinding. James Anhalt of Blizzard talked about the pathfinding problems of StarCraft 2, Alexander Kring of Nihilistic focused on Heroes on the Move, and Nathan Sturtevant from the University of Denver worked on Dragon’s Age: Origins. They each gave a glimpse into the tech behind the games, and the Q&A session at the end made me laugh because it was almost all complaints about StarCraft.

If I would have attended the Google Android Day tutorials, I apparently could have received a free Google device. I didn’t, but I got to see the long line for the tutorials that morning. It’s kind of the same, right?

On the other hand, I did sign up for an Intel AppUp event with Mike “PoV” Kasprzak and Phil “philhassey” Hassey and received this baby:

My New Intel-provided, Meebo-based Tablet

It’s a Meebo-based EXOPC Slate! I finally got a cool consumer electronics device!

The best part of GDC was meeting everyone I’ve only ever spoken to on IRC or on web forums. Whether I was having lunch, standing in line, or walking to a session, there was always someone’s name to call out to and say “Hey! I recognize you from your online avatar!”

I briefly met Leigh Alexander, Drew Sikora, Ian Schreiber, Noah Falstein, and Derek Yu. I met game developers I’ve talked to on the Indie Gamer forums and in the #ludumdare IRC channel. I met game developers I’ve only heard about in passing.

The IGDA booth with Corvus Elrod and company!

And I got to hug Corvus Elrod of Zakelro! Don’t forget to vote for the 2011 IGDA board!

The Ludum Dare meetup was fun and had a good turnout:

Ludum Dare meetup

Ludum Dare meetupLudum Dare meetupLudum Dare meetup

There were so many of us, we needed multiple tables!

And here’s a link to a bunch of us wearing LD48 shirts.

And one action shot of PoV eating:

PoV eats!

I was finally able to attend the Independent Games Festival and the Game Developers Choice Awards.

The IGF/GDCA at GDC

Congratulations to Mojang for winning five awards between the two events, including the Seamus McNally Grand Prize in the IGF!

At the end of the week, we had the Ludum Dare Jam at Noisebridge, a really cool hacker space.

Ludum Dare Jam at NoisebridgeLudum Dare Jam at Noisebridge

And an action video of Phil Hassey sleeping:

I had to leave the jam early and get on a plane the next morning, but I definitely want to do GDC next year! Heck, two days into it, I half wanted GDC to be over so I could get back home and make games sooner!

In the meantime, what was your favorite part of GDC?

This post was scheduled to be published at a time when I will not be able to access the computer. I’ll respond to comments when I return at the end of the month.

Categories
Game Development Games Geek / Technical Marketing/Business Personal Development

Off to My First GDC!

Wooooooooooooooooo!

WOOOOOOOOOOOOOOOOO!

After years of being one of those people who was a bit jealous of everyone who was going to the Game Developers Conference, I realized that I’m now one of those people to be jealous of. Today I will be setting foot in San Francisco, and tomorrow I will pick up my badge for the GDC!

And then I’ll be wide-eyed and star-struck and generally feel like the humble newbie I am. B-)

I’ll be attending the Indie Games Festival for the first time, meeting Ludum Dare regulars at the Ludum Dare meetup for the first time, and otherwise taking in the sights and sounds of GDC…for the first time!

I’ll be there through Saturday, so feel free to contact me through Twitter: @GBGames

WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO! GDC!

Categories
Geek / Technical

The Perils of the Sedentary Indie

A week before I fly to San Francisco for my first GDC, I visited my family back in Chicago for the weekend. My plan was to go back to Des Moines Sunday evening so I can spend the next week preparing for the conference.

It’s now Day 6 of that weekend due to a pulled back muscle, and I blame my niece.

More accurately, I blame myself for not taking care of my body better. I’ve been super focused on making progress on Stop That Hero! end game victory and defeat conditions, especially in the last few weeks. In terms of my health, though, I felt under the weather in the previous week, and sitting at my desk for many, many hours on end is punishing on your posture.

Driving for 7 hours to Chicago last Friday didn’t help.

Then I saw my niece, and while playing with her, I discovered that jumping up and down makes her giggle. If you have a niece, you know that her laugh is one of the best sounds in the world, and so you keep doing whatever it is that makes her laugh. So I kept jumping up and down for much longer than I’ve ever done in what is probably years.

And throughout the rest of that day, I went from feeling perfectly fine to feeling a light twinge in my back to being unable to move my arms, legs, and head easily.

I was in a lot of pain, and driving for another 7 hours was not going to happen until I could sit for longer than 5 minutes without feeling like I was being tortured.

The Difference Between Having a Job and Owning Your Business

Now, if I was still working at a Day Job, I’d most likely get paid time off, and here would be an excuse to actually take advantage of it! One of the benefits of a good job is that they pay you if you can’t work, bizarrely enough.

But since I’m an indie developer who isn’t finished creating his first game yet, let alone earning income from sales of said game, every day I’m unable to work equates to money lost. I’m burning through savings as it is, and the productivity hit from being sick or injured isn’t helpful.

When you’re sick, you feel miserable and unmotivated. Maybe you can do only half of a day’s work today? When you’re injured, it can either be no problem (I don’t need my ankle to type code), or it can be debilitating (if you’re in extreme pain when you lift your arm, you probably shouldn’t be mousing with it).

But either way, if you run your own business and are unable to be productive, it’s frustrating. It’s especially damaging if you don’t have an automatic selling system in place. Ideally, if I had games to sell, I could make money while I sleep, or while I’m on vacation, or even while I’m unable to work. Until then, it’s almost as if you are carrying the entire business on a tightrope, and you’re just trying to make it across to the other side before you fall. My savings are providing me with a safety net, but I’d rather the money go towards more productive uses.

While I haven’t been able to work on code this last week, I did take advantage of the downtime to catch up on an Internet business marketing audio course I’ve been meaning to finish. I brought my game development notebook with me, so I spent some time going through it and remembering how Stop That Hero! has progressed, as well as thinking about the future direction of the project.

In the end, I tried to make the most of my situation, so this last week wasn’t a total productivity loss, but it’s still frustrating that I couldn’t get back to work.

Taking Care of Your Indie Self

Days before I pulled my back muscle, I recall thinking, “Self, it’s been some time since you last did a good stretching session or even went for a walk. You should probably start getting your body moving again before you regret it.”

And I said, “Ok, Self, sure. I’ll get moving as soon as I finish working on the combat mechanics.”

There’s lots of excuses for not taking care of yourself. Gym memberships are too expensive to justify when you have no income. It’s too cold to go outside. Driving downtown to the excellent Des Moines skywalk system to walk indoors is too inconvenient. You woke up too late (again), blowing past your scheduled exercise time.

But in the end, they’re excuses, and eventually your body pays for your health debt.

If I was more strict about taking an hour every morning to do stretches and exercises, maybe my back muscles wouldn’t have been so shocked by all the sudden jumping and movement, and I wouldn’t have lost a week of productivity. Maybe if I didn’t care about feeling silly, I could have at least walked up and down the stairs within the building I live in.

And if nothing else, the mental clarity that exercise brings should be enough of an incentive if I insist on having workaholic tendencies.

Cliff Harris of Positech Games advocates archery as some fun physical exercise. David Michael, author of The Indie Game Development Survival Guide, lifts weights. A colleague of mine makes an effort to walk periodically throughout the week (and I should really take up his offer to join him once I recover).

Even with daily exercise, it might not be enough. Noel Llopis writes about his standing desk experiment and the news that sitting for prolonged periods of time can be deadly. I’ve been wanting a standing desk myself, if only for the change in posture.

How do you take care of your physical health as an indie game developer? How much of a priority do you give to exercise in your life?

Categories
Game Design Game Development Games Geek / Technical Linux Game Development

Stop That Hero! Is Apparently an RTS

At the end of the last progress update, I mentioned the realization that there could be a lot of code and logic in the player-facing parts of the game that aren’t part of the game. That is, when people talk about how complex the interface can be, they aren’t talking about particle physics, 3D culling, or fancy special effects. They’re talking about how the front end’s complexity can rival the back end’s.

And somehow I hadn’t realized it before. I knew that the interface should be separate from the game, but I didn’t know that the interface was responsible for more than merely displaying the game world and its objects. It’s a heavy-weight in its own right, handling menus, HUDs, and inputs that the simulation ultimately doesn’t even know is happening.

I used StarCraft‘s interface to illustrate the idea that the player interface is more than a mere window into the simulation. It can have complex logic that the game simulation doesn’t actually care about. As far as the simulation is concerned, it receives commands. Most of the actions you take in StarCraft do not result in commands to the simulation.

If you click on an SCV, and then click the Repair button, and then click a burning Bunker, the interface is responsible for figuring out what you’re trying to do. It isn’t until you click on that Bunker that the simulation receives a command along the lines of “SCV 1 REPAIR BUNKER 5”. Up until then, only the interface has to know you’re working with a particular SCV, what commands are available to an SCV in general, what buttons to display in the SCV menu, which SCV menu you’re looking at, etc.

Stop That Hero!’s interface

Now that I know that I can expect the interface to my game to be incredibly complex as opposed to a dumb and simple view, it actually made it much easier to realize how to proceed with my project. I don’t have to do everything within the simulation, and in fact, I can expect a huge part of the work to involve the player’s interface.

Stop That Hero!‘s interface isn’t like most games in that there is no avatar to control. You’re not directly moving an entity with the arrow keys or commanding it to jump with the spacebar. You simply create them at the appropriate towers in the world, and they’ll figure out where to go and what to do on their own.

But how do you create them at towers? The original prototype had a menu hardcoded at the top right of the screen. If you wanted to create a monster at a tower, you had to click the monster icon at the top right, then click on the tower. If you had enough resources, you summoned the monster you selected.

Stop That Hero! is finished

It was functional, but I didn’t like how it felt. Why is the selection of the monster to summon separate from the act of summoning? While it makes it easy to create a bunch of the same type of monster at once, it’s also easy to accidentally create a monster if you click on a tower without wanting to.

I wanted something more intuitive, and it turned out that pie menus are exactly what I want.

Except my GUI code is incredibly basic. I have menu screens and buttons, and everything assumes it is starting at the top left corner of the screen. In order to even simulate a pie menu, I needed a way to display menus at arbitrary locations, and it would help to be able to offset a menu from its center instead of the top left corner.

Which meant giving menus dimensions (how else can you know what the center is?) and having my IMGUI-ish system understand how to display and detect updates at arbitrary offsets.

In the end, after some research, questions, and determination, I do have this sequence working:

First, click on the tower you want to summon a monster at:
Summon Monster Menu: Step 1

The Monster Summoning Menu appears over that tower, which means it is right under your mouse cursor:
Summon Monster Menu: Step 2

Select the monster you want to summon by moving your mouse cursor to the appropriate icon. Right now, I only have a Slime, but others will be added later:
Summon Monster Menu: Step 3

Congratulations! You’ve summoned a Slime monster!
Summon Monster Menu: Step 4

Besides the infrastructure changes to support arbitrary menu placement, configuring the menu is easy, and each button fires off whatever event I want when it is clicked.

Tricky Aspects

One of the things I still need to figure out is what to do with a tower near the edges of the screen. Right now, the menu is always centered on a tower, which means clicking on a tower near the side of the map results in a menu with icons you can’t see. They’re being displayed off screen.

It’s not such a problem if I can display the menu outside of the screen the way a game like SimCity/Micropolis does, but since I’m not using Gtk to render the menus, they have to be rendered within the screen. I could add more screen real estate around the play area, but I’m trying to keep the game at a low resolution like 800×600 to accommodate players with older computers and netbooks. I could make the play area scroll, so even if you were at a corner of the map, it would be displayed in the center of the screen, but I want the players to see everything at once. I could reduce the play area so that I have a border to work with, but I’m not sure I like losing so much level data just because of the UI.

My best option if I want to keep the pie menu is to detect if the menu is being displayed offscreen and have it adjust automatically, but I’m not sure if the menu appearing away from where you expected it becomes too unintuitive, defeating the purpose. Otherwise, I might have to get rid of the pie menu altogether.

RTS development in a vacuum

In any case, I now have a player interface that I can easily change, but one thing I didn’t anticipate was how similar it is to a real-time strategy game’s interface. I didn’t really think of Stop That Hero! as an RTS, and yet I suppose Dungeon Keeper and Populous had RTS-like interfaces, too. Or, rather, the interface is composed of icons that let you influence the world.

I discovered that while FPS or platformer development articles and tips are a dime a dozen, RTS development seems to be something that everyone must reinvent themselves since there is a lack of information out there. I know of a couple of strategy game programming books that focus on DirectX, and either people found them lacking, or they focused heavily on DirectX as opposed to the game.

Even if there was a basic breakdown of every aspect of an RTS project, leaving the research of each item as an exercise for the reader, I’d find it more helpful than figuring out what those aspects might be as I stumble across them myself.

While most games probably have a hard-coded GUI baked into a game, some games are more expandable upon release. I remembered that Total Annihilation allows player-created units, and I figured that there had to be a way to provide access to the GUI so that new units can be created by the player in game. I checked out the game’s modding tools and discovered how it handled its GUI elements. I spent an entire day perusing technical references and modding tutorials, peaking at the game’s default data files, and generally immersing myself in the internals of the game. It is fascinating how GUI images are tied loosely with the name of the unit or command.

World of Warcraft isn’t an RTS, but its GUI is supposed to be highly configurable by players, and there are interesting references explaining how the XML ties in with Lua commands and functions within the game.

Looking at how other games do it with the limited access they provide is like trying to study a map by staring at the back side. It’s hard work, and I’m sometimes limited by the games I have access to for the most part, but it is sometimes the best guidance I can get when it comes to figuring out how to implement my own game.

Categories
Game Design Game Development Geek / Technical Linux Game Development

Stop That Hero!’s End of January Progress Update

Halfway through January I gave a progress update for Stop That Hero!, and in the two weeks since, I’ve accomplished a fair bit.

Recap

In the beginning of the month, I did work to create a command system, separated the game’s simulation from the rendering of it, and even added some game play related to the Hero conquering towers. There were other things accomplished, but they were slight changes compared to these major pieces.

Treasure Collection

Since then, one of the things I worked on was treasure collection. Items can be collected, which basically means running an arbitrary command. Since I don’t have much game play in, there isn’t much implemented in this regard. Right now, if the Hero comes across a treasure chest, it just disappears. Well, actually, it has its targetable component turned off so that the Hero ignores it, and it changes its renderable component so that it draws something other than the treasure chest sprite.

Why? Because I haven’t needed to delete game objects before, so there’s no way to do it. Also, I apparently never needed to hide sprites before, so there’s no way to do that, either. The “hacks” are functional for now, so I can move on to other things. I’ll come back to change these when I need to, and I may be surprised to find that I won’t need to. I already do enough unnecessary work as it is, so there is no need to add to my burden. B-)

Enemies

The next major thing I did was create a slime monster to chase after the hero. With the command system, it was as easy as creating a new command which populates the datastore with components that make up that monster. I simply took the CreateHero command, did some copy-and-paste magic, then modified its speed and the renderable component. Now I can create a slime as easily as a Hero!

Except I had no way to interact with the game yet. How did I test that the command worked? I changed the level loading code. Any treasure chests or towers defined in the level would create slimes instead. When I ran the level, the Hero had to find his way to the Castle past an entire army of slimes slowly approaching him like zombies!

Stop That Hero! - Slimes Everywhere!

Once I was satisfied that the new Slime would work within the game, I changed the level loading code back.

Front-end Architecture

The game simulation is well-defined and is easy to update. If I want to add a feature, it can be as simple as creating a new UpdateSystem, perhaps with associated components that entities can make use of.

As happy as I am with the internals of the game, I was getting frustrated with the user-facing parts. Getting from initialization to the menu to the level selection screen to the game session was poorly-defined and hard to change. I haven’t even provided a way to quit the game outside of clicking the application window’s X. When I wanted to work on providing menus for the player to click on in-game, I realized I had to do something about the front-end if I was going to make the UI work easier on me.

Here’s how my application’s architecture looked:

Old Game Architecture

As you can see, the game took up the lion’s share of the application. There was no concept of screen transitions or anything like that. You were either in a complex menu, or you were playing the game. I had no concept that a game application was anything other than a game.

I spent a few days figuring out the approach I should take. I didn’t realize that my game isn’t everything at first. It’s a tiny part of the full application. To flesh out that application, I settled on creating a state machine. I don’t know why I didn’t think to do it before. I’ve done it for Game in a Day back in 2005.

I spent a few days coding up an implementation of a state manager, and I spent a good chunk of my time at the Global Game Jam getting individual states implemented. My application is now run by a high level state machine, which looks close to what I designed on my white board.

Stop That Hero! state machine design

In fact, something like this has been scribbled down multiple times in notebooks and scrap pieces of paper every time I stopped to think about the high level, and it is only now that the state machine is actually implemented.

Also, note that there is one state I call “In-Game Session”. It’s in this state that the game runs. In terms of number of states, it only makes up about 10% of the application!

And additions and changes are easier now. If I wanted to add an Options screen, it would have been difficult to shoehorn it in my old architecture, but now I can simply create a new state. It’s kind of like programming tiny applications that work together.

Now the application’s front-end feels as good to work with as the game code, and since it makes adding and updating application states/modes so easy, I wish I had implemented the high level state machine in the first place.

User interaction

As great as all that rearchitecting is, I still didn’t have a way for the player to interact with the game simulation. Without interaction, it’s not a game.

So how do I add interaction?

Well, it’s the part that I don’t have working yet. Here’s how I approached it so far:

I have the game running as a LevelInstance, which has a collection of UpdateSystems and the database of game objects/components. I created a View that has a collection of RenderingSystems and access to the LeveInstance object.

I didn’t use Model-View-Controller because I didn’t feel it was a very good fit based on my understanding of how it would apply to a game.

If you’re familiar with MVC, the LevelInstance is the Model. So the V part of MVC is obvious, right? Not exactly.

My View is quite dumb. All it does is get information from the model and render it. The game simulation doesn’t care how it is being rendered, and in fact, I can have multiple views attached to a running game.

Ok, so far, so good. What about the Controller?

If you read about MVC, you don’t typically put business logic in the Controller. If I was making a game where you controlled an avatar with direction keys and a jump button, I think I could make things work fairly easily. The Controller would detect button presses and send commands to my game that make sense. For example, if I press the Spacebar, the Controller maps that to the Jump command, and the model knows that the player should jump, never caring that the Spacebar or another key was pressed.

But in Stop That Hero!, you’re not controlling an avatar directly. You are clicking UI elements. Here’s how I envision the player’s interface:

Stop That Hero! Pie Menu Demo

When the player clicks on a tower he/she controls, a pie menu appears around that tower. Each of the four items represent what monster can be created.

Here’s where I’ve been struggling.

If the View knows nothing but to render what’s in the model, and the Controller simply handles input and processes commands, who owns the in-game UI? Does the Model need to provide logic for the View to know what menus to display and how to display them? How does the knowledge that a mouse click (Controller) happened over a tower (View using Model data) get turned into a menu, and then who is in charge of that menu? These struggles were why I wasn’t happy with MVC as the way forward.

Until I had a discussion with Larry, that is. He is way more knowledgeable than I am when it comes to software architecture, and he pointed out that Web MVC is different from MVC.

In Web MVC, the View is simple and dumb.

In a regular MVC, however, the View might have so much logic and data that it rivals the complexity of the Model.

I’ve never thought about the View in this way before! And yet, it seems to make sense. Using StarCraft as an example, the actual game simulation is a complex RTS. Yet, there is a bunch of code to implement the interface that the simulation doesn’t ever care about.

For instance, if you’re playing as the Terran,what happens when you click on an SCV?
StarCraft SCV Unit

  • The SCV in question gets a little circle drawn around it to let you know what unit is selected.
  • The Status Display changes to reflect information about the SCV, such as health, armor strength, how many kills it has, etc.
  • The command buttons at the bottom right change to reflect actions the SCV can take.
  • The portrait changes to static before showing the face of the SCV’s driver.

StarCraft SCV

And until I had this discussion about heavy vs light Views, it never occurred to me that all of those things happen without the game simulation knowing.

If you tell the SCV to move to a specific location, the game cares. If you command the SCV to harvest minerals, the game cares. If you make an SCV repair a bunker, the game cares. Yet, all of the logic dealing with clicking on buttons and units is in the View. It’s only when the player actually does something that results in a command to a specific unit that the game model cares, and even then, it doesn’t know you clicked anything or hit a hotkey. It merely receives a command from somewhere saying “SCV 1 MOVE TO X, Y” or something like that.

Sometimes I struggle with knowing where code should live in my game’s architecture. With the restructuring of my application into a state machine and a good discussion about MVC, the way forward seems clearer. Stop That Hero!‘s player-facing code needs to be a lot more involved than I originally expected. While the game logic is where a lot of the simulation occurs, the interface has a lot of its own logic. It was logic that I knew needed to be implemented, but now I know where the code’s home is.