Archive for the 'General' category

Joining the Magic Kingdom

Apr 02 2013 Published by under General

Send to Kindle

I purposely held off until today to break this news as I didn’t think anyone would believe it if I posted it on April 1.

After 5 1/2 years with Infrared5, I am moving on to new endeavors. Specifically, I’ve signed on with Playdom, which is part of Disney Interactive. The position is a principal engineer / senior architect type of role. I’m still getting my head around the structure, but basically Playdom oversees a dozenish semi-independent game studios. I’ll be in the core technology unit, architecting, coordinating, building libraries, etc. I’m excited to get started next week. The offices are in Palo Alto, but I’ll continue to live in the Boston area, work remotely from home, and fly out west every once in a while.

I leave Infrared5 on good terms. Everyone there is great. Several were good friends before they were coworkers, and I’m sure those friendships will continue. There are actually a lot of exciting changes going on there and I wish everyone there all the best. But professionally, although it was a very tough decision to leave, it was time to move on and try something new. As I wrapped up my last project yesterday, I made that my last day and am enjoying the rest of the week as a mini-vacation before starting up the new gig next Monday.

As for how I wound up at Playdom, it all started back in 2004 when I met this guy named Jago McLeod at Flash Forward in San Francisco. A year or so later he contacted me about working for this company called Flash Composer out in Santa Cruz, which I wound up doing. Although management of the company was not the best and it went under a couple of years later, I really enjoyed working with Jago. He’s brilliant, funny, very organized, and just all around a great guy. We’ve stayed in touch off and on since then, and recently we bumped into each other on line. He told me he had become the VP of Engineering at Playdom and once again offered me a job on the other side of the country. And once again, I accepted.

So there you have it. I’m sure there will be more to talk about in a few weeks once I’ve settled in.

Send to Kindle

15 responses so far

Building a MAME Arcade

Mar 08 2013 Published by under General, Technology

Send to Kindle

Background

I grew up in the 70′s and 80′s. The golden age of arcade games. My best friend and I would hit up the various arcades in the surrounding town, and at 25 cents a game, I’d easily spend $10 for a couple hours of entertainment. My favorite game of all time, hands-down, is Tempest. In the arcades of the South Shore of Boston, I was the second best player. I could walk in to any arcade and get my initials on the high score board. Most often, after a few games I could get to the number one spot. Unless my nemesis had been there before me. Who this other person was, I have no idea. He (possibly she, but given the demographics of the time, most likely he) wasn’t amazingly better than me, but better enough to nudge me out of the top spot. I could usually get a number two spot though.

I was the guy people would stand behind and stare at in amazement. Granted, the only time I got such attention at that age was while playing video games, and only that particular one. I was pretty good at plenty of others, but Tempest was my forte.

Later years: Enter MAME

Well, time marched on, I grew up, arcades were replaced by home computers and XBoxes, etc. But I always remembered those old time games. Of course, I’ve installed MAME a dozen times and sought out various ROMs and had a good old time with them, but the holy grail of reliving Tempest was always out of reach. The problem was that Tempest requires a spinner. You spin the spinner to move around the screen and shoot the stuff that’s coming out of the tubes at you. There are plenty of workable Tempest ROMs for MAME, and Flash versions, and various copies. But moving around with the keyboard or mouse was an utterly lame experience compared to the real thing. A few years ago I went as far as getting a Griffin Powermate, thinking that’d work. No such luck. First of all, I was unable to even get it to talk to MAME successfully, and what I heard from those who had, was that it didn’t work all that well anyway.

Let’s just DO this

I most recently installed MAME while working on my Infiltration game, in order to get some Gravitar inspiration (another favorite). Of course, I gave Tempest another shot and had another bout of frustration. But this time I took it one step further and started to look into real game controls. Starting with these sites:

http://buildahomearcade.com/

http://wiki.arcadecontrols.com/wiki/Main_Page

I came up with a list of vendors that sold game controls and various plans on how to put them together. I got a shopping list together from Ultimarc and bought some wood and started cutting and drilling. My plan was to first create an arcade control panel that I could just plug into any computer running MAME. Some people go all out with two- or even four-player control panels. I decided to start with a single player. I ordered a bunch of buttons, a joystick, a control interface, and the ultimate – a real arcade spinner.

The work

 

While I waited for the controls to arrive, I started preparing the wood. I bought a 2′x4′ sheet of half-inch wood at the local Home Depot. I cut a 1′ strip off the end to give me the 1′x2′ top of the control panel.

WP_20130302_002

 

Ye olde workshop. (Yes, I keep a bottle of wine in my workshop. Don’t you?)

WP_20130302_003

 

Control top.

Then I cut a piece of cardboard to the same size and experimented with some layouts, coming up with one I liked.

WP_20130302_004

 

The plan was to have the joystick and spinner in the center, and three buttons on each side. Some games are all button based, like Gravitar or Asteroids – a pair of buttons turn you left and right and other buttons shoot, thrust, shield, etc. These are usually laid out with buttons on opposite sides of the panel. Other games are joystick / button based, and of course Tempest is spinner / button based. Generally, the joystick or spinner is to the right and controlled with the right hand and the shooting / jumping / action buttons are hit with the left hand. Thus, the main buttons are the ones on the left here. Then, on the top are the coin button and start game button (one player start).

That was about as far as I got before the controls arrived.

The controls are here!!!

The controls arrived on Wednesday of last week. Pretty quick considering I ordered on Satureday and they originated in London. I actually did not realize that when I placed the order with Ultimarc. But I’m VERY happy with what they provided, as well as the prompt service and quick shipping. Here’s everything:

WP_20130306_001

 

Doesn’t seem like a whole lot for $200 something. But I have zero regrets.

What you see here are:

A. 7 gold leaf buttons. Actually I ordered 6, they threw in an extra green one.

B. A J-Stik joystick with red ball top.

WP_20130306_003

 

C. A SpinTrak spinner. With a silver/red spin top and extra heavy flyweight. The weight gives it momentum. This thing will spin for a minute or more.

WP_20130306_004

 

D. A MiniPac interface. With full wiring harness.

WP_20130306_002

 

This lets you hook up a joystick, all your buttons, a spinner, as well as a trackball. You then hook it up to your computer via a mini USB cable and you’re good to go. It basically converts all the buttons and joystick movements into key presses, and spinner and trackball input into mouse signals. It’s set up out of the box to work with standard MAME inputs, but it’s also programmable so you could make any control send whatever signal you want. Here’s how you wire it up:

minipac_wiring

 

Took me two or three tries to figure it all out, but once you get the logic, it’s fairly simple. I could rewire the whole thing in five minutes at this point. The wiring harness is well worth it too – you just look up the color and hook it to whatever control it’s supposed to go to.

Alpha Test

My control panel wasn’t ready yet – no holes drilled or anything, but you know I had to see this thing in action. So I put my laptop down on the living room floor and started hooking up wires. Again, there were a few false starts, but I eventually got it at least partway functional.

WP_20130306_006

 

Dang, that’s a mess o’ wires!

I grabbed one of the cardboard boxes that the stuff came in and cut a couple of 1 1/8″ holes in it. Stuck the #1 button in one and the spinner in the other. And fired up… Tempest! I wish I could describe how awesome that was and how excited I was, but you’d probably get really uncomfortable and click off to some other site. Anyway, playing Tempest with a real spinner, even if only mounted in a cardboard box was nerd nirvana. Several hundred times better than trying to make it work with a keyboard or mouse.

WP_20130306_007

 

Here’s my daughter Kris getting her first taste of Tempest. She likes.

WP_20130306_008

 

High tech.

WP_20130306_009

 

Now you’ve seen my slippers. Feel like you know me better?

As for the joystick, I got that wired backwards AND upside down the first time. After switching all the wires I realized I just could have flipped the thing 180 degrees. I didn’t mount that in anything, just held it steady while Kris got her first experience with Space Invaders.

WP_20130306_011

 

That’s the look of pure retro joy. Take THAT, Wii!

Making sawdust

Thursday night’s project was to mount this thing in the real control panel. Based on my cardboard plan, I marked out where I wanted all the holes to be.

WP_20130307_001

 

Then drilled some starter holes.

WP_20130307_002

 

Then used a 1 1/8″ spade bit to cut out the final holes.

WP_20130307_005

 

Conveniently, the buttons and the spinner both fit in the same size hole, and that works well for the joystick as well.

Started mounting the components.

WP_20130307_006

 

And wiring things up in back.

WP_20130307_007

WP_20130307_008

WP_20130307_009

 

Here’s the frame for the sides.

WP_20130307_004

 

Right now, the top sites loosely on top of the frame, but I glued some blocks to it so it doesn’t slide around.

WP_20130308_001

 

Then put the bottom onto the frame and drilled a hole for the USB cable.

WP_20130308_006

 

A bit of cable management.

WP_20130308_002

WP_20130308_003

 

And we are good to go!

WP_20130308_004

WP_20130308_005

 

Yeah, there’s one button missing, but few games actually use all 6 anyway. Originally I ordered 6 buttons thinking of just the 6 player buttons. I can still control MAME, enter coins and start using the keyboard. But when the extra button came, I decided to skip button six for now and implement the coin and player one start buttons on the top. I’m ordering some more buttons anyway – I’ll probably add a pause, reset and select at least.

The cabinet itself is completely unfinished at this point. But we’re having a blast with it. It’s amazing seeing my wife get into it as much as she is. She grew up in the same time and who knew she knows various Space Invaders strategies. She even mentioned some by name. Daaaaamn! The woman is geekier than she lets on. And it’s really awesome to see Kris discovering and enjoying the games that I grew up with. Anyway, I’ll eventually get around to sanding it down a bit and will probably just stain and shellac it. I’m already looking into project number two, which will be a standalone mini table top arcade cabinet, something like one of these. And if that goes well, I might even attempt a full size two-player model.

Send to Kindle

4 responses so far

Microsoft Surface Pro

Feb 10 2013 Published by under General, Windows 8

Send to Kindle

Background

A few years back I was invited to Microsoft for a day with a small group of other bloggers to be briefed on what MS had going on and to speak with Bill Gates himself for a full hour. One of the things they showed us was the early prototype of the Microsoft Surface. At the time, it was basically a touch screen table. And it was amazing. This was before anyone had seen an iPhone or an iPad, so seeing and touching a real time interactive multitouch device left us all in awe. They also said that the future of the Surface probably included a more portable device – something you could carry from room to room, and maybe hang on the wall to watch movies,s play games, etc.

Well, time went by, people started creating other touch screen devices, the iPad came out and blew everyone away and the Surface became a rumored, yeti-like creature.

Then, some time last year, this video was released:

This video definitely captured my attention. And as more and more info on the Surface came out, I kept getting more interested. My weapon of choice has been a Lenovo T520 laptop. I love it to death, but it’s rather large. I’ve been eyeing various ultra-book type devices for a while now, but nothing out there really did it for me. And that upcoming Surface was still in the back of my mind.

Last fall, the Surface RT was released. This, unfortunately, did not interest me at all. RT only runs RT apps. It wouldn’t work for what I wanted it for. I wanted something I could use to do actual work, a full featured pc. So I’ve been holding out to see what the Surface Pro looked like.

So last week I ventured into the Microsoft Store at the Prudential Center Mall in Boston and checked out the prerelease demo models. I liked it. You couldn’t buy them or preorder them, but they would let you reserve one. I didn’t really expect they’d sell out early on release day (Saturday, February 9), but I figured it couldn’t hurt to put in a reservation.

Well, the day before release, New England had a massive blizzard, which shut down the area. In fact, a state of emergency was declared, the subway system was shut down and a travel ban on public roads was enacted. So it didn’t look like I’d be picking up my Surface on Saturday.

By late Saturday morning, the on-line store had sold out of Surface Pro 128 GB models, and there were reports of stores with long “Apple-like” lines selling out of the devices as well. I honestly didn’t expect that. So in the afternoon, when it became nice and sunny out and I had the car all dug out, I actually considered going in. I called the store to ensure they were open. I found out later that Microsoft had put all the employees up at a local hotel so they could get into the store in the morning for launch day. They were open, but informed me before I even asked that they had no more Surface Pros left. I said I had a reservation card and after a few minutes on hold, they said if I could make it in, they’d take care of me.

I made it in and got a 128 GB Surface Pro with a touch cover. All went smoothly. The best thing that happened in the store though, was overhearing this conversation between a woman who walked into the store and an employee:

Woman: “Do you have any iPhones in stock?”
MS Guy: “… um, no, this is the Microsoft Store. If you want an iPhone, you need to go to the Apple Store.”
Woman: “Oh… hmm… OK. … So you don’t have ANY???”

First Impressions

Thanks for putting up with all that, when what you really want to know is how the device itself is.

Short story: I like it a lot. Not sure if I love it yet or not. Much like Windows 8 itself, it’s so different than anything else that I think it’s going to take a while to figure out how it fits into my technological life.

The Surface is kind of like a tablet, but a bit heavy to walk around with and use one-handed like an iPad. It also doesn’t have the extended battery life that your usual tablet does. Average reports of around 5 hours.

But that extra weight brings you a lot. This is a very full featured computer with a core i5 processor running full Windows 8. I can install any program on here that I can install on a regular laptop or desktop Windows pc. And it runs those programs well.

The type cover is great. It snaps in solidly with a very strong magnet and is extremely usable. The screen is beautiful. It’s a bit small. I’m not sure how well I can use the screen itself for an everyday work pc. But it will connect to an external display.

The keyboard also has a track pad which, while not the best track pad I’ve ever used, is far from the worst. I actually find myself using it fairly often. When in desktop apps, the UI elements can be fairly small and hard to hit with a fat finger, so the track pad comes in handy.

The surface also come with a pen. This uses licensed Wacom technology, so the experience of using the pen as a drawing tool is outstanding. To be honest, the pen feels a bit cheap and plasticy compared to the beautifully solid build quality of the device itself. But it works, and is another option I sometimes use for hitting small ui elements in desktop apps.

Overall, the experience of using the device is very good. It’s small enough that when you are typing, your fingers are close enough to the screen that it’s quite natural to use the touch screen as needed.

There was a big media frenzy in the last couple of weeks about the available storage on the Surface devices being “less than advertised”. A real bunch of FUD, in my opinion. Yes, the OS and essential programs are going to take up space. Windows 8 is a full operating system, not a mobile OS, so it’s rather large. But this post really made my day, showing that a 128 GB Surface has just barely less usable storage than a 128 GB Mac Book Air. In fact, if you move the recovery partition off, it has more.

surfacemacbookzdnetcompare

Anyway, like I said, still getting used to this device and feeling out where it fits and what I’m going to use it for. I’ll report more as that becomes more clear.

Send to Kindle

2 responses so far

Circle Layering

Jan 28 2013 Published by under General, JavaScript

Send to Kindle

If you were wondering where my last post was heading…

growth

growth2

growth3

growth4

Oops, gotta turn off the “capture cursor” on that screenshot program. :)

Anyway, this was an idea I first explored several years ago on my art from code site, but has been in the back of my mind as something I wanted to play with more. (see: http://www.artfromcode.com/?s=cells) In the end I ditched the whole idea of perfection I was going for in the last post, as the fact of the outer circles having some space at the end gives it a more organic feel. In fact, you can see that I even exaggerated the space in some of the examples. Well, just a quick follow up. Carry on.

Send to Kindle

4 responses so far

2012 in Review

Dec 31 2012 Published by under General, JavaScript, Technology, Windows 8

Send to Kindle

Following a tradition several years in the running, I bring you my personal retrospective into 2012 and a glimpse into the new year.

In fact, 2012 followed much the same pattern as 2011 – some interesting stuff in the start of the year, a long period of just kind of being bored with everything, and then finding something to be excited about as the year drew to a close.

As 2011 ended, I was starting to get more seriously into JavaScript and web development. In early 2012 I posted a few opinionated opinions on object creation in JavaScript, which sparked some good conversation. I followed these up with a couple of articles on the same subject on the Adobe Developer Center.

In April I went to Beyond Tellerand – Play, a creative/development conference in Cologne, Germany. I revived one of my most popular talks, Playing With Chaos, for this conference, redoing all the examples in JavaScript. It went over amazingly well. The talk is always really well received. After that, I had the idea to turn the talk into a self published book and got a good start on it. But that kind of fizzled out after a couple of months. Perhaps I’ll revive it some time in the new year. You can actually watch the whole talk at the BT Play site, along with the other sessions.

It turned out that BT Play was the only speaking gig I did all year – the least amount of speaking I’ve done since I’ve started. I did have a couple of other opportunities to speak, but have not been super interested in doing so, to be honest. There are few if any “Flash conferences” around anymore, and even if there were, I’m not really doing any Flash these days. I don’t feel expert enough to try to get into the JavaScript conference speaking circuit. I probably could do more stuff like the chaos talk, which would go over well in any kind of creative type situation, but the impetus just wasn’t there for some reason. I guess another part of it is that the Flash conferences had a certain group of people you knew were going to show up. A large part of the pull to speak at these was the hooking up with friends from around the world and hanging out with them. I do miss that.

In June, my coworker and friend, Todd Anderson, and I went down to Austin for the TXJS conference, as attendees. It was very odd not knowing anyone else at the conference, and I’ll admit it, not having people coming up to me saying they read my books, blog, used my components, etc. It was also around this time that I started to get a bit bored with JavaScript. This statement needs a lot of clarification. I don’t have any problem with the language itself or what it can do. And at first, I was pretty excited about all the stuff happening in the community – so many new libraries and frameworks coming out all the time. But this latter part is what eventually got me bored with it. Too many frameworks, too many opinions. and everyone in your face telling you the RIGHT way to do things. I guess I was a bit guilty of this myself earlier in the year with my object creation posts. But I just kind of got tired of all the king-of-the-hill playing that’s going on in web development this last year or so. I got too caught up in the “how to” part and wasn’t really MAKING anything.

So you might have noticed that from June to August of this year I went pretty dark. Honestly I wasn’t even doing anything blogworthy. A bit of a technology sabbatical, covered well enough in this post. Also mentioned in that post is that Windows 8 programming is what pulled me back into activity. I now have two apps in the Windows 8 Store and am very close to having my next one ready for submission.

If it’s not obvious already, I LOVE Windows 8 programming. Everything I’ve done so far has been with HTML/JavaScript, which is the one thing that has most excited me over the last couple of years. But there’s very little of the community chaos that you get in web development. You are essentially developing for IE 10. So all the self-righteous, holier-than-thou web dev hipsters aren’t going to talk to you anyway. :) I’m not a standards guru, but from what I know, IE 10 is pretty good. And even if it’s not 100% standards compliant, since you are only developing for the one platform for desktop Win8 apps, it’s kind of a standard itself.  There’s none of the cross-browser / cross-platform stuff to worry about. Basically, you can just ignore all the noise and MAKE stuff. And that’s what I’m doing. And loving it.

On the job front, I’m still at Infrared5 and that’s all going pretty well. Although nothing jumps out as being hugely exciting there for me in the last year, there were no huge problems either. I did one project in ActionScript / Flex / Desktop AIR, which was pretty unique in that it embeds a Red5 server in the app itself to do local recording of video. I have Paul Gregoire to thank for the Red5 help and in hacking together a stripped down version of the Red5 server that could be run on the low end hardware we were targeting. It was quite a technical challenge and worked out pretty well. Most of the rest of the year I’ve been doing iOS stuff for a client of the company that keeps hiring me back. Earlier in the year I helped build out a custom iOS library for the client, and in the latter half, I’ve been helping to build an app based on that library – truly eating my own dog food! It’s an interesting situation to be working with the black box of a closed library that you helped build but no longer have access to the source of. A bit frustrating at times, but quite an eye opener as well.

So what’s in store for 2013? More of the same. Specifically, my plan for the moment is to participate in this: http://onegameamonth.com/ The One Game A Month… er… project? It’s not a game jam, it’s not a contest, it’s just a couple thousand people who say they are going to try to make a game each month for 2013. Fantastic idea. I’ve spent way too long on the game I’m currently working on. That’s a common problem with any personal programming project. There’s no deadline, so you fiddle with it forever, trying to make it perfect, eventually get bored with it and start something else. This boxes out your time. One month. Get it done. Ship it. The game I’m working on now will wind up being my January game, and I have a great concept for February. I’m excited about this.

I also really do plan to do more blogging. I’m going to try to put something up 2-3 times a week. Probably a lot of it will be about the game I’m working on at that particular time. Any tricks or tips, problems or insight.

Also, as many of you know from my tweets, G+ posts, other comments, and occasional mentions on this blog, I’ve been heavily into running in the last few years. This past year I ran my first two marathons and am now in training for my first ultramarathon, a 50K (31 mile) trail race in April. I don’t like to put too much of that info on this blog, but if you are interested to hear more about that, here’s another year in review post from that viewpoint, on my personal blog.

Send to Kindle

2 responses so far

Look Who’s Back In Town

Sep 30 2012 Published by under General, Technology

Send to Kindle

You know what I hate? Subscribing to a blog and that blog doesn’t get updated for months and the blogger shows up and says, “Sorry I haven’t been blogging, been really busy, blah, blah, blah. But I’m really going to start blogging now!” and then they don’t blog for another few months and come back and say, “Whew! Still so busy! But I’m really going to get back into this blogging thing now! I promise!” and there’s no actual content in those posts, just promises of impending awesome content. That’s what I hate. That, and silverfish. Those things freak me out.

So, I’m not going to apologize, I’m not going to tell you how busy I was, and I’m making no promises. But, I will tell you what’s been up, what’s up, and what might be up in the future.

What’s been up: not a whole heck of a lot, to be honest. I kind of took a coding sabbatical. Of course, I’ve still got a full time job where I code all day, but historically, that’s only a warm up to the cool personal projects I work on when I get home. But for the last few months, I haven’t really been coding anything at all in my own time. In the few months before that, I’d started all kinds of various projects, apps, games, etc. These dead orphans litter my hard drive. Finally I just stopped forcing it and let myself have a coding vacation. Honestly, for about a month, I’d often not even open my computer at home. I’d check my email and do any other web related tasks on my Nexus 7. If I did open my computer, it was likely to watch a movie or some TV show, or log my runs of course. And you know what? It felt GOOD! Consider that in addition to my full time job, I’ve been coding at the very least, a part-time job’s worth of projects for most of the last 13 years – at times no doubt another whole full time job’s worth of projects. Not that this was something I didn’t like. Obviously, I did it because I love programming and creating cool stuff with code. But damn, you can get burnt out after a decade or so doing that stuff. So yeah, took a couple months and just said screw the code. Had no real plan of when I’d be back or what I’d do, but knew something would come along and yank me back out again.

So what was I doing? Running, reading, (finally) learning to play guitar, maybe spending a bit more time with the family.

So what’s up now? Would I be blogging if I were still playing hooky? Of course not. For the last two weeks or so I’ve been coding up a storm.

What happened was that about a month ago I installed Windows 8 on my PC. I’d previously had a dual boot system on a single hard drive – Linux and Windows 7. That was OK, but it limits your space on both systems. When I decided to try out Win8 I wanted to be able to install whatever I wanted without worrying how much of the disk it ate up, and the same in Linux. So I pulled out the optical drive and bought an adapter tray that allowed me to install a second hard drive in there. Now each drive had its own full 500GB disk. Installed Windows 8 on one, and Ubuntu 12.04 on the other. Great.

My first day on Windows 8 scared me to be quite honest. The whole Win8 interface (formerly known as Metro) looks nice, but is so damned different, I had no idea what to do or where to find anything. After a couple days though, I started learning the gestures and shortcuts and it really all started growing on me. Before long I was using Windows 8 pretty much full time.

The next thing that happened was that my friend, Jesse Freeman, joined Microsoft as a Windows 8 evangelist, and started bugging me to make Windows 8 apps. It did intrigue me, and Jesse is pretty persistent, so eventually I downloaded Visual Studio 2012 Express for Win8. I created one of the sample apps and ran it and messed with the HTML a bit, but didn’t immediately get hooked. But I had an idea.

When I was off doing nothing, I did have one concept for what I wanted to do – revive my Art From Code site and create a framework in JS/Canvas that allowed me to make high resolution generative art pieces that could be printed. Most of the stuff on the site now is not high res enough for quality printing. I had some very cool ideas for how this framework would work, including saving of code, parameters, and results, so that the pieces could be regenerated and rerendered at varying resolutions. One sticky part of it was saving the images as bitmaps. If you are working in a web page, you can get the canvas’s image data and assign it to the src of a new image and display that image. You then have to right click and save the image. Not very elegant, and in my experience the browser constantly chokes on large images. This would be a problem.

So I asked Jesse if it was possible to save a canvas as a bitmap from within an HTML-based Windows 8 app. I’d googled around a bit and it didn’t seem like it. But he came up with a great link that worked like a charm. I made a quick sample and I was hooked! From that day, for the last couple of weeks, I’ve been working on an app that generates artwork and allows the user to save it. Although it was just a proof of concept for the app I plan to make for myself, it was cool enough that I just submitted it to the Windows 8 Store.

That was the first personal project I’ve actually completed start to finish since May of this year. And I’ve already started on my next app – a Windows 8 port of Falling Balls! So I guess it’s safe to say I’m back.

Like I said, no promises, but there are lots of things I’d like to blog about at this time – the app itself, the technology behind Windows 8 apps, and the submission process, to name a few. So who knows, you might see some more posts here before the end of the year.

Send to Kindle

5 responses so far

STProjectMaker – Sublime Text 2 Plugin for creating new projects

May 20 2012 Published by under Extensibility, General, Technology

Send to Kindle

Note: I changed the name of the plugin from “SublimeProjectMaker” to “STProjectMaker”. The github address is also different now because of that change.

I love Sublime Text 2. But one thing I’ve always felt was missing was the ability to easily create a new project. I understand the difficulties involved. Sublime handles many different languages and projects of all different types. Each type of project in each language could have a completely different setup. There is no one single project type that could possibly work for everything.

Unfortunately, that means that to create, say, a simple HTML project, you need to open Sublime, close whatever project is currently open, then do a “save project”, saving the non-project as a new project, creating a directory and also naming a project file. Then you have to add that folder to the project. Finally, you have to create the actual project files – .html, .js, .css, etc. and hook them all up to each other. I’m not even talking a complex project, you have to do all that for a simple hello world type program.

Luckily, its creators made Sublime Text 2 incredibly extendable with a plugin architecture allowing you to write your own plugins that tie into the core UI of the editor. For quite a while I’ve had the idea of creating a plugin that would simplify the creation of a project. My first stab at it can be found here. That, of course, wasn’t a plugin, but an Ant build file that copied files over to a new directory and created the project file. It worked, but required Ant to be installed, and you still had to create a directory and copy a bunch of files into it and then open a command line and run the build file. And creating a new project type would have been a major pain. Even I stopped using it after a while.

Finally, at the end of last week and over the weekend I got around to working on my plugin idea. Sublime’s extensibility layer is based on Python. I broke out my old Python books and got to work. A major challenge beyond that was the fact that large portions of the plugin API are not at all documented. Throughout the documentation you will see suggestions to look at existing plugins and commands to see what low level commands are available and how to use them. That made it quite a bit of a struggle at times, but it was a fun challenge, seeing bits and pieces of functionality come together.

And so I present STProjectMaker. It is a full fledged plugin that lives within Sublime Text 2. When you call it up, you are presented with a list of templates. You choose one and then choose a location for your project. The template is scanned for any replaceable tokens and if any are found, you are prompted to provide values for them. Finally, the folder containing your new project is opened with the system file explorer application.

Templates are merely folders of files. At the moment there is only a bare bones HTML/Canvas template, but you can create your own very easily. I’ll be creating more and it’s my hope that others will contribute some as well.

There you have it. Hoping it’s useful.

Send to Kindle

8 responses so far

Playing With Chaos: The Book

Apr 29 2012 Published by under General, JavaScript, Kindle, Technology

Send to Kindle

Well, the title gives it away, so I just need to elaborate. I had so much fun and did so much research and wrote so much code for my Playing With Chaos presentation, and it went over so well and was very popular. But in the 45 minutes I had last week, or even in a full hour of talking, you can barely scratch the surface of the simplest bits of math or code and only show a few quick images or demos of each example. And there were lots of other examples that I didn’t even have time to touch on. I would love to be able to cover all the topics I had in mind, and go over each one fully enough, with well explained code. Thus, I’ve been thinking of writing a book based on the presentation.

The truth is that I’ve been thinking of writing this book for about a year. But doing the presentation at Beyond Tellerand – Play! solidified the idea. Here are some details about my plans:

1. I’m going to self-publish the book. I’ve been really interested in self-publishing for a while. This will be an experiment to see how well it works for me. The biggest thing I’m concerned about is the editing process. I’m sure I can dig up a technical reviewer or two, but the copy editing phase where someone at the publisher fixes all your spelling and grammar and unifies your tenses and persons and numbers, etc. is invaluable. I actually do understand grammar pretty well, but in a longer piece of writing I can lose track of the style I’m using and jump back and forth. It will take an extra reading or two with extra attention on this stuff to get it down. Or perhaps I’ll find someone willing to help me out on this point.

2. I’ll be going through the Amazon Kindle publishing service. I think this offers the best form of distribution, discoverability, protection, commerce, etc. In addition to being able to read the book on any existing Kindle, it can be read on any iOS, Android, Windows Phone 7 or Blackberry device and on any computer via standalone reader apps or the Kindle web app. This also allows me the option to publish through other services such as B&N Nook and Apple iBooks as well. In addition, there are services that will publish hard copies of your Kindle book on demand for those who want to kill trees. :)

3. I will not be doing a Kickstarter project for the book. I don’t believe most books require any kind of start up capital. Unless you need to do some kind of heavy research, travel, or buy some expensive equipment, or quit your day job and write full time, there is really no up front cost. You sit down and write the book. The only thing I might need to pay out for would be a technical reviewer and/or copy editor, and that would be later and something I’m sure I can work out. I’ve contributed to funding two books over the last couple of years on Kickstarter and neither one of them has yet seen the light of day. It leaves the author in an odd position of being responsible to many people, but with no single person invested so heavily that they are going to bug him daily to meet deadlines. I’m not even sure there is any penalty if you get funded and never release the thing you were funded to do. Do the contributors eventually get their money back if nothing happens?

4. The examples will be done in JavaScript with HTML5′s Canvas. This may or may not be your favorite platform, but I feel like it offers appeal to the widest potential audience. Even if you’ve never done any serious JavaScript, you can fire up a text editor and browser and be coding and running HTML/JS in minutes, for a total cost of $0.00. If you’ve done any programming in any other language, JS is a piece of cake to pick up, and generally easy enough to convert into the language of your choice. Few other languages require so little monetary investment, so little setup for a coding environment across the boards, and such a low learning curve for the language itself.

5. Right now, the TOC stands at 12 chapters, but that could change and rearrange. Right now I’m most of the way through the introduction chapter and have been working on developing a base package that all the examples can use to prevent massive duplication of code. The goal is to not rely on any major third party libraries just as jQuery, etc., and not to create something so complex that it becomes a heavy dependency. Basically, it’s just some boiler plate to grab the canvas, 2d context, some properties like width and height, and various utility functions for commonly used operations.

So watch this space for various updates over the next few months. Maybe even some teaser images or live demos. I haven’t really got a solid deadline in mind, but roughly hoping to be done by the end of the summer.

Send to Kindle

10 responses so far

SublimeText2 Plugin: RunBuild

Jan 16 2012 Published by under General, Technology

Send to Kindle

I was talking to my coworker, Todd Anderson, today about running build systems in Sublime Text 2. It’s a great editor, very powerful and configurable. But somewhat of a lack of documentation on all those features. One problem we both had was setting up multiple build systems on a project, say one for running unit tests, one for running JSLint, one for deployment, etc. You can specify build systems right in a project file as per this reference: http://www.sublimetext.com/docs/2/projects.html. For a drop dead simple example, you could have one that launches your index.html file in chrome, and another that launches your unit tests in tests.html. This would look something like this:

"build_systems":
[
    {
        "name": "preview",
        "cmd": ["/usr/bin/google-chrome", "$project_path/index.html"]
    },
    {
        "name": "test",
        "cmd": ["/usr/bin/google-chrome", "$project_path/tests.html"]
	}
]

Now, in your “Tools/Build System” menu you should have two entries: preview and build. You can choose one, and the next time you build it will do what you specified in that system. The problem is switching between them. Grab the mouse and go to Menu / Tools / Build System / test (or preview). Then, F7 or Ctrl-B to build. Or maybe you forgot which one you were on, so when you build it builds the wrong thing and you have to cancel and go back and check and redo it. Minor pain, but it gets annoying.

Ideally, you could assign a specific keyboard command to each build system. So I started digging in to see how to do this.

First Part of the Solution: set_build_system

After some digging around, I found that there’s an internal command called “set_build_system”. You pass it a single argument called “file”. The value is one of two things:

1. The path to a sublime-build file, such as “Packages/Java/Ant.sublime-build”

or

2. The name of a custom build path in your project file (like what we just created as “test” and “preview”.

You can use this command in a keyboard shortcut. Go to the Preferences menu, Key Bindings – User. This will open up a Default sublime-keymap file, which should contain an empty JSON array like this: [], unless you have already added some shortcuts. You can create shortcuts that will change your build system like so:

[
    { "keys": ["ctrl+shift+p"], "command": "set_build_system", "args": { "file": "preview"} },
    { "keys": ["ctrl+shift+t"], "command": "set_build_system", "args": { "file": "test"} }
]

With this, Control-Shift-P will set your build system to your custom preview build system, and test likewise. But it’s still a two step process: set the system, then build. And again, there’s no visual indication of which system is currently set, and no visual indication of when it changes, so you’ll still find yourself checking manually in the menu to see which is checked.

Ideal scene again, would be one shortcut that chooses the system and then builds.

Second Part of the Solution: plugins

A keyboard shortcut can only run a single command. But we need to run two commands: choose the build system and then build. To do this, you can create a sublime text 2 plugin. This is far easier than it sounds. In fact, Todd and I were both pretty shocked at how easy it turned out to be and how quickly we got it working.

A plugin is a Python class that creates a custom command. It extends one of three plugin classes: WindowCommand, TextCommand, or ApplicationCommand. This post was very helpful in getting me started:

http://net.tutsplus.com/tutorials/python-tutorials/how-to-create-a-sublime-text-2-plugin/

Here’s the command that Todd and I came up with virtually at the same time:

import sublime, sublime_plugin  
  
class RunBuildCommand(sublime_plugin.WindowCommand):  
    def run(self, build_system):  
        self.window.run_command( "set_build_system", {"file": build_system } )
        self.window.run_command( "build" )

Running through it, this imports a couple of sublime packages, defines a class that extends WindowCommand, and a single method called run.

The run method takes a single parameter (besides “self” that all python methods get) which will be the name of the build system to run.

It then does the two things we need to do by making calls to self.window.run_command, passing in the command to run and any arguments.

First we call “set_build_system” like we did in the first keymap example. This passes through the build_system argument.

Then we call build, with no args.

So we’ve accomplished our two actions in a single stroke: set the build system, then build.

You can save this file as “RunBuild.py” anywhere in your Packages folder in Sublime’s config folder (check documentation to see where that is on your OS). I suggest you give it its own folder so it becomes /Packages/RunBuild/RunBuild.py.

Now we just need to change the keymap to call this custom command instead of set_build_system. The name of the class, RunBuildCommand, will be mapped to a command called “run_build”. CamelCase becomes camel_case in this setup. So we do this:

[
    { "keys": ["ctrl+shift+p"], "command": "run_build", "args": { "build_system": "preview" } },
    { "keys": ["ctrl+shift+t"], "command": "run_build", "args": { "build_system": "test" } } 
]

And we are done! Control-Shift-P launches index.html in the browser, and Control-Shift-T launches test.html. Of course, your build system(s) could be far more complex than the simple one I showed here, there you go.

Send to Kindle

4 responses so far

The year they called “2011″

Dec 30 2011 Published by under General

Send to Kindle

I end this year feeling more excited about technology and programming than I have in several years. That’s really good because for most of last year and into the middle of this year I was going through a bit of a geek crisis. Nothing really seemed to excite me as a programmer. I ended the year doing Windows Phone 7 development, which is a great development platform, but unfortunately almost nobody has the devices. I was tired of iPhone development and nothing in Flash was exciting me.

Here’s kind of how my year went:

Continue Reading »

Send to Kindle

6 responses so far

Older posts »