Thieves and Warriors

August 17, 2009

Here’s a little preview of a game I’m working on, called "Thieves and Warriors". I’vementioned it before.
taw_title
(all the screenshots can be clicked on for full size view)
The game is somewhat inspired by old RPG games like Phantasie 3 (oh, and Pirates! as well, obviously), but even more inspired by oldschool pen and paper RPG’s. Ther’ll be lots of stats and numbers, none of it hidden away. And not so much animations or effects – more static screens and menus.
taw_party
You control a party of adventurers. I won’t have a limit on how many, but eventually it will become difficult for you to manage, I guess.
taw_town
The game starts off in a town, and you will also be returning to the town after completing quests. When in the town, you’ll be able to visit the market or tavern.
taw_tavern
The tavern is where you get your quests. The quests will be auto-generated, but quite simple to their nature.
taw_travel
To get where you’re going, there will be one or more days of journey, where you can be beset by foul weather, food shortage and more.
taw_battle
You can also be attacked, and I’m not quite done with how that will work yet – thinking of having it like a game board with abstract pieces.
taw_entrance
When you reach your destination, which is inevitably some sort of dungeon (keeping it classic, remember), which I haven’t even started to visualize yet – it will be auto-generated, but apart from that I don’t know. I’m considering a "doodles on graph paper" kind of look, but need to experiment some more.
Making the background pictures have been quite a challenge for me – have never used Poser to this extent before, and I’m really quite happy with the result :-)

The Jade Figurines

August 16, 2009

So, over the weekend (from Friday to late Sunday), I made a small beginning of a game, as an entry to the RPGDX competition. Now, 48 hours is a very short time for this, so I didn’t manage to complete the whole thing, but I did manage a very good start. There’s one short level, and the beginnings of a second, but I will continue to work on this, and make it into a full game :-)

If you want to try it you can download it here:

Download The Jade Figurines

Here’s some screenshots of the game, but they don’t really do it justice, so download it and give it a try instead :-)

jade_title

Title screen – having to work fast means you can’t really be to particular with how things look..

jadescreen1

The game starts in quite a generic setting – a dark forest. The sword at the bottom shows the direction you should move.

jadescreen2

Simple "cutscenes" are indicated by black bars top and bottom.

jadescreen4

There’s fighting too – though I’d really like to improve on it, it’s currently a bit rough as a result of the tight time frame.

jadescreen3

Fighting can be difficult, and you can easily be knocked down. I didn’t have time to add a health bar, so you can’t die.

jadescreen5

Decided to use a combination of text boxes and speech balloons for a comic book feel.

jadescreen6

A shot from the second level, which takes place in town. This is the big scene where you get you mission…

I’d appreciate any feedback on the game as it stands so far – there’s lots of things I’d like to improve, and I have a lot of ideas for things to add, but it’s always good to get input from other people at an early stage…

There’s also a video of the game available, and some pictures of more characters for the game.

48 hour Sidescrolling RPG Competition

August 6, 2009

rpgdx2009

RPGDX is having another one of their friendly mini-competitions, where you’re trying to make games (mostly RPGs) in a limited time period. The competitions are just for fun, and you don’t win anything besides the bragging rights… and the winner is voted by the participants.

This time, the theme of the competition is to make a sidescrolling RPG in 48 hours, and is set for August 15-16. Basicly, you start when you wake up on saturday morning, and try to finish something before going to bed at sunday night, and you do as much as you want to in between. You can use any engine, tool or language you like, and for any platform.

As 48 hours is a rather short time to make a game, it usually results in quite small games, and it is important to stay focused. It is a great learning experience: having to make quick decisions, stick to them and not be too particular with what you do – the important thing is to have something playable in the end.

More details about the competition can be found here:http://forums.rpgdx.net/viewtopic.php?t=2237

Font Generation Tool

July 29, 2009

As I couldn’t find an existing tool which met my requirements, I’ve written by own utility to generate a bitmap font from a true-type font, which is quite useful for when you want to use a font in a game but don’t want to buy the full distribution rights to it…

It can be downloaded here (source code included):
PixieFGT_1_0.zip

And the syntax is:
PixieFGT fontname size [spacing] [-antialias] [-texture]

The optional parameter spacing gives you that many empty pixels around each character, so there’s room to add things like dropshadow or glow in your image editing software.

The optional flag -texture will give you the characters arranged on a bitmap of power-of-two size, and if the flag is not specified, they will be placed on one long horizontal strip instead (which is what I most often use for fonts in Pixie, as it makes it easier to apply gradients to the font in photoshop).

If you specify -antialias, the font will be generated at 16 times the requested size, and then downsampled, for high quality antialias.

Here’s an example of how a generated font bitmap might look:

PixieFGT_example

And along with it you also get an XML file which specifies which character can be found in which area of the bitmap.

The XML file also contains kerning information, which you could make use of if you want. What it basically tells you is that if a character with the ascii value matching the "first"-value was rendered, followed immediately by one matching the "second"-value, the second character should be moved horizontally by the specified amount, so that, for example, "A" and "V" are placed closer together than "A" and "L"…

The source code is public domain as usual.

Using Strings as IDs

June 26, 2009

Sometimes, it’s nice to be able to identify things by name, rather than using a number or an enum. The problem is, that if you’re not careful, using strings can take a lot of memory, and LOADS of CPU-power, with all the stricmp’s. When I was hired for the Tycoon City project, and assigned the task of speeding up the game (which was *really* slow at that point), it turned out they were using several hundred megabytes for storing strings (of which most were used as ID:s, and was mostly duplicates of duplicates), and that string comparisons and string copying was right at the top of the profiling results. I won’t go into how we went about solving that particular problem – it was late in the project, and things turned out the way they turned out – but it got significantly faster and smaller, that’s for sure.

Ever since then, I’m always a bit wary about using strings – it can easily get out of hand, and it feels wrong to waste both memory and CPU-power on something if you don’t have to. So, I thought I’d share my own system for solving this problem, extracted from my (recently cleaned up) Pixie Game Engine. It’s a solid, fast solution, ready to just drop into any project, and consists of only two classes. At its core is a class I call StringId, which is easily created by:

StringId myStringIdVariable("myOwnIdNameHere");

Which internally results in the string "myOwnIdNameHere" being located in a global string table (non-case-sensitive), or inserted if it’s not already added. The lookup is done through a pretty fast hash-table. In the StringId object is stored a pointer to the shared string, so you can do:

if (myStringIdVariable==anotherStringIdVariable)

and know that it will result, internally, in just a comparison of two pointers. Nice and fast. And takes less memory too, as a string is only stored in one place – the global string table. There’s also a couple of macros defined (they’re nifty at times), strSwitch and strCase, which can be used to compare StringId’s in a way similar to switch-case statements:

strSwitch (myFruitTypeStringId)
    {
    strCase(Apples)
        {
        // code to do stuff here
        }
 
    strCase(Oranges)
        {
        // code to do other stuff here
        }
    }

Which is the same as doing this, but looks a bit nicer (though that is, of course, a matter of taste :D )

static StringId applesId("Apples");
if (myFruitTypeStringId==applesId)
    {
    // code to do stuff here
    }
 
static StringId orangesId("Oranges");
if (myFruitTypeStringId==orangesId)
    {
    // code to do other stuff here
    }

The code is well-written and well-commented, and can be downloaded here. It is C++, and as usual it’s public domain – use it anyway you like :D

Escape from the Dungeon

May 16, 2009

Here’s a little game I’ve been working on for a while, on and off.

eftd_title

It’s called "Escape from the Dungeon", and the back story is this: three adventurers (a man, a woman and a dwarf) have been split up while exploring a dungeon, and the player controls all three (can switch at any time he like).

eftd_players

The three characters start at different positions in the dungeon, and you simply need to bring the three together and hit the nearest exit.

eftd_screenshot

Initially, I started this because I just wanted to playaround with generating random dungeons, and after I had done the room generation, I sort of got stuck and didn’t know what to do with it, and only recently got moving with it again.

eftd_rooms

There’s going to be monsters too, like this:

eftd_monsters

There’s an early demo of the game here:

Escape from the Dungeon – Demo

The controls are cursor keys to move, TAB to bring up the map. 1,2,3 to change character (or click their portrait)

The characters start some distance away, and sometimes it’s a bit tricky to find a way to bring them together. There’s no monsters yet, and there’s not even an exit for you to find, but it’ll all get added in due time.

eftd_screenshot2

So, I would very much appreciate any feedback/thoughts on this. Don’t hesitate to point out things that don’t look right or which you just don’t like – anything that can help me improve things :-)

Parachute – A Game&Watch Tribute

February 18, 2009

Do you remember the old Game & Watch games? The little handheld one-game toys with simple and fun games? There was one called Parachute, which was one of my favourites.

Sometimes it’s fun to throw something quick and easy together, so I did a simple remake for Windows:

parachute

You can download it here:

Download Parachute here

And as usual, the source code for the game is public domain, and available here:

Download parachute source code

The original game looked like this:

parachutegw

And I’ve tried to stay faithful to the original, at least the way I remember it… but it was so long ago :P

Btw, thanks to my old friend Per Ekengren for the music, which he made years and years ago…

100 Faces

February 6, 2009

Over the last week, I’ve been taking a long hard look at all the projects I’m working on. Turns out that it’s just over 50 different things I’m working on, and that’s too much even for a student with no pressure to finish anything :P So I’ve stoved away the majority of them for later, and I’m now focusing on a total of 5 projects, which is much more reasonable…

I’m sure I will be telling you more about the individual projects later on, but for now I thought I’d show what I’ve been up to for the last couple of days:

siu_facegen_large 

One of the games I’m working on requires lots of portrait pictures of people of all types and ages. As the recent versions of Poser have scripting abilities, I’ve composed a script which will generate and render lots of different characters automatically. The image above shows the first proper batch of 100, and while not perfect, they’re pretty good enough for the effort involved in making them: One single click of a button, and out pops a hundred faces :D Next up is to do the same for female characters.

This is fun stuff to mess about with :-)

3D Engine – Animation Basics

January 4, 2009

I guess by now, some of you are getting a bit impatient to see some actual code put together for this, and it is almost time to get down with the practical side of things, but before we do, there’s ome more thing we need to look into: animation. So far, we’ve got models and lights which can be moved around, and in a way that’s all we need for making simple animations through code. However, we have no means of animating characters within a 3D modelling package and have them played back in the engine. This is where morphs and skinning comes into play.

renderer_morphs

Morphs is a quite straightforward concept: you take a mesh, move its vertices around in the modelling package (without removing or adding any vertices), deforming it into the desired shape. You then compare the new mesh with the original one, and for each vertex you calculate a delta value, which is the difference between the old and the new vertex positions. In the engine, you can apply the morph by adding each delta to its vertex, to deform the mesh on the fly. By scaling each delta as it is applied, you can smoothly transition from the original mesh to the deformed shape.

This technique is especially useful for animating character expressions, as pictured above. We could do other animations this way too, like maybe the walk cycle of the character, by saving each keyframe of the animation as a set of morph deltas. However, morph deltas require a lot of memory – we’re basically duplicating the mesh for each keyframe of animation, and there’s no way to reuse animations between different characters.

renderer_skinning

That’s why we’ll use skinning. The concept of skinning is a bit more complex than morphs, but the advantages makes them worth it in a lot of cases. Basically, what we do is build a "skeleton" (a series of connected bones) for the model (the black lines forming long triangular shapes in the arm at the top of the image above). Once we’ve created the skeleton, we bind all the vertices of the model to different bones. Most vertices are only bound to one bone, but some vertices, near the joints, are connected to more than one bones, and usually we use different weighting values for how much influence each of the bones have on the vertex. This might sound a bit complicated, but it’s all set up in the modelling package, and it’s actually quite straightforward. The important bit for us right now, is that when using skinning, we get a hierarchy of bones, information about which vertices are bound to which bone,  and weighting values for those vertices that are bound to multiple bones.

When we have this information, we can easily animate the hierarchy of bones, the skeleton, by simply rotating bones relative to their parent bones. In the above image, you can see an example of bending the arm at the elbow, by simply rotating the forearm bone. as you can see, we get a smooth deformation of the elbow, as those vertices are bound to both adjacent bones. Animation data for the hierarchy of bones is tiny – simply a rotational value for each bone, making it quite memory-efficient to store a lot of animations, at the cost of calculating the vertex positions in the engine. Using morphs on the other hand, takes a lot of memory, but is faster to apply.

In my indie engine, I’ll support both morphs and skinning, as I believe they are both very useful concepts, as well as quite simple to implement. As with all the other components of the engine, I’ll make a clear distinction between instances and definitions, and next time I will go into more detail about how morphs and skinned animations will be implemented in my engine.

Fighting Game – Oldshool Style

December 30, 2008

As I’ve talked about before, I’m a big fan of oldshool fighting games, like Way of the Exploding Fist or International Karate. I’ve always wanted to make a fighting game, and so I’ve now added one to my ever growing portfolio of "current projects".

wotif1

I’ve spent a bit of time playing around with some oriental/martial arts related models, and done a couple of quick renders to test things out, and I thought I’d post them here, and maybe get some feedback.

wotif2

The game itself will be a classic 2D fighting game, where timing and distance will be the key factors for success or failure. There won’t be any combos or frantic button pressing; instead, there will be well-timed, measured punches and kicks, delivered in just the right way to thwart your opponent. There also won’t be lots of characters with special moves – we’ll have exactly two visually distinct fighers with an identical set of moves, just like it should be :-)