Wednesday, March 22, 2006

Pragmatic Programmer Quick Reference

I stumbled on one of my favorite books in quick reference form.

I highly recommend buying the real deal. And if you like that also get this one.

Welcome to the war

Since I seem to be somehow encouraging the usage of vi at work among my peers I figure I should alert them to the holy war to end all wars that they are unknowingly (perhaps) being drafted into.

And so I present you with a vi vs. emacs link fest:

An impartial view with good factoids on both sides.
Bullet lists sucks.

An emacs guy takes some pot shots at the VI crowd.
I have to wonder though did he think before he used the subheading, "Emacs: the tool of tools"? This is typical of the war-time volley, here's a sample smithering:

"I often tell people that you only need to know one vi command: :q!. This way, if you ever accidentally start up vi, you can get right back out. You might want to follow that up with rm /bin/vi to keep it from happening again. In reality, I know just enough vi to get the system up and running and to get Emacs installed; I'll then leave vi behind and never look back."


The vi lovers guide
If the title didn't give you enough of a hint of the flavour perhaps this will:
"I use Vim because I simply don't know of a better editor, but, admittedly, I haven't seriously tried anything else."

He makes up for this with a great set of links to useful information and a concise history of vi in the beginning.

A study of novice and regular users usage of the two editors.
"There appears to be no advantage for a regular user of one editor to switch to the other."

However novices liked emacs better.


References
to actual 'scientific' research into the perfect editor.Yes there are actually people trying to have a scientific discourse about this stuff.

Tim O'Reilly uses VI.
I have to admit that although I'm not a big Tim supporter lately the fact that he uses VI almost makes up for his web/mix 2.0 conferences but his response here is high on the rubbish factor. Shenanigans!

A funny little rant.
"Emacs is for people who desperately want to get drunk, but feel guilty doing so without a reason."


A typical flame war.

Taking a poll of public published net opinion.

An emacs user admits that emacs key bindings make you retarded.

You can always bat for either side.

Conclusion:
If you're a programmer and you've never given your editor any serious thought it would benefit you to think about the tools you use to ply your craft. I don't encourage people to select one editor over another but whatever you use you should invest at least some invest some time into your tools. My preference is vi, I've used it for 10 years and it feels like a natural extension of my brain at this point. It pains me to see people programming by using the mouse to select words from an intellisense drop down menu.

Tuesday, March 21, 2006

Justin Frankel is not dead

Mass just walked in my office and noticed that I was using oldskul winamp and so we got in this interactive walk down memory lane where we were talking about Llamas and such then I happened upon this. And here I thought he was sitting around on his big fat AOL check. That couldn't be further from the truth.

MDX On the Xbox360

It's now pretty much public knowledge that the 360 will be supporting managed directx coding using a version of the .NET CLR. There's been quite a bit of talk about what this means for game development on the 360 but I think that a lot of people who are interested in casual games are pretty excited about this possibility. This was just recently announced at GDC along with a release of the mechwarrior code and asset base under the shared source lisence. I think that using MDX you can probably get some pretty great graphics up and running in short order. My feeling is that the scope of games developed on this platform will be limited mostly due to memory consuption and control.

Here's a few links to some related blogs.

Saturday, March 18, 2006

Croquet: 3d collaboration environment video

All of my dreams come true. Now I can move on to other things. Why did it take so long for me to finally hear about this. I'm truly out of the cool-loop.

Ruby Hacking Guide

dcnstrct on #ruby-lang pointed out this excellent resource. This is the kind of resource that can save you weeks of time. Reading the source is interesting but sometimes it helps to have an experienced guide.

Friday, March 17, 2006

Game development on rails

Something I've been thinking about is what kind of game would make sense as a rails web app. I have this little engine that I was working on in ruby called alchemy, it's focused on adventure and synthesis in a mutable environment (currently no plans for any kind of combat). There is a persistent world that is accessed using DRB from the client. I don't know enough about rails to know how it handles session state and what would be the best way to back-end it to a game server.

I am trying to determine what the right user interface for this game would be. Currently I'm leaning towards an abstract, hex based board that is implemented using javascript. I haven't really had much experience in client side javascript but seeing what people are doing with ajax these days makes me wonder what kind of interactive environment one could build with these technologies. First step would be to produce a proof of concept and see what kinds of ideas that sparks.

Writing this stuff in ruby is a blast.

The little game world is fun to play in so far I can do the following:
Farming: Fish, wood, metals, plants
Crafting: No recipe parsing yet just old shoes are created for any recipe
Movement: Move to any linked location
Respawn: Materials are respawned at variable rates
Skills: Object actions are tied to skills, you level the skill based on difficulty
Inventory: All items can be stored in inventory and then added to a recipe and crafted

At some point combat would probably be a requirement but I'm so bored with combat systems anyways that it's just fun to play with harvesting, crafting and exploration.

Anyways, this is all just mental gymnstics.. Here's a little sample log of fishing in the opening instance:


>> Welcome proj
>> Got 5 Potions
>> Got 2 Pickaxes
>> Got 2 Axes
>> Got 1 RabbitsFoots
>> Got 1 BasicFishingRods
/mats
>> Executing command: 'mats' nargs: 0
>> Material: Stream 2/10
>> Material: Stream 2/10
>> Material: Stream 2/10
>> Material: Lake 2/10
>> Material: Stream 2/10
/use BasicFishingRod
>> Executing command: 'use' nargs: 1
>> Use requires target, please /target 'thing-name' or 'self'
/target Lake
>> Executing command: 'target' nargs: 1
>> Targeted harvest location for material: # 2 resources left
/use BasicFishingRod
>> Executing command: 'use' nargs: 1
>> Got one RainbowTrout
/use BasicFishingRod
>> Executing command: 'use' nargs: 1
>> Got one RainbowTrout
/target Stream
>> Executing command: 'target' nargs: 1
>> Targeted harvest location for material: # 3 resources left
/use BasicFishingRod
>> Executing command: 'use' nargs: 1
>> Failed skill test for 'fishing' (level: 1) on Stream (difficulty: 15)

Thursday, March 16, 2006

I want PyChecker for Ruby

I'm so spoiled on compilers that I've gotten lazy. Much like the brain rotting effect that occurs in people who rely on IntelliSense(tm). When I was working on my latest ruby game I wasted tons of time on trivial errors in off branches of code. The common argument is that unit testing cures all ails. Which I'm not arguing against except for the fact that many times I'm either lazy, strapped for time or both and I need some handy robo-help.

http://pychecker.sourceforge.net/

I wonder what work from the ruby2c folks could be used in this endeavor.

Singletons considered harmful to your health

The phone architecture that I'm compiling TexasHoldem for is very stingy when it comes to linking. Basically any data that is in the .data or .bss segments is verboten. Symbian OS apps are compiled as shared object code and doing the copy-on-write logic for shared static data is too much work for these lowly devices. This has caused me a bit of anguish as I made lots (far too many) static code optimizations and the core game engine objects are singletons. Of course all this is just tedius to cleanup but shame on me for not researching this ahead of time.

Here's the conversions that I've made in order of difficulty:

First conversion, helping compiler remove .data segments with const:

static uint [] card_seq { ... }
Becomes:
static const uint [] card_seq { ... }

static const char * string_table {}
Becomes:
static const char * const string_table {}

Second conversion, removing uninitailized data in the .bss segment:

void single_threaded_converter(byte *buffer, uint32 size) {
static byte more_than_buf[1024]; // becomes stack variable or input variable
...
}

Third conversion, converting singletons to explicit initialization:

class MyEngine {
static MyEngine &instance();
};

Becomes:

class MyEngine {
static MyEngine *create();
static void release(MyEngine *p);
};

... There is lots of references to cleanup here since lots of stuff likes to refer to engine (yeah I know I'm lazy)

There is a single exported entry to bootstrap your application in SymbianOS. It now creates the engine. There is still the issue of getting sub-system pointers to objects that need them in a clean way. I have to visit the whole object heirachy at this point to clean this up. The funny thing is that I really don't like singletons that much anyways. This is similar to the wake up call I had when I thought it would be a good idea to use STL in a large production server.

Slow movement is better than no movement

The other night I was really, really tired and realized that I had really been driving myself a bit too hard. My hands were hurting and my eyes were blurry. It's at those moments when you really have to bring yourself back and make a real effort to just relax, get some sleep, do something different and just reflect on life. Burn out can cause undesirable side effects and is generally pretty unpredictable. I would rather get something slowly then quickly and burn out. I think in the end you get more done that way anyways.

Wednesday, March 15, 2006

The evolution of a programmer

This is funny if you've ever had to use any of these programming languages/paradigms.. I love the manager evolutions..

Tuesday, March 14, 2006

GameHack March 2006 - Gspace Postmortum

Bloggers image upload is broken. For now the the images are still hosted at flickr.

Last weekend a few friends got together for a game hack party. Nothing too formal just sitting down and working on some game ideas. The idea was to use scripting languages to build the games. I feel that the success of the projects that we undertook had a lot to do with this choice.

I've been pretty addicted to ruby since I picked it up recently and so I was pretty determined to build a game with it.

People started showing up between 2 and 3 and after eating some food and chatting it was time to get down to business. John decided that he wanted to work on the game with me so we started brainstorming. We both are interested in board games, tactical rpgs and sci-fi so it comes as no suprise that we decided to put together a little turn based space game.

John is well versed in the lingo and logistics of interstellar warfare so I let him drive a lot of game design. I focused on asking the correct questions and focusing these ideas into a working game.

Quickly I had drawn a sample game board and some units on the whiteboard.

We drew up some tables for unit strenghts, sketched out the flow of the game, round and turn transitions and talked about how combat would resolve.

At this point John had never written a lick of ruby so I worked with him directly to begin defining the game. Step one was the game model. I coded up the game base classes: Game, Player, Location, Unit, Weapon, Defense, AttackType, DefenseType. Once we got this out of the way John went off and started creating tons of different weapons, ships and defenses. I wrote a game loop driver to test the turn logic and make sure the basic objects were working together then I went off to write all the graphics for the game. It took a few hours to get this stuff pounded out. I basically just created the units out of 2d primitives. I created a selection cursor and enabled the user to select and move units using a simple arrows and spacebar as selector control scheme.

John's wife Leslie had some dinner waiting for us at their house so we went over there ate and I spent some time writing a zoomer that would interpolate scale and translate of the board to a selected unit. This was supposed to be for the unit information HUD but I ended up scrapping it. It still looked pretty cool though (you can press 'I' on a selected unit to zoom in on it). The fact that all the units are vector based and not little sprites makes this look really cool.

After this we quickly got the HUD working showing unit stats: hull strength, movement points, arament and owning player. John and I worked closely on this part of the project quickly iterating features until the game was playable.

At this point we could spawn whatever ship we wanted on our turn and use it to attack the other player. The weapons that John created were great: Tactical Nukes, Microwave Lasers and Auto Cannons.

What went right

1 Using ruby for prototyping
This was an awesome language for a project like this. We were able to use very clean object-oriented code to easily visualize the game. The keyboard handler took a hash of key ID to blocks of code which made adding new keyboard logic super simple. Since we weren't using source control it was great that ruby allows you to write new methods in a seperate file that are added to an existing class. John could iterate on his battle mechanics adding methods to the Unit class while I was cleaning up the Unit movement in game.rb. As an experienced programmer John was able to get productive in ruby under an hour.

2 My graphics extension to ruby 'RubyCube'
I had spent some time before the party closing the gap in terms of game programming for ruby by writing a very high-level graphics programming extension that hid all the low level details like movement, updating animations, render queue etc. This made it super-simple for me to write all the graphics code in a few hours in ruby.

3 Pair programming
John and I worked very closly in this and picked each others code apart. We were able to catch tons of little problems in the game logic just by sitting down for a few minutes and writing code together.

What went wrong
1. Wasted time on polish like the zoomer
I spent an hour working on this code without even ending up using it.

2. Using a non-compiled language
It was often very painful to know if some branch of your code would break because of a mis-named variable or other small error. This made testing each feature interactively and right after it was written very important. However, in a game things get complex quick and as more code started to interect we ran into more and more problems. We probably spent the majority of our time fixing little errors like this in the game logic. It would have been really nice to have a ruby lint type program to find all the little misspellings.

3. Only working on the game for 12 hours
If this was one of the 24-72 hour game competitions we could have gotten a lot more done like this. I think with more time this game could be even more fun.

Conclusion
It's a great feeling to have a finished game up and running in so short a time. Having a game prototype up and running that exercises the milestones of the game design something that I will continue to do in the future, even if the game will be re-implemented in C++. It's great to have free tools like ruby to do this. I'm looking forward to the next opportunity to do this type of rapid game programming.

You never catch up

The bad thing about losing sleep is that you never get it back. At least that's what I've heard. I've also heard that you only need 6 hours of sleep a night. Well.. I don't know about all that, all I know is that I'm super tired today! I'm nursing a huge americano, listening to pandora.com and limping through some coding.

Monday, March 13, 2006

On10 Covers KEXP

My favorite radio station get some great coverage. The feature covers a lot of cool ground including their back end technology and their global internet coverage.

Quotix Software Updated their Lua IDE

I tried this IDE at one point and thought it was pretty good. I don't know how much this would help with gamedevelopment but it's encouraging to see more tools for LUA. And free at that.

Spore demo video from 2005 GDC

Will Wright takes an audience though his new game spore during last year's GDC. This is really an amazing demo that I hadn't seen yet. There are so many interesting ideas in game design on hand here. Will talks about setting landmarks in the game design which I think is an interesting way of organizing the game design especially on a project this grand. My favorite type of game is one where you are able to play multiple mini-games within a larger game (Defender of the Crown, later versions of Final Fantasy, Sims, etc). This game expands on that idea by letting each minigame be a part of a larger game and later on allowing you to jump between any mini game that you wish. Controls and interface are also consistent across the different games. The idea of an asynchronous multiplayer game I find interesting. I think the idea is that people are able to add to your game out of band by contributing to shared online game storage.

On Large Scale I/O

High-scale server design is fun. I was pleased to come across this paper. Linked from the guy who wrote wrote lighttpd.

Something to try

1. Grab the nearest book.
2. Open the book to page 123.
3. Find the 5th sentence.
4. Post the text of the sentence in your journal...along with these instructions.
5. Don't search around for the "coolest" book you can find. Do what's actually next to you.

Neither the cashier nor the customer would be able to leave until the "trasaction" is completed.


From 'The Best Software Writing I'

Sunday, March 12, 2006

GameHack March 2006 comes to a close

Stay tuned for a postmortum. For the time being check out the flickr album. 2 games done in about 12 hours.

1 combat shmup done in LuaSDL (LuaChiea) with Xbox 360 controllers
1 turn-based tactical space game done in Ruby with custom engine bindings (RubyCube)

Not too shabby :)

Wednesday, March 08, 2006

All your innovation are belong to us

This article brings to my mind the environment in the early days of Nintendo Japan when all the game designers and programmers wore blue jump suit uniforms. There are some game developers who I think are trying to buck this trend but new types of gameplay? Still a tall order for the likes of EA.

Alternate universe: WoW as MUD

Why aren't MMRPGs exploring other forms of gameplay besides the boring old collect some stuff to advance a story line so you can collect shiny armor? This conversion should give anyone who has observed first hand or otherwise the mechanics in WoW a good chuckle.

Could it be that MMOs are designed for noobs?

FFXII Scores 40/40 in Famitsu

It hasn't dropped yet in Japan but the latest (and last?) Final Fantasy for PlayStation2 just joined the ranks of 5 other games to ever earn a perfect 40 in Famitsu. The other games in this cadre are Ocarina (N64), Soul Caliber (DC), Vagrant Story (PS1), Zelda: Windwaker (GC), Nintendogs (DS). I own all of these but Vagrant Story. I really enjoyed the demo disk of FFXII that came with DragonQuest VIII, playing it through multiple times. It reminds me of a cross between FF: XI Online and KOTOR.

Just don't forget to drink your potion.

10 Personas for Innovation

This article provides a goo d description of tools that can help promote innovation in the face of harsh criticism.

The Learning Personas
Individuals and organizations need to constantly gather new sources of information in order to expand their knowledge and grow, so the first three personas are learning roles. These personas are driven by the idea that no matter how successful a company currently is, no one can afford to be complacent. The world is changing at an accelerated pace, and today's great idea may be tomorrow's anachronism. The learning roles help keep your team from becoming too internally focused and remind the organization not to be so smug about what you know. People who adopt the learning roles are humble enough to question their own worldview, and in doing so, they remain open to new insights every day.

1. The Anthropologist brings new learning and insights into the organization by observing human behavior and developing a deep understanding of how people interact physically and emotionally with products, services, and spaces. When an Ideo human-factors person camps out in a hospital room for 48 hours with an elderly patient undergoing surgery, she is living the life of the anthropologist and helping to develop new health-care services.

2. The Experimenter prototypes new ideas continuously, learning by a process of enlightened trial and error. The Experimenter takes calculated risks to achieve success through a state of "experimentation as implementation." When BMW bypassed all its traditional advertising channels and created theater-quality short films for bmwfilms.com, no one knew whether the experiment would succeed. Its runaway success underscores the rewards that flow to Experimenters.

3. The Cross-Pollinator explores other industries and cultures, then translates those findings and revelations to fit the unique needs of your enterprise. An open-minded Japanese businesswoman was taken with the generic beer she found in a U.S. supermarket. She brought the idea home, and it eventually became the "no brand" Mujirushi Ryohin chain, a 300-store, billion-dollar retail empire. That's the leverage of a Cross-Pollinator.

The Organizing Personas

The next three personas are organizing roles, played by individuals who are savvy about the often counterintuitive process of how organizations move ideas forward. At Ideo, we used to believe that the ideas should speak for themselves. Now we understand what the Hurdler, the Collaborator, and the Director have known all along: that even the best ideas must continuously compete for time, attention, and resources. Those who adopt these organizing roles don't dismiss the process of budget and resource allocation as "politics" or "red tape." They recognize it as a complex game of chess, and they play to win.

4. The Hurdler knows that the path to innovation is strewn with obstacles and develops a knack for overcoming or outsmarting those roadblocks. When the 3M worker who invented masking tape decades ago had his idea initially rejected, he refused to give up. Staying within his $100 authorization limit, he signed a series of $99 purchase orders to pay for critical equipment needed to produce the first batch. His perseverance paid off, and 3M has reaped billions of dollars in cumulative profits because an energetic Hurdler was willing to bend the rules.

5. The Collaborator helps bring eclectic groups together, and often leads from the middle of the pack to create new combinations and multidisciplinary solutions. Not long ago, Kraft Foods and Safeway sat down to figure out how to knock down the traditional walls between supplier and retailer. One strategy--a way to streamline the transfer of goods from one to the other--didn't just save labor and carrying costs. The increased efficiency sent sales of Capri Sun juice drinks, for example, soaring by 167% during one promotion.

6. The Director not only gathers together a talented cast and crew but also helps to spark their creative talents. When a creative Mattel executive assembles an ad hoc team of designers and project leaders, sequesters them for 12 weeks, and ends up with a new $100 million girls'-toy platform in three months, she is a role model for Directors everywhere.

The Building Personas

The four remaining personas are building roles that apply insights from the learning roles and channel the empowerment from the organizing roles to make innovation happen. When people adopt the building personas, they stamp their mark on your organization. People in these roles are highly visible, so you'll often find them right at the heart of the action.

7. The Experience Architect designs compelling experiences that go beyond mere functionality to connect at a deeper level with customers' latent or expressed needs. When Cold Stone Creamery turns the preparation of a frozen dessert into a fun, dramatic performance, it is designing a successful new customer experience. The premium prices and marketing buzz that follow are rewards associated with playing the role of the Experience Architect.

8. The Set Designer creates a stage on which innovation team members can do their best work, transforming physical environments into powerful tools to influence behavior and attitude. Companies such as Pixar and Industrial Light & Magic recognize that the right office environments can help nourish and sustain a creative culture. When the Cleveland Indians discovered a renewed winning ability in a brand-new stadium, they demonstrated the value of the Set Designer. Organizations that tap into the power of the Set Designer sometimes discover remarkable performance improvements that make all the space changes worthwhile.

9. The Caregiver builds on the metaphor of a health-care professional to deliver customer care in a manner that goes beyond mere service. Good Caregivers anticipate customer needs and are ready to look after them. When you see a service that's really in demand, there's usually a Caregiver at the heart of it. Best Cellars, a retailer that takes the mystery and snobbery out of wine and makes it simple and fun, is demonstrating the Caregiver role--while earning a solid profit at the same time.

10. The Storyteller builds both internal morale and external awareness through compelling narra-tives that communicate a fundamental human value or reinforce a specific cultural trait. Companies from Dell to Starbucks have lots of corporate legends that support their brands and build camaraderie within their teams. Medtronic, celebrated for its product innovation and consistently high growth, reinforces its culture with straight-from-the-heart storytelling--patients' firsthand narratives of how the products changed or even saved their lives.

Tuesday, March 07, 2006

Does language influence thought patterns?

I have been learning a new language every year for awhile now. Even before I read the pragmatic programmer I had been doing this out of curiousity and just being a over-zealous hacker. I noticed that I would cross polinate a lot of ideas, objects in C, message systems in C++ after doing Objective-C, data driven design and the idea of ubiqitous associative arrayness from Lua. This year I have been fortunate enough to find Ruby.

Today I found this quote in a nice Ruby presentation:

Sapir-Whorf Hypothesis
The Sapir-Whorf Hypothesis theorizes that thoughts and behavior are determined (or are at least partially influenced) by language. […] To this day it has not been completely disputed or defended, but has continued to intrigue researchers around the world.


A language that doesn’t affect the way you think about programming is not worth knowing — Alan Perlis

The Takahashi Method


I first heard about the takahashi powerpoint presentation style at the last Seattle.rb meeting. I'm not much for powerpoint but this idea is entertaining to me in a deconstructionist-wordplay as art way. Takahashi Masayoshi wrote a book on this and is also involved with Ruby in Japan.

Here's some, more, info ..

I think this method works best in Japanese.. Latin characterset is just too bland.. perhaps wingdings would be more appropriate! Or perhaps the 'Lessig method'.

This method may suck for any kind of material that would be reviewed later unless accompanied by synchronous audio/video.

Interface mockup as design doc

This is an interesting idea, especially for web design specification. I think it's a nice feature, if you're designing a interface prototyping system it's probably a good idea to consider how you would support this in a non-intrusive way.

Xara Xtreme

Check the demo out for this program. This is how all graphical applications should be: interactive, fast and powerful. I'm going to make this my next software purchase.

Friday, March 03, 2006

The wonder of Cell Dynamics

A good friend of mine is going to do some work with a very interesting fellow. Applying mathematics and computer science to biology has always been in the back of my mind as something that I would one day enjoy doing. The simulations and time-lapse recordings are pretty amazing.

Wednesday, March 01, 2006

Feb 28th Seattle.rb meeting

I showed up at the Seattle.rb meeting the other night. There was a lot of interesting talk going around. The web stuff (rails) was interesting but not because I'm into web stuff (I'm not) but because of the build environment and testing setup that one of the Seattle.rb guys Eric Hodel had running on his laptop. The main thing I got out of this is how neat Rake is which I think I will use for building my C++ projects. Also he had integrated the idea of continuous integration into his environment so that this tool 'autotest' would stat his source files and automatically run tests on it when it changed. It also had the ability to automatically generate test methods for his code which was neat. This was an idea that comes from the squeak environment.

There were some other interesting people there that I didn't get to spend much time talking with like Geoffrey Grosenbach.

Later on there was some interesting talk from people involved in ruby VM improvement and language design.

Anyways, a lot more community activity than I had envisioned!