Monday, August 18, 2008

Power Corrupts.

So yeah, I have not updated in quite some time. But now that things are calming down I am going to try to post a little more regularly. If nothing else I have a bunch of things to ramble about.

Time ran an article today that, while not directly related to, actually applies in a rather important way to software development.

Does Power Corrupt? Absolutely Not

The basic idea goes like this. Give someone power, and they care more about their job (since they feel more in control of it), and thus they are more efficient and make fewer mistakes. Take power away from people and they start messing up.

It was a blind study. Wide group of people split into 3 groups, each encouraged to think of themselves as dominant, submissive, and neutral. What the found was that comprehension and mistakes ended up being quite different between the groups.

It pointed to the idea that if you want people to work well, give them power over their own work. It also suggested that the roles people have ended up in are a cause rather then an effect.. that it isn't 'efficient people bubble to the top, inefficient sink' but instead the role you drop someone into actually effects how they preform.

So what does this have to do with software development? In writing software, building a game, etc, reducing mistakes and increasing emotional investment are absolutely vital to a product going well. You could easily say that the difference between a success and a failure in a design is directly related to how well people preform and how much investment they have in things going well. No amount of 'process' will overcome people who just don't care.

Looking back, I think this played a bigger role in why I left Merit then I had realized. I went from having significant power (small in the big scheme of course, but still it made me feel in control of things that I was involved in) to being shoved pretty far down the chain to the point I was, well, just programming. I think it REALLY effected my work. Looking at everything I did over the last year, I can't say I'm overly proud of any of it. I lost efficiency, I checked in more and more bad code, my designs got worse, it just stopped mattering. And that effected the whole product indirectly.

Friday, July 4, 2008

Bad Design - When 'it just works' Doesn't.

Bit of a rant, bit of an examination of what I consider a bad design. The Netflix Movie Player.

Now I can't speak to it's internal architecture of course, but I can talk about how it interacts with the user and the rest of the system a bit, and that is where it kinda fails.

So let us look at what is offered and how it is supposed to work. In theory you go to the netflix site, pick a movie, install an ActiveX control, and poof, you are up and running. No hassle, you have been walked through every step, you are up and going. If you have problems there are common 'faq' that you can access.

So where does this go horribly wrong?

For starters, it depends on some pretty specific bits of software being installed, Windows Media Player 11 and Internet Explorer 7. Not uncommon bits of software I will admit but not everyone has or run them. From a design perspective though it means that Netflix has tied their stack specifically into Windows full-chain DRM system which, lets face it, does little to stop pirates but does a lot to piss off the user. So part one is tieing to high-level APIs with known issues.

So lets say you get those apps onto your system (which eats about a gig or so) then you try to install the ActiveX control. Netflix is very helpful about how to install it assuming everything goes correctly... but if anything goes wrong, well, your options are pretty limited. The software has minimal introspection so it can't tell you why it failed, the FAQ really do not cover much, and, here is the important part... no support forum or support email address. You can call someone but that is pretty much your only option. That, I feel, is a big part of the 'bad design' of the entire process, poor options for customer support.

So lets say you get it installed. I managed to have it installed for a short while before it broke so I can still talk about this part. One of the first things it does is find out if you have enough drive space. The problem? It only checks C:. Many windows users are painfully aware of how the C drive tends to fill up rather unchecked. Figuring out what is eating up space in windows can be an exercise in futility (no equivalent of 'du -s') so many users will create 'clean' partitions or even second drives intended for large downloads and media. In my case my C: is about 8 Gig (7 of which is filled with just the OS and things that can not control where they install, such as IE and WMP), but I have 8GB of D: for temp files and 200GB of F: for things I actually install.

Unfortunately, the player doesn't have an option for controlling where it downloads things. In fact, it has no options what so ever. It doesn't even seem to have registry entries to control where things go. To be fair neither does IE, but a lot of people are unhappy with IE's design for just such reasons. So this is the other big design flaw.. lack of even basic user control of options, or more specifically, the design decision that the user should not have to have any options in the first place... 'it just works'.

Annoyingly enough, one reboot later Netflix couldn't detect their own player and attempts to reinstall it keep generating a "A network error occurred while attempting to read from the file: C:\ .... NF_Movie_Player_z11.msi" error, which gets back to the lack of introspection/debugging. When it fails, there is nothing you can do. So I never actually got to the point where I could actually PLAY a movie, and thus can not speak to how well it behaves from there.

In short, I do not think I will ever be using this downloadable service.

Monday, May 19, 2008

Phun

One thing I enjoy is looking through the myriad of little flash games you can find on newgrounds/albinoblacksheep/etc. So many little ideas condensed into their simplest form to fit into the system requirements of a downloadable flash object.

Something I found today though was a slightly different beast. It was only a youtube demo of the program, but the idea it showed had some interesting game potential. It is called "Phun", from
UmeƄ University. It isn't a game exactly, more of a sandbox. A physics sandbox to be exact. It is a bit like those 'animator vs animated' shorts except interactive and real time. You draw stuff, the laws of physics apply to the objects, stuff happens. Quite sophisticated actually.. I would love to poke through and see how they made it work.

But on to the game angle. Watching the examples I couldn't help think about the game potential of such an engine. Sure there are lots of physics engines out there, many of them capable of far more complex things. But this was was geared twoards the player interacting with the engine rather then the artist+programmer. This has all sorts of potential for problem solving games.

The example that came to mind was the simple artillery game (a favorite of mine). But in this case not only would you have to aim and such, but actually build the mechanism from primitives. Or a racing game where you have to design the car. Lots of potential there ^_^

Friday, April 25, 2008

Meta-thinking and Emergent Behavior

Ok, taking a shot at writing something themed for Blogs of the Round Table.

A short while ago I decided to grab an xbox360 finally. Of course I went with one of the 'hot' games, Halo3. I've been wanting a FPS again for a while and I've been through Pandemic's Mercenaries way, way too many times lately. So I started Halo3 and couldn't help looking at it in terms of the games I usually play and wondering what did, and didn't work for me.

First I have to say, I am enjoying the game. It is visually stunning, the AI is actually quite good, and it is mindless fun that I can relax too. Having said that, I also found it a very disappointing game in it's simplicity and linearity. For any given situation is was always fairly clear what the 'solution' was. If the situation was unusual then the needed weapon would happen to be nearby. Often there was only one way to do something,.. each area had one entrance and one exit, and clues were everywhere regarding which one you should be moving towards. There was little to no state-fulness between areas (weapons and vehicles reset back to designer intention), etc etc.

Compare this to a military sandbox like Mercenaries.. no real entrance/exits, multiple solutions to given problems, flexibility for un-anticipated solutions, state-fullness between missions so that you can prepare and keep things that are useful, etc etc. This usually works pretty well for me.

Yet, when I think about it, I can't stand 'puzzle games'. When I say puzzle game I am not necessary meaning mini-games where you have to solve some explicit puzzle. I mean any game where the designer integrates a problem to be solved... which actually brings me to my main point. Meta-thinking.

When one designs a game, there is always some meta-thinking involved. The designer HAS to think about how the player will interact with the world. For instance the designer probably wants to think about what they player would expect the left arrow to do when moving and thus move accordingly. This is just part of good interface design.

Beyond that though, designers often try to design 'puzzles' that involve the designer trying to guess how the player will see the puzzle, and more importantly the player trying to guess what the designer was thinking the player would think. Essentially from the player's perspective you have to figure out what the designer was thinking.

Now, in the real world when you are presented with a problem it usually has not been specifically 'designed', thus trying to solve it involves a good model of the real world and such. In a virtual (highly simplified and artificial) world this doesn't work. Which gets me to part (2) of my topic, emergent behavior.

Within this context, emergent behavior is what you get when you set up the virtual world well enough that the player can apply general-purpose problem solving to a situation rather then guessing about the designer's pre-conceived solution. This is where the games that tend to work well for me diverge from the ones that don't. Rather then having one or two solutions baked in, these games provide a sandbox in which the designer can challenge the player but does not have much control over how the problem is solved and thus it starts feeling more 'real world' to me.

It is never perfect of course. Even the most flexible games still represent a subset of the real world thus one still has to think about what the designer decided to include, how they implemented it, and how it is balanced.

Now I admit part of this is humans are pretty difficult for me to understand, thus attempting to meta-think someone who's background and assumptions I don't know is generally an exercise in frustration rather then enjoyment.

Monday, April 21, 2008

Nothing Ventured

A few weeks ago I had decided to take the plunge and apply at Three Rings since they were opening up a location in Philly. I didn't consider my chances all that good but went for it anyway. They presented a fascinating opportunity if things panned out so it would have been silly of me to not at least try for it.

Today I received the official 'we are going to pass' email. Not surprising but a bit disappointing.

I decided to actually bluntly ask Three Rings where I had gone wrong. Probably a faux pas I know but I never get any feedback on 'why' from various companies and these peeps seem informal enough to maybe actually be willing to say something. That and it would be nice to keep the dialogue open in case something else came up in the future.

Still, even without getting the job the experience it'self was probably worth it. I got to play in their development environment, learned a new language, and worked with a network programming paradigm that was new to me. It was interesting to see how in some ways their network API was way ahead of what we use, and in other ways so far behind. So I learned stuff.

Saturday, April 19, 2008

Duke Nuk'em. Horrible for interesting reasons

Last night I got a craving for mindless FPS. Not a type of game I have many of I'm afraid. I usually just play Mercenaries when I want thing to go 'splode but I had just finished running through it twice the other day, so that wasn't going to cut it.

So I poke through my collection of games and find 'Duke Nukem, Time to Kill', a PS1 game from years back. I had forgotten just how horrible it was. But horrible for what I think are interesting reasons.

Time to Kill was made in the shadow of Doom. Doom was a fairly revolutionary (in the iterative sense) game,.. it had a highly efficient engine, lots of variety, a good pseudo-3d environment, good controls with lots of capabilities without overwhelming the person, and smooth movement.

Time to Kill seemed to try to take this formula expand upon it and bring in things that, I am guessing at the time, conventional wisdom felt would be 'better'. So it added an inventory (which was clunky access and use), step based movement instead of phantom-slidy (which result in coarse grained control that made maneuvering difficult), the ability to put away your gun and do other things like climb (which was more realistic perhaps but added unnecessary and confusing state-fulness), and a more 3D engine that followed Doom's pseudo 'everything on one plane' 3D but added multiple slices (or something) so you could climb around. It felt like a bad comprise.

The end result? An utterly unplayable game that felt like it was designed by a few modders who looked at doom and asked 'wouldn't it be cool if?' but failed to integrate everything into a balanced game.

At least that is my take ^_^

Ultimate solution? I finally bought an xbox360 and a copy of Halo3,.. which I have a different set of complaints about having come from Mercenaries ^_^ but that is a different rant.

Friday, April 18, 2008

Moving windows, forks, shares, and ARG!

I just spent the last 3 days working on a problem that SHOULD have been incredibly simple. Take a few windows, slide them to their new positions. The devil was, however, in the details.

Each of these windows is owned by a loadable module. Each module has a binding that translates requests form the loader into commands that the API used by the binding can use. This allows multiple graphics engines to run side by side and opens up all sorts of cross platform capabilities in the future.

Now, each module is loaded by the, well, loader, then forked off with a block of anonymous shared memory between them for message passing. This means that the loader has no way to execute commands directly in the process space of the module. Now comes the tricky part.

Moving a window around. xlib has a simple call for this, move window. The bindings do not expose the Window reference directly though, instead they take a 'move' signal. Each module is runing in it's own space and is thus subject to the scheduling whims of the kernel. So if you do something like:

for(modules module)
module->move(x,y);

you will get a whole mess of modules all moving themselves in the order and timing of the kernel's liking. Unfortunately these are low level graphics modules, which means they do not get the nice automatic refresh that you would get on a desktop. End result? Artifacts as they slide over eachother.

Now, a way to deal with this would be to have each one call the other modules and say 'hey, I drew over you, refresh yourslf' with the problem that they are all running at different speeds and thus no messages can get across quickly enough. The loader can in theory coordinate them but at best it can only suggest when to draw, it can't control the execution dirrectly.

So what I ended up trying to do was using a set of mutexes to let the loader control when each one drew. Essentially:

for(modules module)
module->lock();

for(frames)
{
for(modules module)
module->unlock()
sched_yield()
module->lock()

for(modules module)
module->unlock()
sched_yeild()
module->lock()
}
for(modules module)
module->unlock()

And on the module side:

while(!done)
Lock()
Move(one_frame_x,one_frame_y)
Unlock()
sched_yeild()
Lock()
Redraw()
Unlock()


So each module has it's mutex released in turn, gets to move it'self, then each module in turn gets to draw it'self.

Oh, that should have worked, but didn't. It turns out (and this took forever to track down) under the 2.4 kernel semaphores can't be shared between processes (threads are ok, but forked processes fail) and mutexs just quietly don't work.

Well, you learn something new every day.
Ugh. The things that should be simple.

Monday, April 14, 2008

delete(this)

For any given language there are always language features that are considered so 'wrong' that no programmer 'should' use them ever. I've always found this a rather interesting bit of behavior and group think among programmers and it is actually a topic I've used as an interview question in the past.

You can guage someone's perspective on what they think about the 'unholy' language features. If one claims that a methos is always the right solution, or that a feature is always the wrong solution, that tells me something not so great about how flex able in understanding problems someone is... i.e. when presented with a screw do they still try to use a hammer?

Goto is the classic example,.. a dangerous command that comletely breaks OOP if OOP is your hammer. But that isn't the one I wanted to babble about.

Today I realized I was using "delete(this)". It isn't even the first time I've used it in this project. Deleting 'this' is considered one of those no-nos that many say 'well, it just means you structured your program wrong!'... unfortunately people tend to say this without actually knowing the structure, they can simply 'tell' because you came up with the 'wrong ' solution.

In this case, yes, I used it with one particular class. The case? Threaded classes that want to be able to terminate themselves. Nothing else 'owns' the object. Adding a manager (the 'correct' solution) is significant extra complexity, indirection, a bottleneck, and breaks from an event-driven design. The thread class ends up needing to know about the manager, the manager needs to know about the threaded class, you have statefullness to keep in sync, a deeper stack to do anything, and have the potential to introduce all sorts of race conditions. On top of that in order to do it right you need a whole mess of mutexs to make sure that different threaded classes don't screw with the manager's data.

All that to get around 'oh no! delete this is bad!'. And of course, the real problem is going to be the code review...

This also highlights the problem (and advantage) of multi-paradigm languages like c++. You can use any paradigm you like but start mixing them and you run into arguments. On top of that, in order to support so many ways of programming, it implements each of them poorly.

For instance, the delete(this) problem is handled elegantly in ObjC via Retain/Release. I would be surprised if Java didn't have a solution to the situations too. C++? You have to do something 'evil'. Oh well, evil needs luffs too.

Saturday, April 12, 2008

Wumpus

So, I am writing a demo game as part of a challenge.

1 Week, in an API I am not familiar with in a language I don't know. Interesting I admit but stressful too.

Anyway, I have finished up the tutorial so I think I have an idea of how the system works. A nice block diagram or UML would have been good, but I think I am getting it. Very 'automagic' oriented,.. a bit like gendef + netsprites from our system but with more crack. But anyway.....

So now I am at the stage where I have to make an actual minigame.
I had several ideas for what to do. I tend to have that problem, there are so many games I would love to have the time (and art skills) to write. Unfortunately many of them get pretty complicated pretty quick and are not all that easy to simplify into a 'you have a couple days to learn and code' type project.

I thought of various smaller ones... a turn based artillery game came to mind (since that is a simplified case of one of the other games) but even that felt like a bit much. While it would be fun to throw together a quick physics engine that would be one more thing to worry about.

So what about Wumpus world? Ok, it's been done to death, there is no real originality or creativity. But it is a well understood problem (thus I can focus on the things I don't understand like the API). I also have a bit of a soft spot for the game given all that time spent solving it in college ^_^.

And thus my evil plan.

Friday, April 11, 2008

First Post

FOOM!

So, here I am starting a industry like blog?

Well, the idea came from an IGDA meeting I attended on teusday. Two speakers, Jason Della Rocca and Corvus Elrod. Corvus had an interesting suggestion for how to connect with the community,.. and let's face it, community is NOT my strong point ^_^

Anyway, he suggested blogging, and that is what I'm gonna do.

So, why Ethics of Madness? I originally thought some combination of cats, and games, and things like that.. but it is overdone. Next I thought 'For love of Evil', because Evil needs luffs. But madness. I'll spend an afternoon trying to figure out how vfork works when a shell script would take 5 minutes because it's interesting.

Granted it's interesting in the same way that 'hmmm, what can I learn from driving this corkscrew into my leg!' which is really a whole different blog. So that is the madness part. The ethics? Ahm... I'll figure that part out later.