Archive for September, 2007

Dynamic code loading in ActionScript3 3

In my post regarding using PHP for Code Generation, Cyrus Lum asked the following question:

I was wondering about being able to load .as3 code snippets or classes at run time - Let’s say a user can download the swf, then through sockets, I can deliver a section of the code as a bytearray that would allow the swf to function.

This is definitely doable, though I’ve not done in exactly the way requested (via ByteArray via sockets). The Flex Framework provides a Module API that does exactly this, and if you Google around a bit you’ll find the Module API’s original author’s blog where he outlines his early experiments in building the API. Basically, you compile your “plugin” object as a stand-alone ActionScript project, producing an SWF. You then load that SWF with the Loader class (which accepts a URLRequest for the SWF, or a ByteArray for the bytes you pull from a socket). Once you have the SWF, you simply cast it to some known class and begin working with it.

The Module API has a Module class as the container for your plugin. Using MXML, the user creates a class that inherits from Module. The Module API loads the SWF and casts the object to a Module (which inherits from UIComponent, which inherits from Sprite, which is what any SWF that you compile from AS3 turns into). The Module API assumes your module is a component, so it places it on the stage somewhere, but you wouldn’t have to do that (thanks to the AS3 DisplayObject API).

Mechanics, Dynamics, Aesthetics, Metrics 1

I first came across a discussion of mechanics, dynamics and aesthetics on King Lud IC. Patrick adds metrics to the equation (no pun intended). His metrics are an interesting idea, essentially measuring aspects of the dynamics then using those measurements to modify the other three systems (mechanics, dynamics and aesthetics). What he’s describing is basically a fitness criteria for the game’s DNA (mechanics, dynamics and aesthetics). I can see how this could be considered the “fourth layer” of MDA.

Patrick keeps asking how one would actually balance it. You could see it as a linear optimization problem (where you’re solving for n variables given m equations/relations). There’s a ton of mathematics research in this field (using computers to analytically solve the systems of equations). The beauty of any matrix of values is that you can run them through transformations (such as neural nets, or min/max algorithms, or even edge detection). It’s just important to remember the relationships. Take values as nodes in a graph, with edges representing relationships between the values.

I’d like to present my own definition of mechanics. I don’t think of it too differently from what Patrick presented; I see mechanics as the tangible, literal, immediate actions (or verbs) the player executes in the game. Classic examples would be run, jump, shoot, move, push, pull. Dynamics would be the effects of the mechanics on the world and the “strategies” that combine multiple mechanics. That may be exactly what Patrick and everyone else is saying, but it helps me grok it better in those terms (so maybe it’ll help someone else as well).

Of course, I may just be being pedantic about the term mechanics, but I see interactive storytelling, or drama games, as simply being more sophisticated dynamics on top of existing mechanics. I really do feel like we’ve developed a healthy enough palette of mechanics for our games; it’s the dynamics that are really too shallow and uninvolved, particularly considering that that’s where the meat is.

I’m sure this is exactly what the academics would say if I was better versed in their writings, but I see mechanics as the necessary instant gratification of interactivity, with the dynamics being the longer term satisfaction of interactivity. That’s why I thought Facade was a failure as a whole: the mechanics were not at all gratifying. How is real-time-typing-hoping-the-parser-understands-and-waiting-for-a-hit-or-miss-reaction a gratifying mechanic? It’s not. Sure, the longer term dynamics of the drama that plays out may be satisfying (when you reflect on it), or the anticipation of what may happen next (when you anticipate it) may be interesting, but the actual mechanics were piss-poor.

Of course, that short term vs. long term “satisfaction” was best summed up recently in this article on the short and long game.

Some brief thoughts on metaphors and genres… 2

Culture: Games and Metaphor is, very simply, superb. My only problem is its tired insistence that the Wiimote will magically improve things. A very odd supposition, as the author stressed metaphor, yet the Wiimote is far more literal (at least, when used intuitively) than the as-abstract-as-it-gets buttons on a gamepad. Even the example used of the Wiimote in Castlevania: what’s less metaphorical than holding a whip and swinging it at the screen? Furthermore, the more literal use of the Wiimote (argued by others to be its benefit!) almost requires a more literal player-centered perspective on the game world, i.e. FPS, the thing that the author complains about immediately proceeding the Castlevania comments.

Beyond those few errs, the article perfectly hits home the metaphor point. Particularly the discussion of Shadow of the Colossus, the most succinct explanation of that game as art.

Here’s an interesting article on genre from the Escapist that lead me to make this note in my notebook: “Genres help eliminate unnecessary exposition, they provide a known context for author and audience. Genre is economy.” And by “economy” I meant that genres are an efficient mechanism to reduce the overall information burden on the user (just like metaphors!). They help the user “chunk” across content in a given medium (and even across mediums).

Also, in regards to games being “representational,” the article points to a problem with more realistic looking games… the higher quality, “realer” representation implies to the user a higher fidelity interaction (which never scales as quickly). That’s why old school games feel “right” … their representation equals their interaction.

If a game can make us cry, then why can’t it make us kill? 1

Another suit (from Jack Thompson) against Take-Two/Rockstar regarding GTA and a murder. The standard “informed” rebuttal: games don’t make people killers… if he didn’t have access to guns… it’s the parent’s responsibility… he was a 13yrold playing a 17+ M rated game…

The problem: arguing that he’s a 13yrold playing a 17yrold’s game kinda concedes the point that the game may have caused the problem. While that may be possible, I kinda doubt it…

Another problem: arguing that playing a game can’t have a negative impact on you (can’t make you a killer) kinda goes against the assertion that games are art and can have impacts on the audience, express emotion, etc.

We can’t have our cake and eat it, too: games either have emotional/psychological impacts or they don’t. And if they do, the question is whether the game in particular has a positive or negative one (or if its even related to the case). Of course games have emotional impacts. The best ones aim for it. That does not mean they bear responsibility for its audience’s actions.

Games, like all media, broaden the consumer’s palette of experience. It’s experience-by-proxy. I wasn’t alive during WWII, but I feel as though I have some degree (incredibly slight, to be sure) of experiential understanding of it due to movies like Saving Private Ryan, Schindler’s List, or video games like Medal of Honor. We have to admit, though, that 2 hours of Saving Private Ryan delivers a far deeper emotional impact than 20 hours of Medal of Honor.

Of course, most video game players focus on the mechanics, with the thematic elements being secondary. Thematic elements become repetitive. Much like a movie may revolve around its characters and their development, a game revolves around the mechanics and their application.

Of course, someone predisposed toward violence or who is desensitized to it or amoral for whatever reason may focus on the thematic elements. In fact, they may be attracted to the game because of the thematic elements, as opposed to the mechanics. And if they play obsessively, it may be a kind of “wallowing” in the themes, as opposed to “exercising” the mechanics.

Porn is an apt comparison, a slightly more socially acceptable pursuit that most males will (hopefully) have more experience with than violence. It’s base, just like violence, and is considered a socially undesirable (if not wholly unacceptable) recourse for certain “urges”. One can probably see the distinction between viewing porn “to get your rocks off” as opposed to becoming obsessed and entrenched in it. There’s a difference between getting aroused by hearing a woman moaning as she’s brought to (a likely faked) climax and being aroused by the male-dominating, misogynistic “fake rape” that can be found in some dark corners. It may be a thin line from some perspectives, and their may be no distinction in the eyes of others, but I’d guess most guys can see the difference.

The same applies to video games… the vast majority of the consumers are relishing the mechanics primarily and the themes secondarily. It’s not the life of a real mob assassin that we’re enjoying thematically, it’s the idealized, sanitized version. And we know it’s different. Hell, a 13yrold should know its different. If he can’t make that distinction, then there’s something wrong. A parent shouldn’t be oblivious to that.

So the parents do bare some responsibility, not so much for the child’s actions, but for the contributing factors to those actions. Now, if Rockstar was advertising GTA during Saturday morning cartoons, including it in cereal boxes, and distributing demos at elementary schools, then they’d be doing something wrong (though still not *responsible* for the actions of the players). But rating a game as M, selling it for $60 for a $200 game machine puts reasonable barriers to entry up, particularly for a 13yrold.

In other words, I’ve got absolutely no problem with the existence of pornography. I would absolutely have a problem with my 13yrdold son watching pornography. But if I bought it for him, and let him watch it, could I really turn around and sue Vivid when he got a girl pregnant? Could I honestly blame the makers of the porn for that?

Please note my comparison between porn and video games: the comparison is apt because in the eyes of those defaming video games they are on equal footing, yet they would never think of suing the porn makers (or maybe they would, but no lawyer would give them the time of day ’cause they’d lose). They are not the same thing, though. Porn is like a documentary: it is real people having real sex. GTA is crudely modeled and animated, very clearly not real people doing very clearly not real things (like running from one end of a city to another, and dying, and being resurrected, and getting hit by cars and not getting hurt, etc…).

So, the next time you witness a “games don’t kill people, people kill people” kind of debate, be clear about the point you’re arguing. Don’t diminish games by arguing they don’t have the emotive substance to effect their audience. Its a double-edged sword that we must be quite careful in wielding.