Monday 1 July 2013

Crafting Tools

No, this isn't a post about Minecraft. I just liked the sound of the title. This is about coding. I could be wrong, but I often get the feeling people underestimate the value of programming. It's not just for making games or programs for other people. It's not even about making full-fledged programs at all. I write code for everything. Little scripts let me use my time more efficiently and ignore the things I don't care about. They're fun, short projects that can sometimes be very interesting challenges. They're also usually easy to finish and the end product is always worthwhile.

Aggregators

My most-used script looks like a simple web-page with a bunch of boxes on it that each contain text. What's special about it is that it draws articles from every website I used to frequent, filtering out the ones I know I won't be interested in and marking the ones I haven't seen yet. It also grabs tweets from my favourite twitter feeds and posts from my favourite forums. In addition, it uses YouTube's RSS feature to get the latest videos from my favourite YouTube users. Everything I used to browse the Internet for, wasting time and bandwidth, is now in one place. That's not to say I don't find new and interesting things, because I do. I added a couple of sites that I never used to read that often, and now I can skim their articles without having to wade through their sites. It's really convenient and I use this page every single day.

I had an early version that used AJAX to refresh parts of the page separately, but considering I usually refreshed the entire page at once, I removed that feature. The current version uses PHP with cURL to grab data from RSS feeds and HTML sources. It takes a few seconds (and it's longer now that Twitter has removed its RSS support), but it's not too terrible. It was very easy to make.

To anyone concerned that by not visiting sites, I'm throwing off statistics and avoiding the ads that support those websites, know that I do actually visit the sites. The aggregator page only shows RSS summaries for the articles. I still visit the sites to view any articles that grab my attention.

Desktop Software

While I've used a wide variety of languages, I really love using PHP. The problem? Browsers limit access to the user's computer. I recently got an old program called WinBinder (made for older versions of Windows, but it works perfectly in Windows 7). By executing PHP files through WinBinder, I can run my programs without a browser and can access files on my computer through code. I used this to make something similar to my website aggregator which, in this case, lets me open any games, files, programs or folders that I use often. I set it to run at startup and now I don't have to use large numbers of shortcuts or navigate through the folders on my computer very often. It's pretty useful.

Other Tools

As I said, I really like PHP, so I use it for everything.
  • I wrote a script to simplify the creation of invoices for my programming contract work.
  • I wrote a page for keeping score in a trivia game with a Trivial Pursuit book we have. My friends and I just navigate to the IP of my Apache server on our phones/iPods and it keeps track of how many points we have in each Trivial Pursuit category, skipping over ones that we've already gotten the preset number of points in. It randomly spits out a page number for the current category so we can get random questions from the book.
  • I made a small script that read ID3 tags from my music library. I wanted to use it instead of iTunes because I could integrate it into my aggregator, but I didn't do much with it in the end.
  • I made a page that read my video library and let me stream videos from my computer in a browser so that I could avoid the need for a video-streaming app


Libraries

There are so many options. Practically anything you do on a computer can be done more easily if you feel like making a tool for it. As far as PHP goes, there are libraries for so many things. You can convert video and audio files or read ID3 tags, for example. With basic PHP, you can automate downloads, grab links from websites, grab RSS feeds, etc. If you throw JavaScript into the mix, you can do all of this with AJAX. Use something like WinBinder and you suddenly have access to batch files that can work with the file system on your computer.

Final Words

Tools don't have to be released to the public (although that's always nice). Sometimes they're worth producing just to make life a bit easier and learn something in the process. I can't put much of what I've made into a portfolio, because it's all too customized and certain things seem to be blocked by web hosts, but I'm still glad I worked on all these projects. Every project is a chance to learn and grow as a programmer while also having some fun.

Saturday 23 June 2012

HTML5 - 2D Game Graphics I

Recently, I started working with HTML5 a bit more. I'd used the canvas and audio elements months ago, but quickly went back to Game Maker after that. As I work with it more these days, I'm finding it incredibly easy to use for game design. I think I'd recommend it to anyone who wants to get some experience making 2D games. I don't know if it's the greatest medium for things like advanced lighting, but it's great otherwise.

You don't even have to stick to 2D games. Check out the official Wolfenstein remake: www.wolfenstein.com. As a ray caster, it's not technically "3D", but it's certainly not a 2D platformer. You can do actual 3D as well, but that requires extra APIs that seem to be browser specific as far as I've seen.

Anyway, on to what I want to talk about. I'm starting with canvases, since they seem to be the most basic part of an HTML5 game. This is assuming that you already have an understanding of HTML and JavaScript.

Friday 8 June 2012

Movement "Helpers"

The topic today is "helpers". I'm not talking about allied NPCs, but about code that helps the player play the game more easily. Auto-aim is at the extreme end of this category, but I generally stick to helpers that improve the player's ease-of-movement.

When you run sideways and there's a person-sized hole in the ground, what should happen? I tend to think that you should run over it. After all, a real human being will not simply drop through a hole just because it happens to be in the way. Then we have to ask, what if the player wants to fall through the hole?


Saturday 2 June 2012

Ground Rules

It looks like it's time for my first tech post. Today, I'll be talking about how I like to set up random/procedural worlds for endless-world games, such as We Want YOU and its upcoming sequel, They Want ME.

The goal of map generation in WWY was to make every area look unique and random, while still always having an available path. We don't want people getting stuck in pits and having to restart the level.

In WWY, the system wasn't perfect. People could, in fact, get stuck in pits once in a while. We ended up adding the C4 item for this reason. It wasn't a weapon and it took too long to explode for it to be "fun" to use often. Its purpose was to get players out of otherwise inescapable situations.

TWM uses an altered version of the same system, which removes those inescapable situations from the game and allows the player to move upward, whereas WWY always had the player move downward.