Showing posts with label video games. Show all posts
Showing posts with label video games. Show all posts

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.

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.

On Being A Giant Robot

Thursday, January 28, 2010
For most of college, I was pretty sure as soon as I popped out and put on my graduation cap and drove off into the sunset, I would immediately start working at a video game design studio. It's what I wanted to do since before high school, it's what I took all my electives in and spent a lot of my free time on (that which was not spent on track meets or music). It didn't really turn out that way - the game industry is notoriously competitive to get into, and the economy was not exactly at its best when I started shoving job applications out the door. (I do admit I started a bit late - my senior year was a little chaotic)

Still, I really love the damn things. One of my favorites of all time - Mechwarrior 2 - involves you stomping around on various planets piloting a giant robot warrior, as part of some space-faring feudal caste society that led an exodus from Earth when space travel was first becoming commonplace. Sadly, it's a videogame made in the mid 90's, and the successive sequels to the franchise have just gone downhill. Some bunch of yayhoos, however, undertook the rather massive task of creating an entire new Mechwarrior (as a modification of an existing game engine) and releasing it for free, and hot buttered lugnuts, it is exactly what I have wanted for quite some time.

Sadly, the website is actually overloaded (they exceeded their bandwidth! how about that for a success story) but I shall link to it all the same: http://www.mechlivinglegends.net. The game runs as a full modification for Crysis, so if you don't have it, it's probably worth buying for this alone.

I also recently blew through a new book that had the first pages featured on the NYTimes about a week ago - its release sadly coinciding with one of the deaths of the men it followed. The book, "Last Train From Hiroshima," covers the events that dogged 9 particular men and women who were present at both the Hiroshima and Nagasaki bombings (and survived them). The man who recently passed away was Tsutomi Yamaguchi: http://www.nytimes.com/2010/01/07/world/asia/07yamaguchi.html.

James Cameron also has evidently optioned the movie rights to it - I am not sure how that would work, considering a great deal of the book is grisly, physics-centric descriptions of how easily nuclear weapons snuff out human life. Here's the news release concerning the movie and the preview of the book that inspired me to buy it.

I've also been doing a little bit of that "running" thing - had a kind-of-not-the-best-last-week last week, with what I will fancifully call "faux-bronchitis" dogging me at every step, and a mile race that was the slowest I've run in 3 and a half years. Ew. Mostly I think that was a case of just mentally not being in it - which, for me, is not such a big obstacle to overcome as not-being-in-shape. The Terrier Invite is this weekend and I'm in the 800 - hoping to see a PR. I'm not positive about that but I think I'm in the right kind of shape. This week has also gone significantly better in terms of running - the cough has basically cleared up and I am not constantly popping pills to stave off muscle aches / slight fever. I would like to take whoever gifted me with this drastically inferior immune system and put them to the question.

Tonight was especially entertaining for running - sometime between when I returned home from work and when I left to run (about a 20 minute span!) two inches of snow just dropped like a lead weight from the sky. I did my usual thing around the Cleveland Res and was greeted by comically intense wind blasts on the eastern side of it. With the full moon, though, it makes a pretty stunning visual - especially combined with the orange light from the street lights and the snow whirling in bizarre eddies from the wind whipping behind you.

I think that's all the verbage I have in me tonight.