Saturday, January 12, 2013

A good start is half the work

A bit late but...
* starting Abba
Happy new year, Happy new year,
* shoots Abba *.

No one blew of his head during New Year's Eve? Good. 2013 started with mixed feelings here. Good because one of my friends finished their house after a lot of hard working, and the T22 blog reached 50+ readers. Nothing compared to truly popular sites, and if you really care about viewers you should piss on your little sister during her sleep and put it on Youtube. But still, a few years ago I would be happy there if maybe 5 readers would be interested in T22, so it feels like a little Milestone. Yet another good personal thing were promotions on work where I get more in charge of the technology/software used on all our machines. Which is certainly not that naturally anymore these days we're people lose their jobs or got to fight to maintain some work.

Mixed feelings, because that shitty crisis finally also struck my family. Little work in the construction sector means little or no more work for my father. It's not that he will starve now, but for someone who still likes to work and did his stinking best making big factories, stadiums, flats and other awesome buildings the past 40 years, this is not a honorable end of his working career. Neither a promising fate for my little brother who finished a complex study in the same sector, and can't find a proper job now. So as much luck I got with my jobs, so bad things can go with family. Or Spanish friends I met via this project, that are desperately looking for whatever they can do to make a little income.

So besides wishing you a good health and love, I especially wish you luck with keeping or finding work. This world was made by hard working men and women, and let's keep it that way. Crisis or not.



As for T22, 2013 gave a nice starting shot as well. Hopefully it wasn't some silly new-year fad, but suddenly several guys offered their help on T22 (after some months of silence). Not all of them passed, yet help offers are always heartwarming. And two of them, Mario & Fransisco (both Spanish, as most of the team members by now) are going to help on what we call "Global Mapping". Not global warming, but making empty maps. One of the reasons why our progress is slow, is because so far we focused on demo's and made just a few rooms in full detail. Making a room mesh isn't so much work, but decorating it with textures, furniture, lamps, decals, new shaders, sounds or whatever needed, eats a lot of time. With as a result that still little maps have been made... meaning there is no actual game to play. You can run through a few rooms, and then our flat world ends. In order to create & test gameplay such as exploration, solving puzzles or arm-wrestling with monsters, you need some maps at least. Then decorate them later.

So, in contrast to the real world, there are a lot of construction sites in T22, and hopefully Mario & Fransisco can help us. Further. "Demo4" is getting more shape. Federico & Diego made quite a lot of cool things last weeks to transform the ugly empty corridor to something gloomy, spooky, scary. I can't show too many pictures yet. First because their assets aren't 100% finished yet, and second because I need to reserve some "exclusive shots” for a magazine that likes to make an interview... But anyway, I’m hoping we can finally show a movie again somewhere half this year.
First results coming in. Though the textures aren't finished yet, it doesn't look bad for a first empty version. Notice the ceiling betting lit (realtime) by the new implemented GI solution.


As for my own progress, besides the realtime GI finally getting a bit successful, time was spend on upgrading the animations. As you may remember from the first demo, we already had an animated rusty garbage-can-player-robot, and the ability to pick up things. But during the last 2 years, I changed a lot of things in order to make it all better and more flexible / programmable. One of the open tasks was to switch over on a 3D-animation format processionals would use. Which isn't Milkshape (though I still like the tool for its clean simpleness). Now that we have an animator, Antonio, it was time to get his Blender / Maya work imported somehow....

But what file format to chose? Since I already had some Collada stuff implemented, I decided to extend the Collada importer. Which was a waste of time. I liked the format at first, but reading the rig alone was confusing as hell. I'm sure it's documented somehow, and I've seen tutorials as well. But it seems each 3D package delivers different output in this "universal" format, and the skeletons resulted in the typical Steven Seagal treatment: broken limbs. Problem with Collada is that it's so goddamn big that is has become too complex to quickly extract the fraction of data you need out of the file. And no, I'm don't have patience to sit, read, try, and learn for days. Writing a file reader shouldn't take more than a few hours. I'm making a game, don’t to care about file loaders. Bah, didn't like the XML overhead from Collada anyway.


So, I switched over to Autodesk FBX, another sort of "common" file format. The file looked simple at first when having a preview in Notepad. Yep, that would suit fine... Turns out that FBX is just as worse as Collada. Reading a mesh and some objects is childsplay, but getting the animation skeleton properly requires some 16th grade Tesla formula's. And of course, no simple small example with copy-paste code.

But wait! Autodesk also delivers C++ code so you don't have to bother reading the actual file. Since I'm using it would require to make a C++ batch program first to convert FBX files to another much more logical T22 format, but ok. I can live with that. But, the fuck. That stupid API doesn't just read FBX files and gives you some 3D objects. Hell no. It launches missiles to Moscow, it can be used to control Space shuttles, reads bedtime stories for your kids, and goes to bed with your wife. Yes, yet another overdone super-file-good-for-everything-and-therefore-waytoohard-to-learn platform.

But all right. After a few violent nights I finally extracted the few bits I actually needed from a FBX file. So, animations can be imported now, as well as assigning sound effects or special programmable events to keyframes. For example, at 0.3 seconds the weapon should fire a bullet & say “bang!”, at 0.31 show a nozzle flash sprite, and at 0.34 spit out an empty bullet case. Yep, time to make an animated, firing gun now!

And the moral of the story? Hire a script kid that makes a plug for Maya/Max/Blender/X that directly saves stuff into your own much cooler file format.
Radiator made by Diego (and no, the green block doesn't belong there).

6 comments:

  1. Ah, the tiresome act of choosing the right file format. I've been through that some time ago and it can become really frustrating. I wrote a COLLADA importer too at first and dropped it just like you because that format is just too bloated. It's nice for interchanging betwee different DCC apps but not for 3D files in a final product.

    In the end I opted for the Direct3D Mesh format. It's pretty easy to write an importer for the ASCII-version, almost every 3D DCC tool can export to it, it's extensible and stores everything a 3D game needs. Though the problem ist that you'll have to write your own importer when using OpenGL. And to speed up things I also wrote a converter from these .X meshes to my own binary format so that loading them into my games is going faster.

    And the option to write a script for your favorite 3D DCC tool would be the best (unless you want users to generate their own content), but as you said it's not trivial. I tried this for 3D Studio and just gathering vertex data for the meshes almost made me go insane, so I opted for the above way.

    Oh and I'm one of the 50 regular readers on your blog and hope to see a new demo soon ;)

    ReplyDelete
  2. Hey Sascha. Writing file readers (or writers) is indeed boring. Some are simple and just a matter of reading a few guidelines on websites like wotsit.org, others are bloated or just unlogical. And wether you like the format or not, its success finally depends if the (3D) software is supporting it (properly). For T22, some work with Maya, some with Max, others with Blender, yet another with Lightwave. They all support OBJ, but more complicated formats that can be used to export skeletons and animations are a different story.

    Well, it seems the FBX importer works... though I still got to see it first with a complicated humanoid model (right now we're animating a gun, so that's still easy stuff). The official Autodesk FBX file viewer for Quicktime didn't manage to load that same gun properly hehe.

    We're hoping to get the demo done within the next 5 months. But I'd better not make hard promises. It all depends on the availability of the guys & myself.

    ReplyDelete
  3. Have you tried Assimp (http://assimp.sourceforge.net)? It can import and export to various 3D formats. I used version 2 and found it quite good (now there's version 3 that have lots of bug fixes). It loads data from the files and put them in common classes (Mesh, Skeleton, etc).
    It doesn't support every small feature of each format but can be life saving having not to parse data from those files by "hand" ;)

    One of the worse format i handled in the past was DXF... i needed to create a file with some lines in it and at the end i just saved an empty file from AutoCAD then added a marker inside the text file where i needed to append the data... but i had to put unique ids to each entity because if not the software would just crash...

    ReplyDelete
  4. Assimp... Long time I heard of it, but indeed, that could have been handy indeed. And it seems it even has some Delphi units for the (C) DLL. Usually I just write my own stuff to avoid the boring job of making a Delphi interface unit to hook up with the DLL.

    It's a bit too late now, but next time when having to deal with 3D file readers, I put aside my pride and give Assimp a try :)

    AutoCAD files. Seems Autodesk does stuff "their way". When modelers give me files from Maya, Blender or whatever, it's always ok. But when it comes from Max, the rotation and scale are different for a start. They play a big role in creative computer land due their wide range of applications. But I hear from quite a lot 2D/3D guys they don't like the way AutoDesk forces them into things. Asides from writing some plugins in for Inventor & Vault, I never used any AutoDesk products so I can't judge really.

    ReplyDelete
  5. I don't think any commonly known format is suitable for games (maybe apart from some BSPs and such) ... it's often good as base format though.

    We're working with extended OBJs (basically only extending materials to support all stuff we have) and MD5s. Internally we convert them in our representation (F.e. we need triangle adjacencies, tangent space vectors, etc.) and save them into our own binary format (this highly reduces time to load).

    To the 3ds max - it indeed has swapped Y and Z axes, and one of them is even negated (the Y in max - so the Z in app). This can be a bit scary when one has to work with it for 1st time (our MD5 loader was totally broken), and same thing goes for pivotting in 3ds max (when format stores pivots, it really uses them - and most loaders doesn't take it into account).

    *And even though I'm not one of 50 regular readers, I'm regularly visiting this side for news. :)

    ReplyDelete
  6. Hey Vilem,

    Here everything gets converted to a binary format too, trying to load as much bulk as possible (reading large arrays at once is nice for streaming as the IO can be done in a background thread).

    Formats like FBX or Collada aren't meant for games, but to exchange between 3D packages. Yet I wonder how many of those packages made a (bugfree, complete) importer/exporter of those... Big products probably have the manpower and patience to put a programmer full time on such plugs, but other smaller programs... I doubt if it will ever beat the simplicity of formats such as OBJ.

    Yet in this particular case animations were involved. I made a MD5 importer once years ago (which was easy), but I couldn't find proper exporters for Milkshape or Lightwave, so that made MD5 pretty much useless. I believe Maya and Blender have better exporters for MD5, but since I don't own those programs...

    ReplyDelete