Simple TMX tilemap parser

Here’s a simple C++ class for loading tile map data from TMX files produced by the Tiled map editor. Contains Xcode project with demo.

USAGE:

NLTmxMap* map = NLLoadTmxMap( "map1.tmx" );
std::cout << map->width << " x " << map->height << std::endl;
delete map;

Download the project here.

LIMITATION: you need to select “CSV” map data encoding in Tiled preferences. I didn’t bother with decoding the base64/gzip formats that Tiled also supports.

Java game development

Java had the potential to be a very good platform for game development.

A garbage collected language significantly cuts down development time. The editing and refactoring tools are fantastic. Compilation is lighting fast. Debugging is easy. There are solid OpenGL and OpenAL bindings available. Runtime performance is fine.

Java runs on many platforms and it is not at all a bad choice for any of them. But it is not the right choice for any, either.

None of the major platforms now comes with a JRE preinstalled. The Windows installer is a mess, the future of the Mac implementation is uncertain. Java is not available to developers on any of the console platforms and the only mobile platform that sort of supports Java programming is Android.

There is no standard way of making a Mac app bundle out of a Java program. There is no standard way of making a Windows installer or executable out of a Java program. You have to do everything by yourself. Write Ant build scripts, make NSIS installers, EXE launchers, Mac app bundles, program icons. There is NO official support for this.

Here is a list of things I think could help:

  • Get rid of jusched.exe. Use the standard Windows scheduling service like everyone else. Even Google eventually got that right with their update service.
  • Get rid of tray icon.
  • Allow custom JREs to be bundled with software products. The current license doesn’t allow me to go into rt.jar and remove the 90% of stuff my games don’t use. A 50MB game is inflated by 100% by the standard Java libraries.
  • Add a standard way to make an EXE file / Mac bundle / Linux binary that launches a Java program. CMD/BAT/SH files look amateurish and cannot have icons.
  • Make it super easy to create an embedded version of the JRE, cut down to just the stuff the program uses, ready to go. In fact, embedding the VM and the libraries and the Java program itself all in a single EXE file automatically would be the best way to do this.
  • Make Swing use native controls for everything. Or switch to SWT and get behind it 100%.
  • Get rid of the stupid mascot creature and pretend it never existed.
  • Remove Java Sound. It is a bunch of complex unusable interfaces written by architecture astronauts. Nobody uses it.
  • Use a sane versioning scheme. Java 6.0.21. Oh, and, you know, stick to it from then on.
  • Open up the new self-updating mechanism so that any Java program can use it to update itself from its developer’s site.
  • Make it easy to retrieve the proper location of users’ home directories. Documents, Pictures, App Data, stuff like that.
  • Merge server and client JVMs into one. It is confusing.

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.

Type Raiders released

It is my great pleasure to announce that I have just finished and released my new game, Type Raiders. It is a nice little game with gorgeous graphics that makes it really easy and fun to practice touch typing.

Windows and Mac OS X downloads are available here.

If you like it, have some suggestions or if you find bugs, don’t hesitate to email me. Thank you.

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!