26 June 2016

Beginning Website Updates

I've had a personal website for a while now, but I haven't really done much with it -- mostly just placeholder pages for where I'd eventually put projects. But that's not much drive to get any actual content.

I think the main thing holding me back was just layout and design that I'd never been too happy with. I knew some tricks, but unless I was working with a design team on the job then I didn't feel capable of doing those sorts of things myself.

Important Side Note!

Trevor has a new job! (well, new as of three weeks ago. I don't want to make promises, but I should be updating this blog more recently) It's primarily front-end web development, and it's a very different atmosphere than I've been used to. It's also my first experience with Responsive web design, so styles changing as the browser window shrinks. They aren't using things like bootstrap, either -- it's just straight css @media queries.

Anyway, that was allowing me to pick up on new concepts really quickly and really boost my confidence with wanting to build up my personal website again.


Redesign

Hey, it's blog posts from here!
Since I don't really have images to put on my blog, I'm trying to keep with a 'simple is better' approach now. Just a few different styles for the text and only a few colors. Blue is probably overdone (Facebook, Twitter... probably others), but it's my favorite.

Also, instead of placeholder pages, I'm just showing the pages that are functional. In the future, this won't necessarily mean 'functionally complete,' but it means there will have to be more than 'this page will contain something in the future' to be visible.

Honestly really liking it so far, though I'll want to be updating the navigation soon -- it's the only thing I'm iffy about. Plus, it's not really scale-able.


Front-End Sample

Pretty tiny and clean
The homepage is laid out the same, except it's just a title and a few paragraph blocks. I just have a header file that I can inject into the page, so I don't need to duplicate any of the code appearing across multiple pages. The div 'blog-entries' is just a placeholder div for the javascript logic, so it has a place to add the blog entries pulled.


Back-End Sample

blog.js contents
And there we go. When the page initializes, this tiny function just makes an ajax request to a feed service. I'm just getting back some basic RSS data from my blog here -- it doesn't really even include sample text (though I'm sure this is possible if I tweak the RSS settings or something -- the properties are there in the return, but they just didn't have any data in them).

No big problem, though. I loop through the results and add a link to each blog post on the page -- including the title of the post and the published date. Since it's RSS, the results are in order from latest to earliest. At least for now, I'm also only pulling the latest 10 entries, which is just fine.


To the Future!

I have a few different ideas floating around for what I'd like to add to my website. The next project is a bit daunting, so it may take a bit of time before it appears live, but I'll be trying to tackle some blog posts as the process moves forward.

And so it begins...

17 May 2015

Quick Thoughts on RNG - Part I

My desktop has been out of commission (or at least making unusual noises that spawn distrust in its use), so I've wanted to tackle some smaller logical problems on my laptop while I await replacement parts. One of my serious side projects involves a portion with randomly-generated content. It's something I haven't actually gotten around to yet more out of RNG reluctance than lack of time.

The Thought on My Mind


"Does the default "Random" behavior of a language such as C# give enough random for use in a game engine?"

Honestly, this is more ingrained as a "problem" from looking into the concept of random, and how we can only simulate random. My first assessment is really just to see how "Random" the default C# RNG is.


Quick Sample


So I created a program to enter a max number (so 6 would give a random number between 1-6) and the number of times to roll a random number. If I just output the results, they don't always look that promising:

Max number: 10. Rolled 100 times.

Look at that cluster of 10s! If I were actually rolling a d10, that would seem pretty unusual.


On the Other Hand...


Now if I output both the Individual Results and Distribution of those results, it looks a bit different:

Much better when you can see Distribution.

Ignore the 6 milliseconds taken -- I was curious to see if it would take any time to generate more random numbers, but it seems the only reason it adds time is outputting the results.


In Closing


I suppose it's difficult to tell on a quick pass whether the default RNG is useful. Depending on what, specifically, you're using it for, then sure. The distribution in the long run is actually not terrible. It's just in a short window of time where it doesn't look so good.

For practical purposes, you'll probably be using a RNG with weighted results rather than a straight 1-to-1 distribution (if you're calculating loot in a game, for instance, then a "Common" drop would ideally count for 50%+ of the total possible random numbers rolled). That could have more of an impact on results, but that will also take more thoughts and testing than this quick run-through.

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.

02 March 2013

Level Editor-ing

I had a bit of a falling out with the side project from work-related weirdness that gave me a temporary lack of motivation in all respects, but this has blown over. It does go to show that there are many reasons to lose motivation that go beyond simple procrastination. However, I have had a stronger desire to see this through, and I feel I have more determination and trust in my own abilities than, say, a year ago. I'd like to say that procrastination alone isn't really an issue at my current mental state.

Since the last post, I have made some substantial code cleanup changes, and I'm better accounting for multiple controller inputs. I seem to be moving forward with a brute force, "get this new mechanic to work" method and stopping after it works to do code cleanup. I have no reason to not continue with this method, as it gives an appearance of small spurts of quick advancement. The code cleanup is really for organization and making certain it's easier to manipulate what's there if I need to make changes -- also makes it more readable for the future if I need to step back into sections I haven't touched in a while...

I have a placeholder now for a Level Select screen, but I'm actually bypassing how a level is selected at this point -- I'm just jumping into gameplay logic for now. The first thing I need for gameplay is actual level content. The typical scenario for a sidescroller is some tile-based level editing, so here I've done some reinventing of the wheel with a level editor tool:

Click the tile from the tileset and just click in the level grid to add the tile
Pretty straightforward. My current focus is just on a 1280x720 screen resolution, and I'm not yet worrying about scroll capabilities. I haven't yet added the ability to save this, actually, but it will probably just be an XML file, since those can be thrown in the XNA game's content as something that will presumably be hidden in the final version of the game (though perhaps I should leave some options open for players to generate their own levels with this tool, too).

The only other thing to really save with tile placement in the level editor will be the behavior each specific tile will have for players and enemies:

- Can be stood upon
- Is in the foreground and players/enemies will walk behind this tile
- Is impassable
- Can be passed from beneath, but will not fall through from the top (floating platforms, essentially)
- Etc. (Just keep an open mind for different tile types as I need them)

I may just focus on getting the level content I have to be imported by my game before implementing the tile types, though. One step at a time.