25 Mar

Some Cool Demoscene Stuff

Here are some of my favorite demoscene products with a short review of each.

Matt Current (The Shitfaced Clowns/Breakpoint 2007)

Gameboy Advance

You could say Matt Current features two demos in one. The first part features 3D stuff very familiar to anyone who has seen mid-1990s demos and the second half is a complete change in style with one of the best tracks I have heard in a demo (with lyrics), effects with more focus on the presentation than the technology and hip hop. I love the short flashes of video captured footage of skateboarders in synch with the music and the 2D parallax field of graffiti.

Atrium (TBC & Loonies/Breakpoint 2008)

4KB/PC/Win

There are a lot of very impressive 4K intros that have come out in the last few years but this one caught my attention. It is funny how the pacing — the single most important thing outside the content itself — is much better than of those in many multi-megabyte demos. The growing building effect also is pretty much equal to the 2006 Assembly demo by Fairlight shown below.

The Secret Life of Mr. Black (Orange/Assembly 1997)

PC/DOS

Orange demos have a very distinct style. Even simple things like fade ins and fade outs are tweaked, mainstream effects are avoided (notice the complete lack of Phong shaded polys and other common stuff) and the demo generally has a weird atmosphere (just listen to the soundtrack).

Inside (CNCD/The Gathering 1996)

PC/DOS

CNCD’s Inside has one of my favorite soundtracks, the fat track suits the demo well. While some of the 3D stuff in Inside is a bit out of place (how do you segue from rappers to spaceships is beyond me) and looks dated, the remainder of the effects still look absolutely fantastic.

And now for the best of the bunch…

9 Fingers (Spaceballs/The Party 1993)

Amiga

Take a look at Spaceballs’ 9 Fingers and think about the fact it was done on the Amiga and that it features streaming video of sorts. The demo came on two 800 KB floppies and only lasts for less than three minutes, which was unheard of (well, Spaceballs already did the same with State of the Art but I bet you know what I mean). Ironically, the demo takes far more data when converted to an inferior quality Youtube video.

The captured video footage is converted into a polygon mesh which allows for good compression ratio (you need to store only the mesh points and the polygon color). Of course, the more important thing is that it allows sufficiently fast decoding the video and other effects such as the rotating cube with “texture mapping”. The Atari ST demo shown below employs a similar trick as it streams the precalculated polygon data (or rather the horizontal line data) from disk.

You might also want to take a look at the making of 9 Fingers.

24 Mar

Show Me Yours and I’ll Show You Mine

The level editor for your games, that is. My personal experience of making games is that the behind the scenes tools such as level editors are at least half the work. If you’re lucky, you can use existing tools for creating the data but I guess that is very specific to a genre.

I have found that developing an editor is not only convenient but also allows you to polish the game mechanics a lot better than doing that purely in code. I guess many game developers think level editors and such are only for bigger projects where the programmer is not the guy who makes the levels. It is possible and manageable to create games by hardcoding the level data and object behavior but as mentioned, a proper editor is so much better.

Of course, if you have been smart, you will be able to share the code between the game and the editor. And if you are a bit smarter, you can build the editor inside the game so you have a perfect testing environment for the levels — as long as using dynamic level data is possible in your engine. An extremely good example is the Cube Engine which allows multi-player level editing while playing.

Anyway, the original point of this post is that it can be very hard to imagine what’s a good editor like. Doubly so, if your game idea is different from the average game. I figured it could be helpful for some indie game devs if I show some of my level editors. I hope this inspires people to tell about their development environment.

Below is the level editor for my forthcoming Pac-Man clone. I couldn’t use any tile-based map editors, which probably would have been more than sufficient for a tile-based game. Mine uses linked nodes that can be moved freely in 2D space.

The level editor does most of the work: the game only gets a crunched copy of the level data with precalculated splines and so on. Stuff like that makes it possible to keep the level rendering code intact while the editor gets more features. Originally, the editor and the game just did straight lines. When I added the splines to the editor, the game still got a list of straight lines and used the old code.

The game and the editor are both made using SDL and OpenGL. Using SDL means you have to reinvent the wheel a bit when it comes to GUI stuff but it is manageable. If you can figure out how to implement dragging with the mouse (SDL only provided events for mouse clicks, releases and motion), you are able to create a GUI that will be good enough for your project.

This is a level editor for an untitled shmup project of mine. All the attack wave movement is defined by Catmull-Rom splines (unless the object is of special type, e.g. a homing missile).

The editor imports all the object classes thus it is trivial to display the graphic for an object. The editor then exports the level data as C++ code by subclassing the level class and automatically writing code for events like “spawn object type Enemy when camera enters this node”.

The editor allows the user to “rewind” and “play” the level while editing. When F5 is pressed, the camera starts following the camera movement spline from the currently selected node and enemies move along their own paths. This is only an approximation since no AI code is available in the editor. That means you can only see spline based movement. It nonetheless makes it much nicer to plan attack waves.

The intermediate game level data for both editors is stored as an XML document. Most game data is representable as a tree, so XML is a natural choice for it. As recommended in an earlier post, xmlParser is an excellent choice for a quick way to save your level data. Do not fear XML because of how clunky it can be from the perspective of a programmer — the mentioned library pretty much removes most of the friction. And, you can always write an XML to converter afterwards.

Condensing, here’s what I have learned:

  • Writing an editor can be a lot of work but you can make it fun and it will pay off in the end
  • Use existing frameworks
    • for displaying the game data in the editor
    • for saving the editor data
  • If at all possible, allow gameplay inside the editor

So, what do your editors look like? What have you learned about game development and how editors can make it more fun?

22 Mar

Amazing 4KB Ray Tracer

2008-07-27T12:24:18+00:00: Updated with an even more impressive 4 KB raytracer from RGBA1


Slisesix

The above is the output of a 4KB intro by Rgba that uses purely generated data to render a nice creepy landscape scene. To give some perspective: the same image compressed into a JPEG of similar size would look crap. And it still needs code for displaying the compressed image. You can try and run the program yourself, it can be downloaded from the Rgba site (32-bit Windows binary)2. It takes about 10 seconds for the image to appear on my Athlon XP 3000+. Let’s hope they will make a screen saver of it, with random parameters for the scene.

Things like this make me think of how much things have gone forward since I first looked into ray tracing. It used to take many hours for a similar image to render in POV-Ray (not including the time used for modelling!). Nowadays, you can optimize for size (as opposed to optimizing for speed) and still have a reasonably fast ray tracer. It’s not too far fetched that the above landscape could be rendered real-time on a fast processor and probably with some speed optimizations.

21 Mar

A Tiny XML Parser

While looking for a convenient way for storing some level data for a game I’m working on (more of that later), I came across this small C++ XML parser. Originally, I wanted to stay away from XML or other formats as they are overkill for the simple game format. However, this parser is both small (the Xerces parser is over 50 megabytes!) and easy to use.

In case you can’t find a download link on the project page: you have to email the author to receive the library (the page promises a direct download link in a few weeks). I think that’s actually quite nice, considering people who write free software rarely get the praise and attention they deserve.