Progressive enhancement

Weekend progress

Obviously, getting from displaying a keyboard-controlled object to a more “game-like” state is pretty easy. Here I’ve loaded an external PNG (that represents a spaceship of some kind) and attached it to a “ship” class instance. The left/right arrow keys control the object’s internal “rotation” value, and pressing the up arrow key moves the ship. The direction is determined by trigonometry functions; the movement vector along the x-axis is cos(ship.rotation) and the y-axis movement vector is sin(ship.rotation). (For example, if our ship is pointing straight up (90°), cos(90)=0 and sin(90)=1, so it’ll move straight up.)

No comments · Written by Nathan at 8:19 am · Tags , ,


First Actionscript example

First Actionscript example

So here’s the first real result of my toying Actionscript. If you’ll notice, the last post where I actually first downloaded the Flex 3 SDK was two months ago. It didn’t take me two months to do this, but rather took me that long to figure out when I could fit in extra programming time. The past two weeks I’ve started waking up super early, in order to study Actionscript before work. Anyway, I digress. This SWF was created with multiple classes, including a keyboard handler, main program class, and “entity” class (which in this case displays a blue box). Slowly figuring stuff out, like how to import graphics and associate them with an object, as well as event handling. Once the language-specific stuff gets figured out, things get easier because you know how to implement abstract algorithms/ideas. (Ah, just to reduce any potential confusion, you have to click the SWF in order to set focus, since it’s not embedded in the page. Apparently WordPress doesn’t like to embed SWFs…)

1 comment · Written by Nathan at 9:38 am · Tags , ,


Flex… WTF?

Started checking out Flex today. Been wanting to learn up something new recently, and Flex seems to bridge the gap between web development and a more traditional desktop application. So, what is Flex?

Flex is “Flash for programmers.” Previously, to create a Flash application, one had to utilize the timeline-based, GUI Flash authoring tool published by Adobe. While later versions of Flash allowed some pretty heavy programming through ActionScript, it was tedious and/or annoying to program through what was essentially a visual editor. Also, the program cost $900.

Flex is free from Adobe; they sell an IDE which supposedly makes things easier… it seems you can do drag ‘n drop application layouts with it, reminicent of Visual Basic. Anyway, I digress. A Flex application is made up of MXML (an XML-derivative used for layout) and ActionScript 3 (for logic). A very valid comparison would be to compare Flex to HTML (presentation) and PHP/ASP (logic).

I downloaded the SDK (read the release notes… no real “installation” per se, but you have to uninstall/reinstall your Flash player), and ran through the first two parts of this orientation. It starts you out with a basic application, then goes into tying Flex into other dynamic web languages such as PHP. Definitely web-centric for right now; I’m interested in looking into more graphical, ActionScript-centric tutorials.

No comments · Written by Nathan at 6:46 pm · Tags , ,


Tutorial: Use gcc/g++ with Cygwin

One of the problems that I always faced as a developer was what compiler to use on the Windows platform. While Linux-based operating systems come with their own compilers, Windows users are kinda screwed… I think the last tool that came with DOS/Windows and allowed you to make programs was QBasic. So the question is, what’re some free tools I can use to make Windows binaries?

Enter Cygwin, a Linux-like interface for Windows. It has the bash shell, as well as lots of popular tools, such as C/C++ compilers. This is pretty much just what we want, eh?

Let’s download and set up Cygwin. Hit up the website and click the “get Cygwin” link on the right. Run the installer, and make sure to have the ‘developer tools’ option checked during setup. When you’re done with that, this readme has all the information you need regarding installing the SDL library. OpenGL libraries will be installed with Cygwin by default.

That’s it! You’re ready to rock. Just compile your SDL/OpenGL program using a command similar to this:

gcc -o test.exe main.c `sdl-config --cflags --libs` -lglu32 -lopengl32

If you’re using SDL, make sure to have a copy of SDL.dll in the directory your program is in.

No comments · Written by Nathan at 6:18 pm · Tags ,


Review: Sonic the Hedgehog

Sonic the Hedgehog title screen
The title screen!

I’ll admit it: I was a Nintendo Boy. My first exposure to video games was from the venerable Nintendo Entertainment System, and once I got that taste, I never looked back. In my formulative years, various pretenders vied for Nintendo’s crown: NEC, Sega, and others, but none had the amazing quality of first-party games that the Big N’s system provided.

That’s not to say I never lusted after the exotic curves of the Genesis/Sega CD combination, or desired the back lit, color LCD screen of the Game Gear. Many a time I had wayward thoughts, and strayed from my Nintendo upbringing. However, the cold, hard reality of life kept me from enjoying alternative gaming experiences. My willpower to save money for the length of time necessary to purchase a Sega system was insufficient. When there were such great Nintendo games to be had, it was difficult to wait and buy another system.

Sega’s offerings seemed esoteric, as well. Since I had no exposure to the Genesis, it seemed to be a system that only crazy, fanatical die-hards would buy — not for a healthy, red-blooded, Nintendo-playing lad such as myself. When I finally met a kid who did own a Genesis and Sega CD, it turned out the only games he owned for it were obscure RPGs, which further cemented my view that Sega was only for the fringe.

Sonic running through a loop
One of Sonic’s trademark loops.

Imagine my surprise when one of my roommates recently produced an old, first-generation Genesis, complete with a collection of rather boring-looking games. At last! A chance to potentially play some of the classic games from another era! Sadly, the only game that looked to be worthwhile was a dusty, tattered “NOT FOR RESALE”-emblazoned copy of Sonic the Hedgehog.

Taking into account when the game was first released (1991), Sonic was a revolutionary title. Even the most colorful Nintendo games, such as Super Mario Bros. 3, looked drab and boring in comparison with Sonic’s rich palette and large sprites. A very catchy soundtrack enhanced the overall appeal of the game. After playing for a while, I was so hooked on the tunes that I downloaded the soundtrack to
enjoy during the monotonous tedium of work.

That’s all well and good, but how does the game play? How does one weaned on the teat of Mario (in a metaphorical sense, of course) handle the fast-moving hedgehog? As one looking in from the outside, I had always assumed that Sonic games were about speed: loop-the-loops and other such tomfoolery. This is true to an extent; however the game also delves into what I like to call
“bastard f___er” tricks — spikes or other dangerous obstacles placed at just the right places where you would run into them the first time playing through a level. Aside from this somewhat cheap mechianic, Sonic also introduced some new ideas, such as true curved surfaces (with corresponding physics) and the concept of being able to kill an enemy by leaping into it as opposed to
on top of it (blasphemy to a Mario player). The bonus levels were also interesting (similar to Camel Try), and showcased the power of the Genesis.

Sonic runs in the Marble Zone
Sonic runs along in the Marble Zone.

Unfortunately, nothing is perfect, and this includes the debut game of Sega’s mascot. The most noticable downside to Sonic is the length. Although there are 18 levels, each one is played through fairly quickly (especially levels where speed is emphasized). The result is a game that is able to be completed in well under an hour. Compared to many of the first-gen Super Nintendo games, Sonic barely registers as a “quickie.” Sonic especially pales in comparison to Super Mario World, Nintendo’s flagship offering, which contained 72 “true” levels (and numerous secrets), which made it a much more satisfying game.

At the end of the day, what is Sonic the Hedgehog to a modern gamer? An interesting, nostalgic trip back in time to the golden days of 2D platforming — all the more since Sonic became Sega’s mascot and spawned countless other games. When you see Sonic’s face plastered on lots of re-hashed crap on store shelves, sometimes it’s good to get some perspective, and see where he came from.

No comments · Written by Nathan at 5:01 pm · Tags , ,


← Newer PostsOlder Posts →