Motor Oil, Lightly Accented With Pineapple

Monday, July 18, 2011

As Steve, my ever-well-muscled roommate, reminded me - I have not spewed forth on any number of topics here since almost half a year ago. A friend of mine once remarked to me that when you are actually busy living life, there is npot much time to write about it.

I will see if I can knock off the more interesting parts of those months in short order.

In the working world - my old company, Iron Mountain, sold off its digital division to Autonomy Corporation, a real, honest-to-goodness software company (rather than a 'services' company like Iron Mountain is...which is just a fancy word to stand in for the phrase "we are unable to realize that storing paper records is a soon-dying business") based in Cambridge, UK. There's been a lot of to-do - people leaving and swooping out of nowhere with new directives and infrastructure changes and all that. In the midst of this I somehow managed to finish the piece of software I'd been laboring on for about a year and a half, and so the Good Ship Outflow has finally taken its maiden flight. Things continue to be busy on that front.

In all things running - I didn't quite reach where I wanted to be this year, despite the somewhat drastic change in training during indoors and the extra endurance that most certainly gave me. I ended up running 3:58.65 for the 1500 at New Balance Boston's third home meet - when at the beginning of the season I had said I was looking for 3:54.

In arenas musical, I haven't had quite the time to devote as I've wished. I managed to get past a significant roadblock I'd erected in one or two songs, so I now have 2 fairly complete tunes (out of the 8 I'm shooting for). Unfortunately for me, the fact that the songs are written is almost meaningless, as recording tends to be the real bitch of the process.

In the wide world of text-based video games, some 4000-odd people have now downloaded NWBD and I have earned something like 2 dollars and 89 cents. That equates to about a dime for every hour I put into it. It's been fun to do something else in programming besides fix ever more esoteric bugs involving the stupid characters you can insert into a Mac file name. Did you know that in Mac OS you can have a file named by only a space character? Or a carriage return? How about a bell character? If you have no idea what those mean, rest assured, it means that Mac OS has made my life a little more miserable.

It seems like for the most part my job revolves around the 'data structures' part of computer science - how to formulate information so that you have what you need in a given situation, no more and no less. Games, on the other hand, have some algorithmic complexity - how to get from point A to point B with the shortest parth ossible if some points in between are not traversable, and if the landscape may change while you're movng..for example. It tends to attract my attention a little more.

Last, but certainly not least, the Bridgestone Potenzas have made their way back onto my vehicle, and with summer tires comes smoky burnouts and autocross. I got my ass out to Devens-Moore Airfield a few weeks ago and had a pretty damn good time. I beat a mid-80's Corvette on time (which is saying something) but lost to a Honda Fit (ok...so it really isn't saying anything at all). I definitely sucked less, though. It helped that I had a lot of good instructors from the fine folks at NER...and I think just being more aggressive with the car aided a ton, too. I am actually a little scared to throw as much at my RX-8 as it can take - it handled supremely throughout and it's pretty clear that I am the biggest limiting factor in the car. That's reinforced by the fact that one of the perennial top-10 drivers in the region drives the same car without any serious modifications.

Other than that, my summer has consisted of watching the Pittsburgh Pirates actually be a respectable team again, getting into swanky clubs in NYC wearing shorts and sneakers, hanging out with friends and family, occasionally putting some poetry up on thefircoat.com, and drinking a humongous Tom Collins whenever the hell I feel like it. Not too bad.

End-o-feb

Saturday, February 26, 2011
While Sarah snoozes in the haze of post-brunch euphoria, I thought I'd run down quickly what I've been doing the past two weeks running-wise. I'm more or less happy with how things went in February, and am hoping taking a very down week this week (aka: run if I feel like it, which I've done twice) will help cure all ills. Not being able to get on any soft surfaces for a couple of weeks in a row really doesn't feel good - my shins / plantar fascia / hips were all complaining really loudly.

Week beginning Feb 6th -

Sun: 8 mi, 58 mins - Would've done more but got out a little too late and didn't want to get hit by a car.
Mon: off
Tue: 6 mi warmup / cooldown (roughly)
5 sets of 3x400, 60R, 3 minutes between sets, @ 3k 5k 3k 5k 3k pace.
This went pretty well and I actually went a little faster than assigned on a few reps (supposed to hit 70's and 74's). With Murner, Foote, Chris, and Dan L.
9.5 total
Wed: 9.5 mi, 68 minutes - On the treadmill @ work, lifted.
Thu: 8.46 mi, 60 minutes - Treadmill.
Fri: 4 mi, 32 mins - Stupidly went outside. Fuck you newtonites! Shovel your damn sidewalks like decent civilized human beings. Or hire someone to do it for you. You can afford it.
Sat: 8 mi, 59 mins warmup / cooldown

Ran le mile @ Valentine's, ended up with a 4:24 (which is exactly what I was shooting for). I was a little worried that I was just going to run a 66 and my legs would explode - I've never really run the mile off just 3k work before. Every training program up until this year has always included a huge volume of mile race pace work even before I get to my first race. It's a little scary going into your favorite event and feeling totally unprepared, so I ran very conservatively. As soon as the gun went off, I just dropped to the back and chilled - I was seeded at 4:20 so the front of the group was going to be running 63-64's...at the beginning, anyhow.

It was definitely a different kind of experience, running from the back like that - and being very conservative. For one, I had absolutely no traffic to deal with. I was sitting about 2 meters behind everyone else in dead last, and no one was attempting to cuddle or make out with me on the track. Almost every other race I've run indoors, I've had to fend off would-be suitors from my lane. The other difference is that I wasn't really in as much pain as I normally would be at the 800 mark, so I was able to make more conscious race decisions rather than relying on furious animal instinct to get me to the line intact. Admittedly, my conscious race decision was "chill out, you don't want to blow up" and I waited till 400 left to pass some people, but I could've made the decision otherwise too. I feel like there were maybe a few seconds left out there from running too conservatively, but the consequences of going out too hard were great enough that I think it made good sense to play it how I did.

Anyhow, total for the week: 49 mi, 343 minutes.

Week beginning Feb 13 -
Sun: 10.25 mi, 77 mins - Around BC for a small eternity. I think this was the day I saw Archard and Sasha out there. My hamstrings were extremely blackened toast after the mile.
Mon: 9 mi, 65 minutes - With Stewbeef and Willycizzle around BC.
Tue: 45 mins warmup / cooldown
4x 600 60R 400 2.5R (35, 34 pace) 6x150 at the end
Was supposed to be 5, just suckin' hard. Foot hurt, so I did it in trainers, and was around 2 seconds off every 600 and 1 second off most of the 400's.
9 miles total
Wed: off
Thu: 6 mi, 45 mins - slow around the res, but nice day.
Fri: 6.5 mi warmup / cooldown
1.5ish miles of 6 x 1 minute on, 1 minute off
Felt godawful, started pouring during the cooldown.
Sat: 7.8 mi, 56 mins - still felt like trash.
50 miles, 366 minutes o'erall

The next day I finished off indoor with an 8:51 in the 3k at USATF-NE's, playing it exactly the opposite of my mile at Valentine's - went out a little too quick, wound up in no-man's-land, and was in ruinous agony from 600 to go. Still a respectable time, but I wish I had split it a little more intelligently than 2:52 / 2:58 / 3:01. Going out in 2:52 actually felt surprisingly good - I didn't feel that bad till maybe 1k or 800 to go, which is a far cry from my experience at Terrier where I didn't feel great from maybe 1400 meters onwards. I would've liked to run faster than my opener but I feel like I'm at least in better shape, which is all I really wanted headed towards outdoors. Huzzahhhh.

Now I'm going to go eat a clementine. Au revoir, pour maintenant.

Something Witty About Mileage

Monday, February 7, 2011
Hooray! A week of decent running despite the weather. Mostly my good fortune in getting in any kind of mileage arose from a combination of unwillingness to admit that running around the Res was lunacy...and the fact that my workplace has a treadmill.

Without much more ado about nothing:
Sun: 85 mins, 11.75 miles -  around Newton with WillyCizzle.
Mon: 44 mins, 6 miles - cold windy putzfest around the Res.
Tue: 68 mins, 10.75 mi - uglytough workout with Dan L., Foote, and Avery.
1 mi - 2k - 1 mi - 1k - 1k, constant 2.5min rest.
Hit something like 5:05, 6:33, 5:04, 3:05, 3:03.
Wed: 60 mins, 8.34mi - on the treadmill at work, lifted.
Thu: 47 mins, 5.5 mi - Snowy res run.
Fri: 60 mins, 8.5 mi - treadmill.
Sat: 60 mins, 9.79 mi - 9 am workout with Dan L.
1 x mile, 4 x 400 - 2 sets. 4 mins after mile, 2 mins between 400's.
4:54, 68's for first set.
5:19 (ow), 68, 67, 65, 64 for second set.

tot: 60 miles, 428 minutes

Una Selva Oscura

Tuesday, February 1, 2011
Running hasn't been the most wonderful thing in the world for me the past month - after recovering from being sick for a week starting around Dec 24th (then going to Quebec City with Sarah and enjoying the living fuck out of it...) I got nailed again two weeks ago with the flu. I was finishing up a pretty decent workout on January 14th and the last two reps or so I noticed that my muscles were aching pretty hardcore. Then I realized that they were ones that have nothing to do with running at all - lower back, neck, shoulders - the places that typically indicate that my immune system is losing both the battle and the war. I crawled into bed and emerged 7 days later and 10 pounds lighter.

Just this past week I felt like I was actually myself again when running, but despite that I did not have stunning success at the Terrier Invite this past Saturday. Running 9:12 or so for 3k wasn't really what I'd hoped for, and I'd be less annoyed by it if it wasn't an indication that I probably will not be able to give the Elder Statesman Jeffpa a good race. The wheel will turn, though, and my legs will stop complaining and do what I want again - just maybe not by the time he'll be retired. If I cannot give him a good race, I will at the very least buy him a good beer.

I'll have some real running numbers again beginning this week - I'm kind of pretending January didn't happen, or at least trying to hit the reset button. It wasn't godawful (150ish miles - which was standard for me in college) but it's certainly not what I want to be doing.

As running hopefully begins to fall into place again, other things fall out. That just seems to be the way the world works. On Thursday when I went to go blast my car out of the snow and head to work I noticed as I walked up that...oh hey...the bumper is kinda hanging off. Hmm. That wasn't like that before. Wonder if they left a note? Nope.

I'm a little conflicted about how angry that makes me. I have no interest in being a person whose entire self-worth and happiness is caught up in their possessions - but damnit I really love that car. There's not a day when I don't feel like driving it, and the experience of being on point, focused, and ...tuned in, let's say, to the feeling of the car, it's just not comparable to anything I know. It's similar to a track race...less noise in your head, and the howling of all your nerves, of course. More cerebral skill than brute willpower. Squealing tires and screaming engines versus on-fire muscles and pounding blood.

I've been dinking around with No Way But Down a little bit since I last updated it and I'm running into a few stylistic / programming problems. One of the primary quandaries I'm running into is how to deal with the control flow.

In the old days (for me, at least) of BASIC control flow is a really simple concept. Reading what would happen next in a program was a matter of going down the page according to line numbers:


10 INPUT "What is your name: ", U$
20 PRINT "Hello "; U$
30 INPUT "How many stars do you want: ", N
40 S$ = ""
50 FOR I = 1 TO N
60 S$ = S$ + "*"
70 NEXT I
80 PRINT S$
90 INPUT "Do you want more stars? ", A$
100 IF LEN(A$) = 0 THEN GOTO 90
110 A$ = LEFT$(A$, 1)
120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
130 PRINT "Goodbye "; U$
140 END

This is straight from Wikipedia's page on BASIC. Some of the keywords may not make a ton of sense, but the basic gist is: read from top to bottom, and wherever there's a GOTO ## the program is jumping to that line number. 


In object-oriented languages, you can still program this way. The only problem is that things get...messy when your programs get complicated. Writing a roguelike game is a pretty straightforward enterprise (at least in terms of algorithms and whatnot - I don't have to reticulate any splines) but it's not brief by any measure. 

In the pseudo-est of pseudocode, here's the control flow for No Way But Down:



* Wait for keyboard / virtual keyboard input
* Determine what state the game is in
* Process input according to game state (d key does different things if you're viewing your inventory as opposed to looking at the dungeon map...)
* Update the world
* Re-draw the world



The problem that has arisen is that there are probably 20 or 30 different 'game states' that all should process keyboard input and draw to the screen differently. I had figured something like this might happen, but hadn't designed for it, so I ended up with code like this...






else if(GameState.Inventory == GameState.InventoryMode.CARRIED) 
{
 if(unicodeChar == 10) 
 { 
    GameState.Inventory = GameState.InventoryMode.OFF; 
    GameState.InventoryOffset = 0; 
    updateWorld = false; 
 }
}




Consider briefly that the enum GameState has about 10 values right now, and that there are an awful lot of Unicode characters, and you can see my problem. Keeping a long list of else if's just ain't gonna work, especially when the string you're constructing to display is modified based on what GameState you're in.






What I'd like to do (and am currently attempting to implement in fits and starts) is mimicking the stack-based approach of Activities in the Android OS. I'm creating a static singleton class, DisplayStack, which I can push and pop objects called GameScreens onto and off of. Each GameScreen will have input handling logic - and return the display string for its particular screen. The DisplayStack will merely pass the character codes for input to the topmost GameScreen. Some characters may cause the topmost GameScreen to change (closing the inventory, for example, or opening it) by either pushing a new GameScreen or popping the current one. 



It might take a few days, and the code changes will be completely unnoticeable to anyone playing the game, but it does mean I'll be able to add new ideas quicker. Right now the notion of adding a dialogue screen is just really painful to contemplate given all the potential switches for each character I'd have to do. 





I just realized I could probably forego my own implementation and just make each GameScreen into an Activity...but honestly that feels a little heavyweight to me. It does mean I could use a different XML layout for each GameScreen...hmmm! I probably won't go this route but its nice that just writing about it gives me some ideas. Plus this is the first time I'll actually be writing a stack...ever. Might as well, ya know?






I've been listening to WGBH on the way home from work (and sometimes to it) recently and paying some attention to the Tunisian revolts giving way slowly to the Egyptian protests. I'm sure that Iraq and Afghanistan are not exactly the models of democracy that Tunisia and Egypt are looking towards and longing for, but I am curious if their presence in the region has had any effect. It would be weird to have the idea of infectious democracy espoused by the Bush administration to actually have some merit. The utilitarian in me actually questions whether the Iraq and Afghanistan wars were actually more worthwhile if that's so. It's very clear that the Egyptian and Tunisian people have been suffering - you don't get thousands and thousands of angry people in the streets by treating them well. 

I doubt it's anything quite that direct, if at all, and there's no guarantee that Egypt and Tunisia will emerge from the tumult any better for the chaos, but...something very good could happen in time. If working with people from China, India, Georgia (country! not state, though they're pretty far out too...), Haiti, etc - has taught me anything, its that the world's population is one big mongrel of fairly similar ideas and rockin' fellows. Or maybe just the engineers from those countries. Except the engineers who like Objective C and Perl...and whoever the dude was who hit my car. He's excluded from my world-party.


Just so we're clear, so are the Blogger formatting tools. Argh! Annoying to no end. That's why the second half of this post looks gimpy, but I am too lazy to fruit with it any longer. I bet the guy who designed it is named Duane.

No Way But Down

Sunday, January 16, 2011
My job at Iron Mountain's been quite good to me, and has a lot of variety, which is nice for two reasons: one, I very rarely get bored with what I have to do. Two: the variety of things I end up doing mean I learn a lot. I was probably an average programmer (with a non-average amount of 3D graphics / real-time rendering experience) when I joined the company, and just looking at what I'm writing today - I'm a lot farther beyond where I was in 2008, both with respect to what I know and how I apply it.

I've actually gotten the opportunity to do some programming for mobile devices in the past couple of months, which has been fun. It's one of the reasons I actually bought an Android-based phone - I had in the back of my mind that I would eventually start programming something for it, and the things I'm doing at work (which I don't think I'm quite at liberty to talk much about) finally got me started on working on something. The project I am working on for work is IPad-based, so it's actually nice to change gears a little bit and use Java. I'm not nearly as good with it as I am with C# or C++, so yet again, doing this is actually helping my career.

And hell, I'm writing a videogame - so it's fun, too.

I looked around at what games are currently available on Android-based phones, and it's a lot of...throw a basketball, tilt-a-phone platformers, side-scrolling or top-down shooting games. I won't rag on any of those, because some of them are actually pretty good. For example, I bought Radiant the other day, and it reminds me in all the good ways of Tyrian 2000 and Inner Space, some of my favorite games from the PC when I was oh...ten or so. That kind of game takes a decent amount of art, commercial 'slickness,' and some fairly rigorous programming of a sort I'm not really prepared to tackle at the moment. I know how to do it, it's just not very fun. You end up reinventing a lot of the same nonsense that people have been doing over and over again for the past thirty years: does the laser gun thingy you're shooting intersect the enemy? have you run into the wall? are you properly layering your models so that you only have to draw the topmost layer? Very basic questions of collision detection which I just can't bring myself to care about anymore.

I decided, therefore, to make my life easier and write something simpler and a little less common: a roguelike RPG. Roguelikes are so named because of the original: Rogue. They're supposed to be tough-as-nails D&D-style games with a lot of dungeon crawling and the endlessly entertaining 'feature' that if you die once, that's it. No saved games. Start over from scratch. They're also almost always text-based, thus saving me (and anyone who plays it) from enduring my godawful attempts at art. That also means I can spend all my time actually programming the game to have fun things in it, rather than 'perfecting' some 2d sprite.

I can also shove it full of literary references and Borgesian magical realism, and I plan to do just that. The game's called "No Way But Down," as a kind of half-reference to Dante and half-instruction manual.

I've always been really into the idea of randomly being able to generate a level of a videogame that is fun to play, rather than spend the time individually detailing where each wall goes. That's part of what I've done so far, but I want to mess with the concept a little bit.

Right now, every level is up to the whim of a random number generator. It's represented by a set of characters that are 13 high and 60 wide. I pluck a random number of walls, random number of monsters, random number of items, and scatter them around the level - as well as a random location for the stairs down.
That's well and fine, but it's only so interesting.

Part of what I want to add is the ability to, on a random chance, add a 'set piece' to a level. One of the games I'm drawing a lot of influence from, ADOM, does this pretty well. There are levels that have rivers running through them, ones with coliseum-style arenas, graveyards, libraries, and one full of quickly-reproducing killer rabbits. Some are just part of the rest of a randomly generated level, and some are entirely predetermined and the same every time. In ADOM, certain numeric levels in a dungeon are guaranteed to be something - I think Level 4 of the Caverns of Chaos (yea...I've played this game a lot...) is always the Arena, and maybe 12 is the Dwarven Village. It's important for ADOM to have this ordering because there are prerequisites to enter some of the later levels, and a storyline that the creator wants you to encounter in a linear order.

I want to try and take that and twist it around a little bit. If I can design a game that has predetermined elements (whole levels, or parts of levels, or characters or items or bits of a story) that has no definite location or even guarantee of ever showing up, it'll make the game (for me at least) able to surprise me even as the writer of it. Clearly you'd have to write compelling 'parts' and still have a definitive 'end' so that there is a reason to play through it all. You'd also want the world to reflect how the character acts within it - what appears or occurs should have something to do with how the player chooses to act, else there's not much investment in the whole process of playing it.

Basically, I want to write a video game that you can play through and only maybe encounter 10-15% of the possibilities within it if you head straight for the goal line, but you choose to stick around because it's good. Or maybe replay it.

We'll see if I get there.