Wednesday, December 31, 2008

I'm back!

Well, so much for that plan. I completely fell off the wagon and abandoned my blog a couple days after I promised more content. However, the good news is that nobody reads my blog anyway, so I didn't disappoint anybody.

Now, for another empty promise nobody will ever read: from now on, I will try to remember to write a post on my blog every other day and write two tweets a day. You can find my Twitter feed here, just in case you're a spam bot looking for a random Twitter feed to follow.

Wednesday, December 17, 2008

Leave the physics to me!

I'm finally "done" with my AS3 game engine now. It doesn't play music, support sound effects, or use character animation at all (okay, maybe a little), but it doesn't try to. I'll give you an example of how it would work.

First, you'd have to download the file. Then, you alter the levels.xml file with to point to the levels' background images and ground profiles. You add the enemies with the <enemy /> tag, the player controlled character with the <fighter /> tag, and the goal with the <goal /> tag. You can alter the position of the fighter, the goal, and the enemies and change the background image and layout of the level without even recompiling the code.

To add a character, you do have to start up flash, but you don't have to do any real coding. Simply make a class for your character in the com.flashgames.bunnyhopper file, set the max speed, jump height, and acceleration through simple variables, and associate the class with a library object. Now, you can add your character to the level by simply altering the levels.xml file.

It's not the most sophisticated game engine, or the most open-ended, but anybody (with flash) can easily reshape the game with a little HTML understanding and little-to-no programming knowledge. Let's see you do that with APE or Box2D!

Play a quick demo or download the source.

Tuesday, December 16, 2008

New Plan

I apologize to anybody who has attempted to follow this blog. I have been very indifferent toward blog writing for the last couple of weeks, so there hasn't been any new content for quite some time.

However, I have now set myself some arbitrary goals for blog writing and twittering. I will try to remember to write at least one blog post every other day and two tweets per day. I want to rely on more than just the Kirupa forum to establish my reputation.

And now, the excuse. Unfortunately, I'm about to travel to Louisiana to visit my family over Christmas, so I'll be unlikely to hit my goal over for about two weeks. I'll still try, but I can't make any promises.

Tomorrow, I'll be writing about my XML-backed AS3 game engine. You may or may not want to miss it, depending on whether you're interested in that sort of thing. It's your choice.

Sunday, September 7, 2008

Uber-cheap web design

When I say uber, you know it's serious. I may not be a world-class web designer (yet), but I may have found the cheapest and quickest way to learn the languages of the web and put up a website. Enjoy!

Okay, let's set the scene. You're the benevolent ruler of a tiny European country, when your despotic uncle stages a coup and overthrows your glorious government. You are forced to flee the country for the distant shores of America. You know the language and you know how to use a computer, but you don't have any credible job experience ("Riiiiggghhtt, you once ruled a country, so you're qualified for a management position. NEXT!!"). You decide to ride the internet wave, but don't think you have the cash or the skills to start a web design company. Not to worry, you have this list!

Step 1: Learn XHTML and CSS

The first thing your majesty needs to know is that there is a right and a wrong way to create websites. If you do it the right way, it will mean less work, more job offers, and tons of cash. If you do it the wrong way, it will mean time-consuming projects, bad-looking websites, and, eventually, the total failure of all your websites. If you try to learn web design with online tutorials and resources, you are pretty likely to learn web design the wrong way. I recommend you learn web design the right way with the very nice book, HTML, XHTML, and CSS, Sixth Edition: Visual QuickStart Guide. It is relatively easy to read and understand, and its tons of pictures and examples make the somewhat dry subject matter downright fun to read, in my opinion.

Buy it here: HTML, XHTML, and CSS, Sixth Edition (Visual Quickstart Guide)

Step 2: Build a website cheap

If you have time to learn and money to burn, Dreamweaver is supposedly as good as web design software gets, nowadays. However, you can make sites every bit as impressive with a few pieces of free, downloadable software.

First, to code the actual HTML, you'll need a text editor. If you're bound to the system standard software, you can use Microsoft Notepad, a stout little editor that will get the job done. Of course, if you plan to do any serious coding, I highly recommend getting a more versatile text editor, such as Notepad2. Notepad2 is a free text editor with convenient syntax highlighting for several common languages, such as XHTML and CSS. It is a must for any serious manual website construction.

You'll also need some free image-editing software, because if your website doesn't have pictures or graphics of some kind, it's not really a website. Here, you have two great options. If you have some time to learn and you need the most powerful free image editor, try out GIMP. It's got a wicked learning curve, but it can do almost everything Photoshop can do. If you want something familiar yet capable, try out Paint.net, another free editor. It doesn't quite have the features of GIMP, but it is way more intuitive. Remember, this is Paint.net, not Microsoft Paint. MS Paint is only good for making grainy graphics in outdated file formats.

You can find GIMP plus tons of tutorials here, and you can get Paint.net here.

Step 3: Show the world your genius (or not)

Now comes the part where you have to spend money, but not much. I have heard of places that offer you 'free' domain names and web hosting, but I have never personally found a legitimate one. Registering a domain name costs somebody money, period. However, it doesn't have to cost much, as I think I've found the single cheapest domain names on the internet. Netfirms.com practically gives away domain names for $5.95 for the first year, last time I checked. This price simply cannot be beaten, as long as you won't need customer service or bulk-buying tools. Don't be fooled by their free hosting service, however; they place big ugly banner ads across the top of all free-hosted websites, and you simply don't want that.

You can find truly free hosting services a few places, and my personal favorite is FreeHostia.com. According to my [free] website monitoring service, I get about 99.9% uptime for no money at all. The downside is that you can only host two sites per account, and you'll need to work with the DNS system to hook it up to your domain name. It's certainly not one-stop shopping.

You will find Netfirms here, and Freehostia here.

Step 4: Maintain your site

No good web designer simply puts up a site and leaves it at that; the web is all about change and newness. You'll need some way to change your site once you've got it online, and Freehostia's website tools simply don't cut the mustard. Enter Filezilla, the free, open-source FTP client with some very convenient features. For example, when you open Filezilla, you're only two clicks away from all of your websites. Even better, Filezilla will automatically switch to your matching local website folder as soon as you link up to one of your websites. It's a small, simple program, and I like it that way.

You can download FileZilla at here.

Step 5: Learn about your site's visitors

One of the most important and neglected aspects of web design is visitor tracking. Most people guage their site's traffic levels by looking at their server stats, but that is neither the easiest or the most accurate way to do it. You're much better off installing Google Analytics on your site and letting their top-quality software watch where your visitors come from, where they go on your site, and when do they leave. Best of all, you get all these great services absolutely free.

You should use this service to optimize your site for your visitors and gear your site toward them. For example, if you learn that most of your visitors find you through a yahoo search for neon-colored macrame, you should put emphasis on your more vibrant macrame weavings. (Not that there's actually a market for online macrame...) Always abide by the web marketer's code: "Optimize, optimize, optimize!"

You can sign up for Google Analytics here.

Step 6: Rake in the cash!

Many web designers like to pretend that they do it for the fame or the satisfaction, but in reality, everybody's looking for a quick buck. The easiest way to monetize your site is to use another convenient Google service, Adsense. Adsense is a simple piece of code that you add to your site which shows advertisements for websites relating to yours. For example, if you decided to run a gardening blog, Adsense would be likely to show advertisements for things like pest control products, gardening utensils, and other gardening websites. When somebody clicks on one of the advertisements on your website, Google pays you a small amount of money. Twenty cents doesn't sound like much, but if your site is getting a thousand hits per day, you can make a sizable chunk of change.

You can sign up for Google Adsense here.

Well, that's all the advice I have to offer. I can't promise that your website will succeed if you abide by these rules, because above all you need interesting content to drive traffic. Writing just another blog about tech stuff will get you nowhere.

Trust me, I know.

Friday, September 5, 2008

Convenient AS3 Positioning Class

I'm sure I'm not the only new-to-AS3 programmer who longed for the convenience of HTML. In HTML, everything you put on the page spreads out and covers the viewing area.

Not so with ActionScript. In ActionScript 3, you must position each object manually by setting its x and y coordinates. It's precise, but it's a pain when you just want all your interface buttons visible. 

Enter Styler 0.1! This convenient class allows you to position objects relative to each other, more like you would with HTML. It's pretty simple to use, and its behavior is pretty easy to predict. You can download it, see some examples, and a try out a demo at my site. I hope it makes your life easier!

Monday, September 1, 2008

<pretentious>How to fix Windows</pretentious>

I know many people have suggested ways to fix windows before, but I have a viewpoint most don't: I'm a programmer. And as a programmer, I'm acutely aware of all the concepts behind windows that I can't begin to grasp. However, I do have one vague idea on how windows could achieve the reliability and speed of a Mac without losing its focus on customization.

Security levels.

That's right, one of the most boring subjects ever to reach computer science, and I think it can solve one of the biggest problems in computer science. Here's why.

There are really two big hurdles to windows performance, programs that run in the background and programs that handle the windows registry improperly. That's why the most common first tips to speed up a windows computer are "Take out the programs running in the background" and "Clean out your registry". In order to address these two major bottlenecks, I think you , the windows user, should be able to restrict your installed software's access to them.

Some programs have a right to always be active, like antivirus software, and some large programs must load parts of themselves when the system starts to allow you quick access to them. Both of these strategies make sense for reputable, well-coded programs, but not for programs packaged with device drivers or random freeware.

Essentially, any program you choose to run can slow down your system by always running in the background, loading itself into your ram, starting up along with your operating system, and filling your system's registry with useless information. Every program you have installed has the same rights to your system's resources. If that makes sense to you, you must be from Redmond.

I think you should be able to assign every program you install one of three security ratings.

  1. The program can access your registry, load on startup, and access the internet.
  2. The program can load on startup and access the internet, but not access your registry.
  3. The program can only access the internet.

Now, developers like me would have to balance the worth of our programs with the ratings people were likely to assign them. Instead of using all the resources I could possibly need, I'll have to design for the security rating I'm likely to receive.

I'm not saying that one silver bullet feature will be able to make windows the absolute best operating system, but I think a radical improvement like this might put windows back on the right track.

Friday, August 29, 2008

ActionScript 3 packages done right

As a somewhat semi-experienced XHTML/CSS programmer, I made several large mistakes when I started object-oriented programming in AS3. There just isn't much documentation on the basics of AS3 packages and package structure, even in instructional books. So here's my take on it, based on hard experience.

You should start your AS3 programming adventure by creating a high-level directory for all your your classes. I called mine 'Classes'. Now, open up Flash and register this directory so that Flash can find it and use the classes in it. In windows, you can do this by going to Edit>Preferences, clicking on ActionScript in the tab on the side, clicking the button that says 'ActionScript 3 Settings...', and clicking the button with the crosshairs on it. In the dialog box that pops up, find your 'Classes' directory and click 'Ok'. Now, Flash can find your classes!

Say that you're creating an AS3 application for somesite.com called Flashy Flash App. The tradition would be to create this file structure in your class directory: com>somesite>flashyflashapp. This way, all the classes for that site will be in one central place, separate from all your other sites' classes. In this file, you would create a document class called FlashyFlashApp.as. Here's how you would start the class:


package com.somesite.flashyflashapp {
 public class FlashyFlashApp {
   /* Lots of code goes here */
 }
}

You should note several key details. First, the file path between package and first bracket is relative to the main class directory. That means, the location of your .fla, flashyflashapp.fla, is completely irrelevant to the package info. Second, note that the class' name exactly matches its filename, including capitalization. If you don't do this, you'll encounter all sorts of nasty errors.

To link the .fla to the document class (the code that starts up the program), type its location into the text box that says 'Document Class' beside it like so:

com.somesite.flashyflashapp.FlashyFlashApp

This, too, is case sensitive, so be very careful with your caps. Now, any code inside the document class, FlashyFlashApp.as, will execute as soon as the program runs.

If you're like me, you've got a big question right now: "What about once I try to put the finished swf on my site? Won't I have to move all those classes and update all those package definitions?" Luckily for you, the answer is no. Unlike CSS, Javascript, or any of the other web technologies I was comfortable using, all of the required code for a Flash swf to run is in the one central swf. The only part of all this work that you will put on your actual web server is the final swf. Unless your script uses one of AS3's loading classes, like Loader or URLRequest (or whatever), you won't have any problems using just that one small swf.

If you've managed to stay interested this long, I commend you. I hope this post will help at least one person avoid some of the mistakes I made. Thanks for reading!

Tuesday, July 29, 2008

Random Horror Short Film

And so, the randomness continues. From an odd thought, to a fully-realized odd project, this blog has been nothing if not unpredictable. This short film was scripted, directed, filmed, and edited by me over the summer. I decided to push the limits of the B-horror genre by upping the bar on cheesy dialogue, bad acting, and cheap camera tricks. The result is positively terrifying, just not for the standard reasons. Watch it below:

Cockroaches and WoW

I have many ideas, most of which aren't to interesting to the average person. Every once in a while, I come up with something so fascinating (in my opinion), I wish I could share it with the world. Well, now I can!

As I was taking an evening walk a couple months back, I had an unusual thought: "Why doesn't a scientist hook up a roach's brain to a virtual avatar? He could wire the bug's mobility processors to the motion of its avatar and its senses directly into the game. That would be an interesting enough experiment, but what if he hooked up the bug to a massively multiplayer online game such as World of Warcraft? In theory, he wire the bug's brain to give it pleasure if it did something good for its player, like damaging another player, and pain if it did something bad, like taking damage.

This bug could become the best WoW player in the world, because it would play non-stop, with an insatiable urge to succeed. Its sole purpose in life would be to win the game, and it would keep trying and learning until it did. Of course, I don't have the means or the experience to accomplish something like this, but it is a very interest hypothetical, in my opinion.

Welcome to Obscurity!

Hello, and welcome to my blog. This blog will have no discernable theme, other than things that interest me. It will delve into my opinions and ideas about science, technology, programming, web design, and the internet as a whole. I do not expect success, so if you actually enjoy this blog and wish it to continue, you'll have to post something, or I'll probably give up eventually. Welcome to obscurity!