Blog

Toxin – Advanced Sprite Techniques

March 24, 2013 0 Comments

toxin-sprites

Creating good looking graphics for an abstract game like Toxin is harder than it first appears. Not only are your images stripped bare of most signifying information, requiring a real eye for the principles of graphic design, but creating the artwork itself – giving each line the right balance of sharpness and glow, demands careful image processing and a great deal of experimentation.

When I started making Toxin, the graphics were a real struggle. It took me an enormous amount of work to develop the look of the game. To give you an idea, I have a folder on my laptop with all of Toxin’s artwork in, and it weighs in at 967meg! All for a little mobile game!

Eventually all my experimentation began to pay off, and I developed some powerful techniques for creating animated multicoloured abstract sprites. In this post I want to describe one of my favourite methods.

I start by creating our sprite out of spline shapes in 3D Studio Max. Unlike many 3D programs, Max can render splines at various thicknesses, animate them, and can even apply texture maps and materials to them.

I then use gradient maps to mask out areas of the shapes that I want to be different colours. These gradient maps are then animated, so the different coloured areas can actually move around the shape.

Then, I do two sets of renders. First I render the shape with the masks on, so there’ll be a hole wherever the coloured area will be. Then I do another render with the mask inverted, so that only the coloured area is visible.

make-a-spiker
This diagram shows each step in the creation of one frame of animation for a Toxin sprite. The total animation is 64 frames long. This intricate process is largely automated using Photoshop scripts

Then its time to start up Photoshop. After deciding what colours I am going to use, I run each set of sprites through a Photoshop script that colourises them and adds a glow. To create the glow, I duplicate the image into another layer, Gaussian blur it, then additive-blend it on top. Sometimes I use several glow layers with different Gaussian blur parameters. I also find that using image->adjustments->Hue/Saturation to colourise gives me the best results.

The final step is to compose the two sets of colourised renders into a single sprite. I do this with another Photoshop script. The end result is a lot more interesting than the basic Geometry Wars style sprites everyone else is using, I think.

View Comments

The Next Photoshop

February 24, 2013 0 Comments

If you’ve read this blog for very long you’ll know that I am a big fan of Photoshop scripting and procedural graphics. Toxin, the iPhone game I’ve been working on, uses procedural art and animated image processing effects extensively. I don’t think the game would be possible without Photoshop scripting.

However, Photoshop’s scripting system is far from perfect. You cannot access pixel data from within scripts, nor can you draw lines or circles or anything like that. These limitations have become really frustrating to me.

For example, on the day I started work on Toxin, I needed to draw an ellipse with precise dimensions. The whole game takes place inside an ellipse, you see. I couldn’t do it in Photoshop by clicking and dragging, it was too inaccurate, so I wrote a C program using the Allegro game library to create the precise shapes I needed. These were then loaded into Photoshop and used as guides while I created the game artwork.

Later I discovered Processing, which is much quicker to develop in than C. I soon developed a workflow where I would go back and forth between Photoshop and Processing, generating procedural content then processing it or running it through scripts until I got the desired result.

Processing, however has some frustrating quirks of its own. As a simplified front end to Java, you often get Java errors that are incomprehensible without digging into the underlying platform. Also, it cannot effectively save semi-transparent PNGs which means that the anti-aliased sprites I was creating all had a solid background which had to be removed. I ended up redesigning my workflow and using the excellent Ghost and AntiGhost plugins from Flaming Pear to overcome these problems.

From graphics app to graphics platform

All these issues got me thinking about what I really want from a high end graphics program. What I want is something like a programmable, graphical Lisp Machine; a powerful graphics programming platform with the UI of an art application, not an art application with a bolted-on scripting system.

I want the ability to programmatically control every aspect of Photoshop from both external scripts and from a real-time REPL inside Photoshop that works like the command line used in some CAD programs.

I want to be able to type line(10,10,100,100) and have a line appear on my presently selected image. I want to be able to open the REPL and assign my current selection to a variable which I can later re-select with a simple command. I want to be able to access the pixel data in my images, and write my own filters in Javascript within the scripting system itself. I think anyone in high-end graphics or scientific imaging would love something like this.

A true graphics platform like I have described would likely have to be written from the ground up with programmability built in. Nevertheless I did spend some time finding out how far I could go with Photoshop’s native capabilities.

I had the idea of writing a Photoshop plugin that contained a number of drawing functions which could be called from scripts via a Javascript library that integrates with the Photoshop document model. So you could write PSDraw.line(10,10,100,100); in ExtendScript Toolkit, and my Javascript library would construct a call to the plugin which would draw the line.

Unfortunately, it’s not possible to get information from a plugin back to the Photoshop script thats running it, so it wouldn’t be possible to do a getPixel() or anything like that. At best, this plugin/script combo would give us a somewhat clunky way of drawing programmatically but little else that would justify the effort involved. (have you ever seen the Photoshop plugin API?)

As a secondary option I thought about actually embedding V8 inside a plugin which would contain an editor and debugger. Besides the ugliness of having 2 distinct Javascript engines running in the same app, the plugin architecture put paid to this idea. Photoshop plugins are one-shot operations. Load the plugin, set the parameters, perform the operation, then shutdown. My idea would only be effective if the plugin was a persistent part of the Photoshop environment.

So the only options then, would be for Adobe to integrate scripting more completely, or for someone else to start making what would be a true sucessor to Photoshop.

 

View Comments

Game Design for Space Exploration

February 7, 2013 0 Comments


The longing for the infinite must always be a longing
–Friedrich Shlegel

When the Kickstarter campaign for Elite: Dangerous was announced, it not only inspired me to write these recent posts on exploration in video games, it made me think back to the hours I spent playing its predecessor, Frontier: Elite II.

Frontier was a magnificent achievement. In 1993 there was no game that could offer similar scale or freeform gameplay. The elegant graphics were also something of an accomplishment since the Amiga and Atari ST were not natural 3d machines.

Despite this, I always felt that Frontier never capitalised on the exploration potential of its vast universe.

There was little incentive to leave the inhabited systems and head out into the unknown. You could mine planets, and extract hydrogen from gas giants to fuel your explorations, but these were difficult operations, restricting exploration to very experienced players.

In spite of the rumoured existence of an alien warship hidden in deep space, there simply wasn’t enough mystery out there to entice explorers. The procedural planetary systems of 1993 lacked detail and variety and you could see most of what the game had to offer without going very far at all. None of this really detracted from a game that offered so much, but those of us who longed for the unmarked places on the map were left nursing our imaginations.

So what kind of space exploration game could we make in 2013 with what we now know about procedural world generation? There hasn’t been much information yet on what the procedural worlds of Elite: Dangerous will be like, but we can get an idea of the contemporary state of the art by looking at Space Engine, a procedural universe simulation created by Vladimir Romanyuk.

Space Engine was originally inspired by Noctis, the cult freeform space exploration game that I wrote about in my previous post. At the moment it doesn’t really contain any gameplay besides the ability to move around and take screenshots of its graphically impressive universe, but there are plans to create a full game out of it, hopefully remaining faithful to Noctis’ vision of a “dreamable space simulator”.

As you can see from the Space Engine galleries, it is capable of generating varied and detailed landscapes, with plains, craters, mountains, lakes and oceans. Different atmospheric compositions alter the appearance of each alien world. The planetary orbits are physically realistic, and it appears likely that physics that effects the player such as gravity and atmospheric drag are in the pipeline.

All of this procedural detail combines to create a web of systems that can provide gameplay, if they can be given as being of concern for the player.

And because we don’t know exactly what the procedural generators will create, but we do know *what* they create we can set goals for exploration that provide meaningful feedback while remaining open ended.

We can challenge the player to find the tallest mountain, the deepest ocean, the richest ore field, the largest planet that is the closest to its sun. All these goals are specific enough to be put into achievement systems, and yet they remain open. A taller mountain may be discovered tomorrow. Achievements then become, literally, world records.


It’s gonna be a rough landing! A Space Engine landscape from the EDGE Review

The technical challenge in this is in creating tools that can scan and interpret the procedural world in order to recognise mountains, ore fields etc. This is the price you have to pay for meaningful feedback; the computer must be made to understand what you mean. The challenge for game designers is to make these knowledge extraction tools fun and interesting for the player to use.

If I were Vladimir Romanyuk, or I had access to his source repository, this is the game I would make with Space Engine.

Imagine an advanced race of spacefarers. War and material gain are irrelevant concepts for them, what they care about is knowledge. When they come of age they set out in lonely ships to traverse the universe. (If you wanted to give the game an end condition you could make it so they were allowed to return home once they had gained enough knowledge. [Perhaps you could even throw them Proteus style into the world with very little contextual knowledge, and make players figure that out by themselves?])

Their ships are equipped with different types of scanning equipment and the means to mine and extract chemicals from planets and asteroids etc. This equipment takes skill to use; for example scanning a mountain formation might involve landing probes in the area surrounding it, in a certain configuration.

The gravity of the planet, the atmospheric composition and the layout of the terrain all effect how easy this is to do. Some planets may be extremely difficult to scan or land on. All this creates gameplay and the potential for informal competition and legendry amongst players.

Perhaps the player flies a living ship, a bit like Moya from Farscape. This living ship grows and develops in response to the knowledge the player can attain from the universe. “knowledge” here is given a more mystical and active significance here than the ordinary intelligibility of human life.

The ship can develop its capabilities using material from the universe in conjunction with knowledge, enabling the player to travel further and do more things.

This creates an economy of progression without requiring any shops or civilisations (less work for the indie developer!) and is in keeping with the wholly alien atmosphere we are trying to evoke.

So there you have it. We’ve now created a basic outline of an exploration game with progression and well defined goals which remains open ended and mysterious. I’d really like to know what you think about these ideas and the thinking behind them. If I had a bit more time and money I’d take a shot at developing it. Maybe in the future.

View Comments

The Gameplay of Exploration

January 25, 2013 0 Comments

Palomar II (2002)

One of the things I love most about video games is their potential for exploration. Like immersion, exploration in games is as much about mood and feeling as it is about the logic of game mechanics. It imparts a watchful, meditative air, a constant openness to emerging possibility that serves as a nice contrast to the intensity and solidity of ordinary gameplay.

This kind of peaceful, yet fully engaged play is something I have always looked for, yet it seems to be a hard thing to find. Too often, explorativity (is that a word? It is now) is simply a side effect of a large game world; there is nothing in the game that acknowledges that exploration takes place. There’s no feedback for anything you do, besides your own satisfaction.

Of course, this lack of feedback may be the entire point. One of the greatest space exploration games, Noctis IV, developed by Alessandro Ghignola from 1996 to 2001, simply presents you with its grainy, expressionistic universe and invites you to explore.

Writing for The Escapist, Philip Scuderi describes Noctis as having an essential “air of tragedy” and loneliness, a sense that there are “no messages to receive or send; no voices to contrast with the endless vacuum.”

Like The Sentinel, that primordial deity of computer generated worlds, the procedural universe of Noctis presents a blank and pitiless face. Without the presence of meaning within the world, this universe reveals itself to the player as a kind of grand, inhuman unfolding of geometry; a “worldless” world, as Heidegger might say.

Many of the older open-world games like Mercenary, Hunter and Midwinter II have a similar quality of rigorous bleakness which overwhelms the entire game, almost in spite of the developer’s intentions. Hunter, for example is ostensibly a Schwarzenegger-style action adventure, going by the back story and box artwork, but all that is lost in the angular silence of its fractal world.

It is interesting to compare these games with Proteus, which as of this writing, is still in public beta. Like Noctis, Proteus simply places you inside a computer generated world, a beautifully stylised island in this case, and leaves you to explore. In fact Proteus gives you even less to go on than Noctis. There is no backstory, no explanation as to what you might be able to do. You begin the game knowing how to move and sit down, and nothing else.

As your eyes open upon the world you begin to scan the environment. Trees, birds, life, weather patterns weave unnamed and mysterious systems around you. “How do they work?”, “What is my place within them?”, “Who is here?”. Exploration begins.

Proteus avoids the bleakness of other exploration games by filling the world with sound and with significant systems. Everything hums and jangles as you explore; each tree, each type of terrain lends its song to your experience. Animals hop about the forests and react to your approach, the weather changes, seasons pass. Everything seems to effect everything else and you are right in the middle of it trying to figure it all out.

And it gives so little away that you always retain the possibility of being surprised, of something new appearing that casts the whole world in a different light. It takes me back to the days when my friends and I knew so little about games that the most implausible rumours grew up around them. I wouldn’t be surprised to find Sheng Long living in that lonely house on Proteus Island.

For some time now I’ve thought that the mystification of game mechanics, the introduction of other kinds of intelligibility to the hard-edged logics of ordinary games are essential steps in moving game design forward. Proteus is an important step in that direction.

Next time, I am going to write something about space exploration in generative universes, so stay tuned.

*The image at the top of this post is not Proteus! It’s the cover of Palomar II, the 2002 album from NY indie band Palomar. I just thought it evoked the qualities I’ve been talking about in this post. Oh, and I am desperate for a copy of Palomar’s impossible to find first album, so if you can help, please let me know.

View Comments