Category Archives: News

A curious neighbour

I got a little curious to see what libraries other indie games were using. So I opened my Steam folder and took a quick look.

  • Osmos uses OpenAL, FreeType, libvorbis, libogg, libcurl
  • Super Meat Boy seems to be using its own “Tommunism Engine”
  • World of Goo uses ODE, SDL, parts of the PopCap framework, TinyXML, irrKlang, libcurl
  • Machinarium is a Flash game. Uses funny filenames for the data, by the way.
  • Aquaria uses ZLib, SDL, libvorbis, libogg, Lua, FreeType, FMod and more
  • Braid seems to be using no 3rd party libraries beyond DirectX
  • Revenge of the Titans uses LWJGL and Java

Some more findings:

  • Torchlight uses Ogre3D and CEGUI
  • Minecraft uses LWJGL and Java
  • Family Farm uses Boost (serialization, threads), TinyXML, OgreMax, ParticleUniverse, cURL, Google Breakpad and wyUpdate for updating the Windows version

What is touch typing?

My definition:

“Using the keyboard without looking at the keys and using all or most of your fingers.”

Another one:

“Typing that is fast enough.”

Official from Wikipedia:

Touch typing (also called touch type or touch method or touch and type method) is typing without using the sense of sight to find the keys. Specifically, a touch typist will know their location on the keyboard through muscle memory. Touch typing typically involves placing the eight fingers in a horizontal row along the middle of the keyboard (the home row) and having them reach for other keys. Both two-handed touch typing and one-handed touch typing are possible.

Why learn touch typing?

  1. Save your eyes
    Looking at the keyboard and back at the screen all the time puts your eyes under enormous stress. They need to focus to different distances and often adjust for dark and bright areas. Touch typing will allow you to keep looking at screen at all times and relieve your eyes. The same goes for your neck.

  2. Save your time
    One might think that slow typing is “actually a good thing” because you have more time to think about whavever you are writing. This is nonsense. If you look at the keyboard, you are wasting time. Your brain has to switch from “creativity mode” into “button search mode”. Even if it’s only for a fraction of a second, multiply that by a thousand and the wasted time quickly adds up.
    With touch typing, you teach your fingers to find the keys automatically, without having to call your brain and eyes for help. Muscle memory.

  3. Type like a boss, impress your friends, boost your ego, etc.
    Whatever gets you going, you are still going to save your eyes and your time, whether you want to or not. Haha!

How can I learn to touch type?

The same way you learned to walk or ride a bike. Practice.

There are dozens of very sophisticated-looking programs that will purportedly teach you the perfect touch typing methods. You can try some of those. I have. And I decided to make my own because they all sucked [1].

I don’t believe in perfect methods. You can develop your own style that suits you. You can use only 6 fingers instead of 10 if you want. You can place your hands on the keyboard any way you want. The ultimate goal is to type without conscious effort and at decent speed. That is all.

But what if it slows me down?

At first, it will. Once you stop looking at the keyboard, you will feel a little lost. Like trying to walk around with your eyes closed. You will make more mistakes. You will need to stop to think about the keyboard layout. This is normal. Don’t worry.

Remember to keep your eyes off the keyboard, be patient and practice. That’s all it takes.

Download Type Raiders and start practicing right now.

[1] For example, most of them assume that the only type of text you ever write is plain English. Most of the text I write is technical stuff, filled with special characters. The finger layouts suddenly don’t work. They don’t adapt to the fact that using a modern editing program involves cursor movement using the arrow keys, deleting and moving stuff around, using function keys, switching between windows or multiple open documents.

Games are art, pt. 2

Something went very wrong with the positioning of windows and doors in buildings. With strangely charming results.

Good luck getting home drunk.
Good luck getting home drunk.

Sharing space-time continuum with my neighbours: no thanks.
Sharing space-time continuum with my neighbours: no thanks.

Alien aircraft authoring

Made a simple editing tool for creating new saucer animations.

I have a basic body of the saucer produced by the renderer. Then I add some overlay details that move back and forth and make it look like it is rotating. They need to be positioned precisely and each has to have its radius set according to its position on the saucer body.

Didn't want to edit this by hand.
Didn’t want to edit this by hand.

So I made this. Clicky quicky tweaky!
So I made this. Clicky quicky tweaky!

Now I can take the 12 odd saucer shapes I have rendered and make them airborne in no time. The invasion begins!

Note: Wonder why there’s no saucer in the 2nd picture? Well actually it is there but there is black bar placed over it. I would love to show it to you but I’m bound by the Martian Invasion NDA (Non-disclosure agreement) that states that if I reveal it too early they will come and get me and perform some serious probing on me.

Luckily the NDA will soon expire.

Various dishes, esp. saucers

Adding flying saucers to Type Raiders has proven to be quite difficult. It took several very different approaches before I settled on the right technique.

Making a flying saucer by itself can be quite easy. The basic Devastro saucer, for instance, is actually a photo of a cooking pot.

So first thing I tried was doing the same for Type Raiders. But after a few moments it turned out that a closeup photo of a small object just doesn’t match the precisely looking buildings and ground textures. It’s completely out of scale.

The next technique I tried was sculpting clay. I was quite optimistic when I was buying the clay, I still had hope when I unpacked it, but I lost it all when I saw the result on screen, floating above the buildings. I need them to look like they come from another world, but not like that, thank you.

Next experiment – design a set of saucer silhouettes, then fill them in using various textures and scaled down photos of round objects in Photoshop. Again, had pretty high hopes for this but, again, it just didn’t work that well. I’d actually give this technique 6 points out of 10, but for such an important element of the game I needed a clear 10.

Here’s the sheet with the silhouettes I made:

Guess which one is from Earth vs. Flying Saucers?
Guess which one is from Earth vs. Flying Saucers?

I still liked those silhouettes though. Given that they were just combinations of basic shapes (as can be seen in the image above), they looked really nice. What could be done with them? Well, how about taking them to the 3rd dimension? Ha! I could take those, convert them into vector shapes, rotate them around the Y axis, set a solid material for the resulting object, pass it through a high quality raytracer and voila – a virtual 3D lathe for extraterrestrial craft!

No, that's not it. Stupid 3rd dimension, work! Or I squash you back into 2D!!
No, that’s not it. Stupid 3rd dimension, work! Or I squash you back into 2D!!

We come in peace. We come in peace. We come in peace.
We come in peace. We come in peace. We come in peace.

I won’t show you the mockup screen I made to see how it looked inside the game, since it still needs some refinement, color calibration, lighting, animation and some widgets mounted on top but trust me – it looks awesome. And I can make new saucers in minutes.

Now if you excuse me – I’m off to watch Mars Attacks! yet again, this time taking snapshots of the saucers to make more silhouettes.

Washing a keyboard

My favourite keyboard, the flat Logitech UltraX Premium, had been giving me trouble. Some keys were getting stuck down when pressed and only popped back up after a few seconds, very slowly. Quite frustrating.

So I decided instead of sending it in for replacement to do a little experiment and see if it was true that you could wash your keyboard with water.

I found what I hoped would be a temporary replacement keyboard, unplugged the Logitech keyboard and took it to the shower.

It felt a little weird and wrong to point the shower head at it and turn the tap. I immersed it fully into water for a few minutes, cleaned it with a soft brush, then pulled it out and let it dry over the rest of the weekend.

Guess what happened when I plugged it back in? It worked PERFECTLY! Every single key works, the NumLock and other lights work and the stickiness is 100% gone. Just like new! Hooray!

And I just found out that some people even put their keyboards into dishwashers. Look! boingboing.net/2005/05/30/clean-your-keyboard.html

UPDATE: washed the temporary replacement keyboard too. Plugged it in after two days of drying in the sun. First it looked like it didn’t make it through. Some keys were sending two different characters when pressed. For instance pressing o would send op and vice versa. I gave it an additional day to dry before throwing it out and voila – now it works 100% just like the Logitech one.

UPDATE 2: another one washed without problems, this time a generic PS/2 keyboard. Took a little longer to dry but works 100% now. So much dirt!

Bye-bye Baby! Hello 70 points!

Today I got a little sidetracked by cars. I was working on road and pavement surfaces and thought about adding cars to the game. Or car wrecks, to be more precise.

Initially I just wanted to add cars that were already wrecked, since that’s pretty easy. But then I thought it might be feasible to actually have pristine cars that would explode as the game progresses and make them part of the gameplay. So I did an experiment with a single car to see how it would go.

I took a picture of a car, cut out the outline, added a shadow and dropped it on one of the new roads I had made.

Then I messed up the bodywork a little bit and removed the wheels. After that I added several layers of textures that made it look broken and burnt.

I think it turned out pretty well for a 30 minute experiment so I might be adding destructible cars to the game after all, although I’m not going to use this particular one because of the angle of the photo.

Simple undo/redo system for C#

So you want to add an undo/redo system to your program? OK.

First, we need to separate the GUI from the code that actually does stuff. This is sometimes called “a command design pattern”. Each command should know how to “do” stuff and how to “undo” it. It may be as simple as this:

public interface Command
{
    void Do();
    void Undo();
}

Second, we need a class that will keep track of what commands have been applied and which ones haven’t. Let’s call this class History. It knows where we are and what to do (or undo) next. Again, pretty simple. So let’s add some more functionality while we’re at it. Our History class will notify us when a command is executed and will know if there are any unsaved changes. Here goes:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


public class History {

    private List commands = new List();
    private int lastExecuted = -1;
    private int lastSaved = -1;

    public delegate void Changed(bool haveUnsavedChanges);
    public event Changed OnChanged = (h) => { };

    public void Clear() {
        commands.Clear();
        lastExecuted = -1;
        lastSaved = -1;

        OnChanged(false);
    }


    public void Save() {
        lastSaved = lastExecuted;

        OnChanged(false);
    }


    public bool Modified {
        get { return lastSaved != lastExecuted; }
    }


    public int Size
    {
        get { return commands.Count; }
    }


    public int LastExecuted
    {
        get { return lastExecuted; }
    }


    public void Limit(int numCommands) {
        while (commands.Count > numCommands) {
            commands.RemoveAt(0);
            if (lastExecuted >= 0) {
                lastExecuted--;
            }
            if (lastSaved >= 0) {
                lastSaved--;
            }
        }
    }


    public void Add(Command command, bool execute) {
        if (lastExecuted + 1 < commands.Count) {
            int numCommandsToRemove = commands.Count
            - (lastExecuted + 1);
            for (int i = 0; i < numCommandsToRemove; i++) {
                commands.RemoveAt(lastExecuted + 1);
            }
            lastSaved = -1;
        }
        if (execute) {
            command.Do();
        }
        commands.Add(command);
        lastExecuted = commands.Count - 1;

        OnChanged(true);
    }


    public void Undo() {
        if (lastExecuted >= 0) {
            if (commands.Count > 0) {
                commands[lastExecuted].Undo();
                lastExecuted--;
                OnChanged(lastExecuted != lastSaved);
            }
        }
    }


    public void Redo() {
        if (lastExecuted + 1 < commands.Count) {
            commands[lastExecuted + 1].Do();
            lastExecuted++;
            OnChanged(lastExecuted != lastSaved);
        }
    }
}

You can drop these two classes into your project and start using them right away.

NOTES

You may run into a situation where you think you need to undo/redo multiple commands at once. For example, you have an editor that allows the user to select and change multiple objects simultaneously. There is a simple solution for this – implement a single additional Command – one that keeps a nested list of other commands and calls their Do() and Undo() methods all at once. Reverse the call order for the Undo().

Also, if you’re wondering what that “execute” flag is good for in the History.Add() method, imagine an editor that allows moving objects by dragging them. You probably don’t want to have a separate Move command for every tiny mouse move, do you? What you really want is a single Command that will put the object back into the place where it was when the user pressed the mouse button and started dragging it, right? Well, just remember the original coordinates and keep updating the object yourself with each mouse move. When the mouse button is released, create a Move command, give it the original and the new coordinates and add it to the history without executing it.

Český jazyk

This post is in Czech. But only just…

Co se stane, když lidi zleniví a začnou komolit a kumulovat anglické odborné výrazy v běžné řeči? Toto:

ajtema = položka
alfový imidže = obrázky s údajem o průhlednosti
autlajna = obrys
bagy = chyby v programu
begraundovej = na pozadí
čůznout = vybrat
debagátor = nástroj pro ladění programů
defaultní = výchozí
deskripšna = popis
devajs = přístroj
dizejblovaná = vypnutá
eksepšna = výjimka
ekspa = úroveň zkušeností herní postavy
ekstenžna = přípona názvu souboru
esajnout = přiřadit
esefikska = zvuky
fajlnejmy = názvy souborů
fajlujou = nejdou
fajtit = bojovat
fíčura = charakteristická vlastnost nebo rys
fiksnout = opravit
gárdovat = hlídat
getnout = stáhnout
invalidnout = zneplatnit
karentní = stávající
kjůnutej = zařazený ve frontě
klása = třída
kolamny – sloupce
kolory = barvy
kondišna = podmínka
kveráče – dotazy
kvesčna = otázka
lajna = řádek
lejer = vrstva
limba = končetina
loknout = zamknout
louduje = nahrává
lýd = vedoucí
merdžátor = nástroj pro sloučení dvou variant textu
nafejkovat = napodobit, vytvořit maketu
nakauntit = spočítat
očekovat = zkontrolovat
odzůmovat = oddálit
opšny = nastavení
pejntění = zobrazování
prioritnější = důležitější
proprta = vlastnost
randomní = náhodný
recenzátor = recenzent
rektangly = obdélníky
rekvestnout = vyžádat
restórnout = obnovit
risórsy = data
rispónovat = znovu se objevit
roudmapa = plán práce
sabmišna = podání
šejpy = tvary
selektnout = vybrat
serčovat – hledat
skanclovat = zrušit
skily = schopnosti
skrýna = obrazovka
sortnout = seřadit
stórovat – ukládat
tajly = dlaždice tvořící herní plochu
templejta = šablona
tred = vlákno programu
voeditovat = upravit
vohekovanej bak = nedbale opravená chyba
vybildovat = sestavit
vydebagovat = vyladit
vyimportovat = exportovat
vykilovat = vypnout
vyklínovat = promazat
vylevlování = zvýšení zkušeností herní postavy
vyreportovat – nahlásit
zafiksovat = opravit
zasetovat = připravit si pracovní místo
zkonvertovat = převést
zmerdžovat = sloučit

A nyní si vyzkoušíme celé věty:

  • Jste si jistý, že to de vybildovat z toho escéemka? Já jsem na slabejch třech errorech.
  • A getla sis to z escemka?
  • Nojo, getla.
  • A co tou komandlajnovou konvertační sračkou to vobesrat?
  • Je to sejvnutý v globálních devajsech?
  • Jakej je tam zrovna karentní jazyk?
  • No a ta zbraň enejbluje kritikly.
  • Musíš tam akorát naparsovat ten textovej fajl s těma idéčkama a nebo tam dát defaultní.
  • Ty kdybys posílal eksepšnu karent tredu, tak jí můžeš poslat úplně komukoli, žejo.
  • Máme to vyrendrovaný jako frejmy v tyfu.
  • To forsneš když sejvuješ prefsy a vono se to ouvrajtne.
  • Lebo on jak louduje tu klasu, tak se to vyjebe a je to v piče.
  • Mě už vizuálně viděl.

Promiňte, odcházím zvracet. Nashledanou příště.