Tuesday, January 17, 2012

Automatic Screen Window Titles in Bash and Vim


I finally configured screen to display the list of windows open with useful titles. Here are the few bits I needed

First, if you don't know what I'm talking about:
I occasionally SSH into work, and when I do I use a program called screen that can host multiple terminal shells. It can persist those shells and allow me to reconnect if I get disconnected or want to change computers I'm working on.

BTW, I always start screen with screen -RaAd -S x

  • -a   include all capabilities ...
  • -A   Adapt  the sizes of all windows ...
  • -d -R   Reattach a session and if necessary detach or even create it first.
  • -S Name of the session


The default configuration makes it hard to keep track of how many terminals you have running, and what they are doing. I made three changes that help my personal workflow:

Add a persistent display at the bottom of screen
In .screenrc I appended this line:
hardstatus alwayslastline "%{=b}%{G} Screen(s): %{b}%w %=%{kG}%C%A  %D, %M/%d/%Y "


Source: Julien Chaffraix, a coworker.

Set the current directory name as the window title from bash
In .bashrc I appended these lines:

if [ "$TERM" = "screen" ]; then
  screen_set_window_title () {
    local HPWD="$PWD"
    case $HPWD in
      $HOME) HPWD="~";;


      ## long name option:
      # $HOME/*) HPWD="~${HPWD#$HOME}";;


      ## short name option:
      *) HPWD=`basename "$HPWD"`;;


    esac
    printf '\ek%s\e\\' "$HPWD"
  }
  PROMPT_COMMAND="screen_set_window_title; $PROMPT_COMMAND"
fi


You can see that I'm using a short name for each directory, e.g. "chromium" instead of the full path or suffix path after my home directory, e.g. "~/projects/chromium". You can toggle the commented lines to try alternates.

Source: http://unix.stackexchange.com/questions/6065/gnu-screen-new-window-name-change.

Set the name of the buffer I'm editing in vim
In .vimrc I appended these lines:

if &term == "screen"
  let &titlestring=expand("%:t")
  set t_ts=^[k
  set t_fs=^[\
  set title
endif


Source: http://vim.wikia.com/wiki/Automatically_set_screen_title.

Wednesday, November 2, 2011

New Game Conference Day 2

The sequel to my Day 1 report from the New Game, HTML5 Games, conference:

The quality per session has been really great, and the good news is that Videos are on the way, so if you weren't there, don't fear. Also, here are most of the slides.

Zynga kicked today off. They're dedicated to HTML5 games, reaching lots of people, and moving the web forward. Paul Bakaus pointed out that classic games devs get people to upgrade hardware; new web games need to get users to update to modern browsers, "Please help me upgrade the web".

Zynga has also open sourced some rather handy sounding tools: https://github.com/zynga including audio fixes/hacks for ios, viewport control, custom viewport scrolling assist libraries.

Grant Skinner has put out tools too: Easle.js, flash like api primarily to draw to Canvas 2D, though he demoed swapping out rendering engines to e.g. DOM & flash too. He also demoed exporting content from Flash.

Spil had a good talk about developing for and publishing in Asia; primarily challenges in hosting, distribution, and localization (beyond just text).

Opera's Erik Möller showed off WebGL support in Opera, including a demo off a TV set top box hardware kit.

Mozilla has a cool project taking a spin on their old question of "Are We Fast Yet?" and changing it to "Are We Fun Yet?" Their Palidin effort is designed to improve that answer. They're building an open source web tech game engine and implementing platform features such as Mouse Lock and Game Pad. Similar in ways to the Chrome Games effort I'm part of.

Rachel Blum of Chrome (ex Blizzard) did a great rundown of Chrome as a platform for games, now and in the future.

Overall, there was a lot of energy, excitement, and potential shown off. Several presenters demonstrated that they are monetizing now using some of this tech. Others that we still have lots of potential in tech that's not quite ready for everyone.

I'm psyched about fixing what needs fixing to make the web platform awesome for games. And tomorrow there's the W3C Games Community Group Summit which I'm hoping will be a great forum for prioritizing that work.

Tuesday, November 1, 2011

New Game Conference Day 1


New Game's first HTML5 Game Conference kicked off today. It's an intimate and comfy affair with just a few hundred devs all packed in one large room. It's easy to mingle in breaks, and we had lunch all together on the lawn at Yerba Buena park.

Rich Hilleman, EA, kicked things off with a great keynote discussion of what it takes to build out a game platform and how things are quite different doing so with open standards tech. It was inspiring, but also underscores the challenge of building a 'platform' when no one controls it. Who will champion a killer app? Who will define the capabilities and expectations for developers and customers, and do quality assurance? Who will make certain we can monetize and distribute? Well, no one, and everyone.

The other business heavy presentation was from Justin Quimby of Moblyng. They've already been at this a few years, with the goal of using web tech to reach a huge number of devices, primarily mobile. His main message was that of the many challenges that await after you've build a compelling game. His recommendation was primarily technical conservatism and diversification of services (e.g. payment solutions, metrics, and distribution).

But the majority of the presentations were technical. The biggest points and themes:

  • Garbage Collection a major performance issue! Several techniques to avoid this, including careful JS coding, all memory out of array buffers.
  • Sound! Much love for Web Audio API, but needs support in all browsers.
  • Many developers using high level frameworks and languages and cross compiling to HTML/JS. E.g. PlayN in Java, Mandreel in C++.
  • WebGL standard update coming, major focus on security and robustness.
  • 2/3rds of attendees from Web Dev background: http://goo.gl/PSTrU
Lots of good coverage on twitter #NGC11

Slides for many presentations are already posted if you dig around, but I saw cameras so I suspect we'll see a post conference set of links to videos.

[day 2 post]

Sunday, October 9, 2011

Go Board Game with Google Docs

Go, played on Google Docs
I've been satiating my asynchronous game play needs recently by playing Go via Google Docs. I figured someone else must of thought of that already, and they did: Edward Donohue had a spread sheet template available, which I modified into my Go Board Game Template.

The cool thing is that Google Docs comes with great features already in place:

  • Version history
    • Allows you to roll back time to recall what has been happening in the game.
  • Change Notifications
    • Allows you to make a move, and your opponent will automatically get an email notification that links to page showing what has changed.
    • (Set this up by going to |Tools| |Notification Rules|)
  • Auto formatting
    • Makes the board look like a bunch of black and white pieces instead of playing in text.
  • Works anywhere, even mobile
Also, you can do odd stuff, like make this tiling (toroidal) go board. People have played on tiling boards before, the simplest way is to just duplicate any moves on the left and top edge to the right and bottom. But, in docs, .

Try out the templates by making a copy so you can edit in them. Select a square and enter a 'w' or 'b' character. Have fun!

Gmail Follow Up Script

I have lots of email I want to follow up on later or put aside for some time. I use Gmail these days, and I miss Outlook's built in feature for this. Well, there's a solution, the apps script team posted a script for "snoozing" email. My modified take on it is this gmail Follow Up script doc.

The implementation summary is: You can have javascript code run on a Google server at a regular interval that manipulates your gmail messages. You do so by creating a Google Docs Spreadsheet and adding script code to it.

I modified the original in a few ways:

  • I added "hours" to the "days" and "weeks"
    • At first I thought it was overkill. But, no, it's mighty handy in a work day to put off an email till the afternoon when you think someone else should have replied by then. Or just to clear your inbox rapidly so you can concentrate on the top items for the next hour.
  • I adjusted the label names to be more keyboard shortcut friendly
    • To move an item out of my inbox and have it reappear tomorrow, I type the keys, "v1d" enter. That's |move|, and then enough to match the label "FollowUp-1days".
  • I use the "quick links" lab in gmail to view all messages pending follow up
    • Sadly there's no way to roll up multiple labels in gmail, else the hierarchical labeling would have solved this. Anyway, details in the doc for using quick links.
Some notes:
  • Draft messages can be brought back to to the inbox, to complete and or send at a later time.
  • Muted messages can be brought back too, disabling the mute at that time. So you can let a firestorm thread rage on for a few hours before reviewing it in it's entirety instead of being interrupted constantly as replies come in.
  • I sometimes leave notes to myself as to why I marked this message for follow up. One way is to start a reply draft and then blank out the To: line so it's not accidentally sent.
  • It's handy when you send a message and want to ensure you get a reply back.
Now that I have this tool, I use it a lot a lot to rapidly simplify my inbox.

Tuesday, August 23, 2011

Casual Connect 2011 HTML5 Games Presentation



My Casual Connect 2011 HTML5 Games Presentation was recorded, and the 30 minute video is up.

I discuss the current availability of some key HTML5 features, overview the browser tech being used today in games, and touch on monetization and distribution. Lots of resource references towards the end.

The next best way to learn more is to come to the New Game Conference in November.

Saturday, July 2, 2011

Game Jam Tips

I've done a few game jams. At Google, I've done a few at work, and been asked for tips on running them internally and externally. Thanks Seth Ladd for nudging me to post. So, why not jot some thoughts down here:

Prepare, and make sure participants are prepared. You want to spend the jam making awesome, not doing the boring stuff:

  • Publicize frameworks in advance and encourage attendees to come with 'hello world' games already under their belt so they can hit the ground running. Possibly include a super simple template of our own that isn't a 'framework', but just a tiny simple example.
  • Publicize easy / free tools for e.g. audio & 2D drawing. (e.g. Audacity & Paint.Net)
  • Publicize source control and encourage teams to already know how to use it, set it up in advance, and have made a trivial pull, edit, push cycle.
  • Publicize game hosting tech (appengine, nodeJS) and point to relevant examples (Well, for web games)

Hold something back until the Jam - usually the theme. Generate a surprise theme that balances creative license and enough constraint to remove the 'blank page' effect.

Decide to allow pre-formed teams or not. Most Jams I've been in discouraged pre-formed teams or game concepts. Instead, we brainstormed them up, pitched them to the wide crowd, and formed small teams to work on the top ideas. Pros and cons either way, but I've enjoyed the mixer style.

Small teams tend to work out much better than large. E.g. 2 or 3 coders. Communication is a killer on a tight schedule.

Have an art plan. Either set expectations that people should work with minimal art (e.g. procedural, 'retro' lo-fi-pixel-junk, or freely available stock), have artists and a plan for how to get art out quick, or pre made art. Some contests have run in two phases of 'prepare art' and then 'make games using only prepared art'.

Encourage rapid prototyping development practices! Games should be functional half way through!!! They'll need the second half for polish. People always always always blow this and mis-estimate. Encourage frequent re-prioritization of what people are working on. One good technique is have a team list out the top few tasks, rank `em, and have people work on those and only those. Don't work on anything unless it's an agreed top priority.

Eat, sleep, don't try to mash it all out. Taking short breaks through the day let's you get Meta, re-evaluate progress and priorities, and plan. Sleep helps you make the remaining time more effective.

Don't make it a contest, but if you do, run several wildly different categories. E.g. most original, best use of new tech, most hilarious. Don't just have "the best".

Plan for games to have more work done after the Jam, and how they will be publicized. Can teams update links, images, YT videos, etc?

Capture the presentations at the end, e.g. video recording. Snapshot the code and art too. (Good reminder, Mike Mahemoff)

Have fun. If it's not fun... do something fun. ;)