22 September 2014

GRamer Society Episode 2: Behind the Episode

This time around had a lot more programming involved. And I even made 2 games for it. Here's the video:



Light Switch


For the previous episode, I made my life easier by rushing with C# .NET. This time around, I chose Processing. It's a language wrapped around Java that makes it easy to do visual things. The only trick to this "game" was with the images -- I used Photoshop to create a 'switchOn_img' and 'switchOff_img.'

The meat of the game
With Processing, draw is a function reserved to be a loop. I specify 'noLoop' at the end of the draw function so I don't have to handle frame-rate or the fact that it would call draw whenever it can. I use the default mouseReleased function to trigger a change of game state and manually call 'loop' again, so it will trigger a redraw.

Deathsweeper


What can I say about Deathsweeper? It's a bit more complicated than its predecessor. I actually spent most of a Friday night and Saturday morning programming this one. There are 3 game states -- I called them TILE, REVEAL, and GAMEOVER. I treat the draw and mouseReleased functions differently based on which state it's in.

TILE draw function -- all of the squares!
Yes, yes -- absolute positioning and all. Bite me for bad practices.

TILE mouseReleased function - which tile did you click?
That's... awkward-looking, isn't it? Loop through the x-coordinates of the squares and compare with the mouseX position. If it's within range, do the same for the y-coordinates.

REVEAL draw function -- should be straightforward
revealedFile is the name of the text file that has the scenario's text (without the extension).
revealedText is the scenario's text (the content within the text file).
goodResult is my boolean for whether it was a good or bad result.

REVEAL mouseReleased function - state is success or fail

The REVEAL state's mouseReleased event only moves back to the TILE state or forward to GAMEOVER.

GAMEOVER mouseReleased - Exit or re-initialize the game!
The GAMEOVER draw function should be pretty self-explanatory -- just text and a rectangle. The mouseReleased checks if you click in the rectangle to exit, or it starts the game over.

Now, the tricky part of the game was loading the success/failure states.

Find all the files!
I find all the files within the failures/successes folders and pull their file names. Then, each tile will be either a success or failure. What a tile is gets loaded as part of the initialize step:

Randomize good/bad, and choose a random good/bad result in getRandomFile
When the state gets changed to REVEAL, that's when the content of a success/failure is loaded:

Pull the text from that file for the REVEAL draw function
That's... just about it. I'd also made my own Tile class to store whether a tile is a good/bad result, the file name of it's revealed scenario, and whether the tile has already been revealed.

My main regret here? That Processing doesn't do Enums. It felt cheap to use a String to store the current game state -- technically could have stored it as a number, but I'm not yet at a stage where performance is an issue.

The logic for making the scenarios dynamic was actually quite fun. All things considered, it's interesting to think that I created 16 scenarios for the game when the video showcased very little.

GRamer Society Episode 1: Behind the Episode

So I began a silly YouTube project. I'm making ridiculous/stupid games and pretending to submit them to a fictional society. Because my fictional persona wants to join the elite of the game designers. Here's the first episode:



I was able to whip out the code for "Live or Die?" in just a few minutes. It may be a little simplistic, but for this project it may be a good thing.

The meat of the program
Straightforward and simple. I'd enjoy getting into much more complex games, but for the sake of free time it's more difficult. And this way I can play advancement off as character development until these warm-up games help boost my confidence for more complex ideas.

07 August 2014

Flash Forward 10 years: A Dishonorable Opinion, But That's Just Fine

While trimming and washing up, I had one of those "shower thoughts" moments. You know when you weren't even a teenager yet, and on rare occasion you had to answer the age-old question: "Where do you see yourself in 10 years?" Well, I couldn't help but ponder the reverse.

It's silly to have to answer that question anyway, especially by those poor souls who dreamed of being President before taking a government class to know what that means. Even if they retained their dream of becoming President some day, it's a sad realization that they'd have to wait around 17 years after high school to accomplish their goal.

I never knew how to answer that sort of question -- especially when I wasn't even 10-years old yet. A lot happened that I can remember in my first 10 years, and I couldn't possibly have predicted where I'd be when I was 20. Even so, 10 years ago from now I at least had some ideas of intent.

I've always enjoyed video games since I first started playing them. When I was 16, I imagine I still had the dream of working for a big game company and working on the latest AAA titles. Also the dream of working on the side as an author and being a hit who makes it rich. Basically, doing my day job pro bono because I love it, but doing my hobby on the side to give me more than enough income to buy and do whatever I want.

What do I do now? I'm not a programmer or an author. Sure, in college I had a brief job as an SEO writer, but none of my published work has my name on it. I also had several jobs as a programmer -- and even went to college for programming! -- but none of those jobs were in the gaming field. I'd say as far as dreams go, my 16-year old self would be ashamed to look at a snapshot of who I am today.

But I think my 16-year old self would be wrong to judge so poorly.

Out of my two dreams, I chose to go to college for game programming over writing; I didn't want to go to college to be told how to write. Maybe debt swayed my decision, or maybe it was the uncertainty of workplace stability, but I'd devolved my major halfway through to the broader topic of Software Engineering. There was nothing wrong with that, as I'd certainly found enjoyment out of programming in general.

After college, I worked a few programming jobs. Skimming over the details, they always seemed fun "in the beginning" but eventually devolved into a chore. It was too much of the same, and I felt as though I was sacrificing my sanity for my work stability. When you start to receive a task and are already saying in your head "oh yeah, I know exactly what function this problem occurs in" before you've heard/read all of that task, you've hit a wall where you have no desire to continue working on a product anymore -- it's just too boring, and you spend all your day-to-day energy fighting to get yourself to care.

As for writing? It's almost pathetic to pretend that I write at all. I have a lot of ideas and play scenarios in my head around the same characters, but how could I have thought I'd have time for writing so much with a full-time job? With friends? While trying to retain any sort of social life? Don't get me wrong -- I still love the idea! -- but most times I try to set aside time to write something are spent staring at a blank Word document and counting how many times the cursor flashes in a minute.

There are other issues with the types of jobs I wanted, but this conversation could go on and on. The bottom line: dreams change. Sometimes this is driven by new information, and other times it's a result of changes of heart, compromise, or realizing what really matters.

Someday, I do want to be an author. I'd also love to make my own games. But the dream has taken vastly different directions that are almost more unreasonable. Maybe striving for the impossible is fun.

Besides, 16-year old me didn't understand love. And I probably wouldn't have found my handsome without making all the decisions I've made.

There's still time. I'm enjoying what I'm doing now, and sometime there will be time for my true dreams. Maybe around the time I could hit the age requirement to become President.

26 January 2014

Adventures in Music Organization, Part I

Our story begins with a hard drive failure. This may have been a while ago, and most of my things were backed up. However, my ongoing grudge has been with my music collection.

I had an iPod with all my music intact, which you'd think would be a saving grace, but...

Thank you iPod naming conventions!
...it may have destroyed any semblance of logical structure to its folder and file naming scheme.

It's not even grouped with similar artists/albums together.
Now, if I pointed iTunes to my entire music collection, then it's all fine. In fact, I believe even Windows Media Player can open them just fine, and the song titles, albums, artists, date of conception, etc. are all intact. It's just the folders and file names that are borked.

You could just say "deal with it" since it no longer matters when music players can read all the tags and whatnot, and I did. Until the onset of games that use your music collection.

Although I have done a good job without organization. Beat Hazard, yeah!
Beat Hazard in particular uses the file names until you highlight a song. Then it starts to load it and updates the name to match the title. This is tedious. I enjoy tedious tasks sometimes, but not here.

Want to play a specific song? Good luck.
I'm sure there are music organizing programs already in existence, but I'm a programmer, and I want to be stubborn about this problem. After all, it's my problem and I want to solve it. It sounds conceptually simple, right?

If I want to do this quick, I'll start with C#, since I can just drag a couple buttons around. It only takes a few minutes to come up with this:

All music files are pulled, so... now what?
However, I've never tried to pull metadata from a file before. I was guessing there might be something in FileInfo to do it, but apparently there isn't. So how do I get this?

As my searching found out, music files have something called an ID3 Tag. Unless I chose to create a Windows 8 App, C# doesn't appear to have a built-in solution for reading these tags. I don't wish to go the Windows 8 route, so a solution to this problem is going to be more involved than I was expecting.