Monday, December 26, 2011

Take 48, cut

Next post will contain a movie release. Unless I get heartfailure while stuffing myself with Christmas food.

For those who expect another gameplay / spooky horror trailer, I'll have to disappoint you a bit. It's a "Tech-Demo". Which means it shows graphical stuff mainly. The goal is not to please gamers. Screw you, the whole purpose is to attract more 2D / 3D talent :p Ok, ok, we added a little present that might please you as well ;) Nah, the movie could represent a Tower22 part (although T22 does not take place in military looking Radar Stations). It's a little taste of how things *could* look (and even better)... IF we get a team strong, talented and motivated enough to help me through that is.

One problem to tackle with this next movie is the recording quality. Main issues last time were the hellish sounds and overdone blur. Both caused by the combi of Tower22 and FRAPS taking the same CPU resources. Two mangy dogs fighting for a stinky shoe. Two old ladies arguing about the TV channel. Two hoes pulling each other’s (pink)hair for a pimp. Two . Anyway, a year passed by, plenty of time to evaluate and prepare better for a next time. So what did we do? ...Ehr...

Doing homework was never my strongest skill. In contrast to Postponing. So I started sweating again for the recording session. The desktop computer used for recording has a newer video-card, so the good news is that it should have some more firepower this time. Then again, this new demo is quite a lot more advanced than Demo1. More lights, more shading tricks, more textures and objects, et cetera. On top, I didn't try the engine for half a year on that computer. Oh boy.

As expected, the framerate crippled again, but not as bad as previous time. After some optimizations, FRAPS and T22 eventually got in Sweet Harmony. Sort of, at 20 frames per second. That's still not smooth as silk, but already better than the previous time, plus the resolution has doubled as well. Maybe we can squeeze out a few more frames.

A far better approach would be recording the video-card (HDMI?) output with an external device. Like you could record your Super Mario Paint(snes) movies on VHS. Hmmm, maybe I should buy a digital camcorder or something. Let it store the video-card output on a disk, then read the digital file back on the computer. Never tried it, but it sounds like a valid plan. And otherwise you'll have to do with a more jerky movie :p

Still have to pimp a few rooms. Julio takes a snapshot of an existing room, adds some photosoup magic, then passes it back so I can try to achieve the same thing with the engine.

One thing I could solve software-o-matic, was the camera path. Like in real movies, it sometimes takes several cuts to record a scene. Or did you think Commando was recorded in one single shot; Carry tree, smile horrible while daughter puts ice on nose, smell enemies, get down, kill enemies, daughter gone, get captured, kill guy and say he's dead tired, jump out of plane, go to shopping mall, throw telephone cell, drive, chase, crash, throw little guy from a cliff, fuck-you-asshole, infiltrate hangar, window shopper, get busted, get freed, fly to a tropical island, undress, boat, dress & makeup, kill a few with tactical stealth tricks, kill 10 dozens more being absolutely not stealthy, kill with an Uzi, kill with a shotgun, shed fight, get in the villa, shoot gringo warlord, go to the basement, get shot in the shoulder, knife-fight with a fat moustache man in a chain mail (hu?), blow some steam Bennett, found daughter, happy, -fin-. Bang, 90 minutes.

Arnold Schwarzenegger has awesome acting skills, but not so awesome to shoot this movie in a single 90 minute-breath. Hey, not even fucking Commando himself can do that, cause the timeline was spread over 12 hours in the movie. Enough kidding. Of course movies take multiple shots, with multiple camera's. And afterwards, the best parts are pasted together.

With games that use a first-person-camera, this isn't so easy. If the camera suddenly shifts 30 centimeters to the left, or if the lighting suddenly goes a bit darker, the viewer will notice this "discontinuity". Do it too often, and you'll get an epileptic attack. Movies tend to switch the camera viewpoint every 5 seconds or so. This "switching" helps hiding discontinuities. Maybe the actor moved 10 cm to the left, maybe the sun stopped shining, maybe he lost his boner a bit(other type of movie). Or maybe a plane just happened to fly over the Coliseum, roughly 2000 years ago. Neither did I know a camera crew was taking part of the battle in Ramelle. The point is, the viewer doesn't notice because (s)he's focused on the actors, and the camera switching hides faults too. Hence, did you know T22 Demo1 was made out of 2 parts as well? When the player runs the stairs up, a second movie was used at some point. Yep, when the camera switched from third to first person view.

This time I won't be switching camera views, so everything has to be recorded perfectly in one time. And that's difficult! You have to make sure the camera captures all the wanted "hotspots". Not too long, but not too short either. We amateur camera-men tend to record things boringly-long, or in turbo-pace. If you know what you are seeing, focusing on it for 2 seconds seems like an eternity.
But for another viewer that is not familiar with the scene, it takes at least a second to re-focus. I always get dizzy and sick of those MTV shows where the camera crew seems to be on speed. Yo biatch, my kitchen, home cinema for real, here’s where it all happens in the master bedroom, 50 inch rims, now get off my property. 10 billion shots, they sure show a whole lot. I just have no idea what I just saw the last 10 seconds. Too fast. Anyway, finding the right pace for a movie shot is very important. And last but not least, the camera has to follow its path in a somewhat natural, curvy way.

In my case, I have to navigate the camera for ~6 minutes (that's how long the movie takes) without making faults. With a jerky mouse. With FRAPS and T22 arguing for (CPU) resources. With a little kid making noise in the background. With a girl that starts talking about, ...-hell I don't know- while you are sweating and recording the whole thing. You can't do it in 2 or more parts, cause it's just impossible to redo the exact same camera path. So at the stitching points, you suddenly see the camera hopping to another point, the lighting changes, et cetera.

Moving the camera down a stair, with a curve, is difficult enough already. Doing it twice exactly the same is impossible.

Do the loco-motion logger
Hey... But I got a little idea! Nothing new really, yet very useful. What if you lock your family outside, don't run FRAPS, and run a "motion logger"? Yeah, just store the camera view every (few) cycle(s). In my case, I made a little class that stored the camera matrix 15 times per second. Just directly writing it in an opened file-stream. If you are really cool, you make a background thread that fills 2 buffers and store those in a filestream, but that wasn't necessary for the little amount of data in my case. To give you an idea about file-sizes,
---- 5 minutes = 5x60 x 15(fps) x matrix(64 bytes) = 282 kilobyte
That isn't too bad. Otherwise you may store quaternion’s instead of matrices to save more space.

Now that we have the camera path stored, we can redo the navigation with a click on the button. Store all matrices in a gigantic array or better, make a (background) streamreader that fills a buffer with matrices each X seconds. Then calculate the actual camera matrix by interpolating between the current and next frame matrix. The path is 99% identical to the one you recorded earlier. Eventually you can relax and edit parts now, or let the computer calculate a spline to get a more smooth route.

In case your girl started talking about spaghetti or your little brother kicked your legs while recording, causing your mouse-hand to do make a jerky movement, it's relative easy to polish. Let the camera follow the path till the point where things went wrong. Stop it, hit the capture button again, and now do a second attempt. The newer part should fit seamlessly with the previous one.

When you're finally happy with the camera route, you can finally record the movie for real. Just let the camera roll over the railtrack again, sit back, and relax. Even when the video capture program causes a jerky framerate, the camera will keep stable cause no human input is needed anymore. What a relief.

Sunday, December 18, 2011

Turbo Boosters

One visitor asked; "Dear Santa. Where do all those magical presents(effects) in your T22 world come from? And how do you prevent the sleigh from crashing down when loading more and more of them? Yours truly, Nick, 7 years old, Nebraska.'

Well boys and girls. If you think the Tower22 engine ("Engine22") is fast as hell, ho-ho-ho, no. To the facts; currently the "Radar Station" maps run at a pounding ~17 frames per second on my laptop. Of course that depends a bit on the view. When staring at an empty corner, the speed may be an acceptable 28 fps. When looking at multiple rooms that also contain a dense cloud of litten particles, the laptop switches over to Burger-King-gravy speed: ~12 or even less.

The laptop is getting old though. 32 bits, and moreover, "just" a GeForce 9800M GTS. A game like Crysis Warhead doesn't run smoothly either, though faster than this. My other desktop computer gets far better results. It's also a 32-bit dual-core relic from the past, but with a better video card (EVGA GeForce 4700 GTS). The first Demo movie for example ran about 25 frames per second on the laptop (the dark empty corridors faster though). And near to 60 fps on the desktop. Another comparison. The "Radar Station" we're working on now (almost finished!) started at 25 fps on the laptop. And now after adding more textures, more effects, more lamps and more objects, the framerate dropped to the ~17 mentioned earlier. No idea how it will behave on the desktop, but I guess it will be "acceptable". Well it better damn be! Otherwise we'll get that annoying motion-blur again due the relative large cycle intervals ;)

Compare this to this. At least the framerate dropped for a good cause :)

For gaming, such a low framerate sucks ass of course. Ever played Doom1 on a 386? You wanted to play the game so badly so you kept pushing, but the PC really said “please no! Stop it!”. For development though, a lower speed is "ok". I'm not playing, just flying through the maps to check coding adjustments or to decorate the maps. That's also the reason why I barely touch the much faster desktop computer. With a laptop, you can at least code in bed, in bath, on the toilet, while being kidnapped by al Qaida, or wherever you are. So, I prefer mobility over speed in this case.

Also have to notice that "dropping performance" happens in a gradual way. It's like getting fat; you don't gain 10kg after a week of snacking (unless you drank 6 kegs of beer in a mug like this -blurp- ). It's not that the framerate suddenly cripples when adding effect-X. Nah, usually it just slows a tiny little bit. You barely notice it, so, nothing to worry about. But all those tiny bits together...

As said, the performance cannot be compared to commercial engines. Simply, I have too little time and less experience to make it lighting fast. Then I don't worry that much about it either. It will still take years to finish this game, so performance tweaking right now is a bit of a waste of time. 2 years later there will be faster hardware, plus some of the techniques we're using might be replaced by then. Especially things like (ambient) lighting And the parallax effect showed earlier also keeps getting smarter, faster algorithms. So, I'll just take a look at some of those techniques in a few years from now again. Well, in fact, 1 or 2 graphics-programmer experts can help by then. Optimizing shaders, give professional advice, find bottlenecks, et cetera. But at this moment, maximum performance is certainly not a priority.

No, the damage on those tiles wasn't there first. It's just a flat decal, faking depth with Parallax Occlusion Mapping...

Nevertheless, that does not mean we just blindly adding features. First of all, an effect needs to be worth it. There are dozens of papers that show awesome stuff. The next best things to sliced breath... ahum, in theory. But more than often they come at a high cost, and/or require a very specific implementation that may restrict other things in your rendering pipeline. Take BRDF's for example. By using real-world sampled data and specific formula's, you can create a (far) more realistic look on your materials. Gold doesn't reflect light in the same way as velvet, concrete or a freakn grapefruit for that matter. Yet most games treat all the surfaces with the standard "Blinn" or "Phong" lighting model (which explains the plastic or metal look on softer surfaces such as skin or wallpaper). Why not using BRDF's then? Well:

- Hard to fit in a deferred/inferred rendering pipeline (cause the lamps have to check on each pixel what kind of material they were made from, then have access to the BRDF parameters somehow)
- Only 0,1% of the artists knows how to make BRDF (image) data. And most of the programmers don't know how-to either.
- And even if they did, it requires fucking professor hardware for the BRDF acquisition. You can't just draw them by hand you know...

- As for the end-result (thus with several lamps, blurs, SSAO, ambient, reflections, post-filters and a ton of other effects applied), an untrained viewer barely notices the difference between a concrete wall rendered with Phong or Oren Nayar.

So is it worth it... Hmmm... Eventually probably yes. But as long as we need the performance elsewhere, techniques like BRDF, or slightly sharper shadows are usually exchanged for more noticeable things such as sexy blurs or being able to put more objects in the scene. The Parallax effect is discussable too. Google for "Parallax Occlusion Mapping", and you'll see that the coolest screenshots always placed the camera right next to a brick wall or on the floor. But how many times will you see surfaces from that close really? When you got killed and fall onto the ground maybe, but otherwise the parallax effect, and certainly the subtle "self-shadowing" effect is hard to notice. Yet it comes at a very high cost. That's why we only use it for rough surfaces with obvious height differences. It's a pretty cool effect, and hardware starts to allow it. But if you run out of rendering-power, POM would be one of the first things to ditch I'd say.

Cool, POM and shit(Parallax Occlusion Mapping). But do you still see the effect now? Same wall (below the sink), but zoomed back to a more realistic viewing distance...

Second things about maintaining our performance. When I do add an effect, I'll try to do it in a smart way. GPU's are powerful but hate to get interrupted. It's not like a multi-tasking woman that can phone, cook, chat, watch the kids, and clean the house at the same time (at least she thinks she can). Best is to create batches and do as much stuff as possible in one call. Sort out data, try to render bigger chunks with the least "state changes" as possible. That's pretty hard these days with so many different effects being pre-processed in the background. ShadowMaps need to be prepared, Animated objects such as cloth or characters may need to stream their data to a VBO or texture first, you'll need depth, velocity and all kinds image data before you can render SSAO or motion blur, and so on. What you see in the Tower22 screenshots is only a small portion of what really happens on the GPU. Before it starts rendering screen content, it draws shadowMaps, cubeMaps, mirror(for water reflections), and plenty of other things.

To prevent getting slower than a tranquilized panda, these steps are combined if possible. With MRT (Multi Render Target) different types of data are rendered to different textures, but in the same pass. Which means I only have to call the GPU to draw the world geometry once. I also sort the steps on screen resolutions so that the GPU has to less switching between Frame Buffer targets on different resolutions. Just a grasp.

Yet another trick to speed up is sparing bandwidth by using compressed textures, or keeping the geometry as much as possible on the videocard itself with VBO's (also for skinned/animated things). The latter means that the triangles and additional vertex data for, let's say a monster-model, is already present on the videocard. So we don't have to re-send all the triangles from the RAM memory to GPU memory (via the CPU) each cycle again.

Texture with particles, rendered in the background on a lower resolution

Whatever you do, don't just do it without thinking. Often there are multiple ways to achieve the same thing. So before I just implement something, I usually ask around (on Gamedev for example) for some tips. One last example. Particles. The old fashioned way is to render a large amount of (transparent) points or billboard sprites(quads) into your world. A whole bunch of them forms a cloud, bloodspray, smoke, puke, waterfall or whatever you had in mind. But because so many quads are drawn on top of each other, the GPU easily suffers from fillrate problems. The same screenpixel gets treated dozens of times, and that hurts. One trick to reduce the amount of calculations is to draw the particles offline, on a smaller texture. Then in the end, draw the texture that contains all particles on top of your scene. Since the offline texture has a lower resolution, less pixel calculations have to be done. Of course, the quality(texture sharpness) also drops but for foggy/blurry stuff like fart gasses or smoke, this is actually a good thing. Two portions of happiness for the price of one.

Don't know what speed the desktop computer will reach when we record the next Tech-Demo movie. But at the end of the story, I'm focused on making Tower22. Not a super engine. Let's first just build a car that drives properly, rather than a car that drives 300 miles per hour. Besides, let those lazy Silicon Valley’s bake better video-cards instead :p Nah, of course, you can't totally neglect the performance in a game engine. If that car needs to drive faster than 150 mph eventually, you shouldn't start with a Fred Flintstone chassis prototype. But squeezing out milliseconds will be future work.

Thursday, December 8, 2011


Sorry for the lack of fairy tails last weeks... Let's say we're very, very busy finishing the demo movie! And playing Zelda ;)

A lot of stuff has been added. Shader improvements, Parallax Occlusion Mapping, objects, morphing animations, and... I lost the count. Anyway, the least thing I can do is post a few screenshots then.

Waterpool decals

Sunday, November 27, 2011

The finishing garbage detail

Programmers sometimes say games aren't about graphics. Maybe we just tell that to mask our graphical-incompetency’s. But since many gamers also seem to prefer fun above slick graphics, there must be some truth in it of course. Nevertheless, graphics fetishists like me always start a game or engine with trying to make it look as good as possible. New shader here, yet another rendering technique there. And once we're happy and proud of ourselves, we find a new paper or another @#$^! engine ruins the vibe by showing a much better looking approach. We spend so much time on catching up with the graphics and polishing things that we almost forget about other aspects such as... making a fun, playable game. Jesus, we're like women dressing & stressing up in front of the mirror for hours before going to a party.

Obsessions are usually not a very good thing, then again I don't agree that graphics aren’t important. Zelda Skyward Sword is, of course, on my December presents listing. Zelda is always welcome, especially with Christmas. But I can't deny that the outdated Wii graphics are becoming a royal pain in the ass. Nintendo games have never been photorealistic highlights, nor they should. But the first 3D Zelda Occarina of Time looked awesome nevertheless. A day & night cycle, (pre-rendered) photo-like backgrounds, fresh water, an open world. It was the perfect transition between the 2D and 3D era. ~5 yeras later, the Gamecube Zelda Windwaker title looked like a quality Walt Disney cartoon. Not photorealism, but still a visual treat, even between the advancing tech used in contemporaries such as Halflife2 or F.E.A.R. And then the Twilight Princess arrived end 2006... The bright blooming tried to mask the Wii hardware that was dated already before it came out. For me, the result was a dark, grainy, empty, dead world. Zelda isn't about graphics, but while others in the series sucked me in by showing a magical, sometimes weird, but yet cozy "check-me-out!" world, the grim TP world felt cold.

And now the turn goes to Zelda Skyward Sword. Didn’t play it yet, but I must say it looks more colorful, and therefore more atmospheric & interesting to me. But still... those jagged non-anti-aliased edges are like razorblades in the eyes. The characters + facial expressions look like 1999 fruit with a face painted on it. And the lack of lighting compensated by lot’s of bright weird colored textures, looks as if your mom washed your underpants together with a whole rainbow. Sometimes tasteful, other times chaotic and messy. Yes, graphics do count, because immersion counts. Well, let's just hope Skyward Sword does what Zelda does best: delivering puzzles, a fantastic world, and an unique experiences. Although it’s going to be difficult to please this old nitpicker who played the same formula since the SNES already :p

Zelda: Windwakerl; not a technical highlight, but a piece of art nevertheless.

More important in our case, how could T22 be scary if it looks like pixel-blubber? The scary moments will turn out in disappointing anti-climaxes if the enemy turns out to be a Doom2 sprite, or a pile of boxes? Now Silent Hill looks like foggy shit as well, but least it's a consistent whole of foggy shit. Keep in mind that graphics is not only about awesome shaders, realtime lighting, big Hollywood blasts or photo-realistic water. From a programmer perspective, I'm inclined to say a proper graphical engine makes the graphics hot-or-not. But how come that games like Resident Evil 4 (Gamecube / PS2) still looks good even without tons of effects? And how come that custom made maps in UDK, Source or CryEngine often don't look good at all? Exactly, don't underestimate the power of art(ists). The better they master their(your) tools and engine-tricks, the better results they can make. Even with a limited technical toolkit eventually.

When looking at our Radar Station that is going to be used for the next tech-demo, I'm not 100% happy with it. Of course, when seeing the same stuff over and over again for the past 10 weeks, you become tired of your own creations. And as a programmer, my focus goes to the graphical bugs and shortcomings instead of the good parts. Normals inverted. Texture missing. Lamp looks like poop. Parallax effect not good enough, bleh. While a normal viewer may not even notice it. But also a non-technical person can probably tell the screenshots are not quite yet “A++ quality”.

Outsiders, but also meself are often making the same "mistake". And if you're a hobby game/graphics-programmer, you're probably guilty too. The mistake of comparing your (unfinished) results with commercial games you just played, or (Photoshopped) screenshots from super-engines. It's good to put high standards, but give yourself a break! 4 hours in the evening versus 50 hours-in-a-week work times. Two-and-a-half artist versus the 101th Airborne 3D-nerd battalion. A null euro budget versus a X(-hundred)-million euro budget. Even if you master the code, you still lack manpower to create comparable results. Unless you’re blessed with plenty of talented volunteers to help you out of course :)

A brilliant engine still doesn't make good looking 14k meshes + textures for you... Sergi spend quiet some time on his newest invention shown above!

I'm writing about this (again) because I was looking at some details while playing the PS3 Uncharted 2 demo. And at the same time I was figuring how to improve the Radar Station in these last weeks. Maybe check some enhanced parallax shaders, add some more secondary detail textures on the concrete maybe... I'd say our Radar Station looks pretty good, but something is missing... Then when looking at Uncharted 2, I noticed the individual textures, objects or shading-tricks (such as reflections or shadows) weren't that spectacular either. Nope. What really makes their environments look alive and realistic, is the high amount of "stuff" stuffed into it. In our case a balcony is typically made out of a few 3D cubes, 2 concrete textures, and maybe a drainage pipe in a corner. In uncharted, there is small crap on the floor, a broken cable hangs on the walls, pots are stacked up, a bit of water dripping in the corner, leafs and foliage growing over the walls, a pile of rubble in another corner, 6 different textures.... And that's just a simple stupid balcony, a lot more detail can be found in the surrounding background.

Not just quality, also quantity matters. Do you know why the 3D office-room in your game doesn't look very realistic? Because it's empty. In your face! Let me guess... carpet tiles on the floor, a white plastered texture for the walls, system ceiling with (only) 1 lamp, a few (cloned) desks with a computer screen and keyboard on top, some chairs, and a few posters on the walls. Oh, and for the detail-connoisseur: a stapler on one the desks! Probably that stapler looks a bit out of place, because it's the only small object in the scene compared to the desks and computers. Now look around you in the real world. In my little office at work, there is more garbage than one can count. Computer here, computer there. Cables, lot's of. Electrical outlets, 6 lamps in the ceiling to lit the small room, airco unit, papers scattered everywhere, plastic coffee cups, garbage bin filled with stinky banana peels, oil-marks on the carpet, little holes and damage on the wall, some unnecessary chairs in a corner, a backpack below the desk, cardboard boxes with more electrical junk, folders, VHS Videos(hu?), circuit boards, tape, screwdrivers, business cards, elastics, plastic crap, pencils, markers, and so on. And I'm still missing a damn stapler by the way.

Even simple scenes carry more detail than you would see at first. Just take a look in a random hallway. Wood-floor, painted wall, stone ceiling... That's only 3 boring textures. But look again and better this time. You’ll notice radiators, cables, wires, unused sockets, cracks, marks, skirting, holes, repaired spots, garbage, and the list goes on and on. 6 years ago we could argument that computers can't handle such large amounts of useless junk to render, but these days it shouldn't be too much of a problem to scatter pens and papers over a desk, or to throw bricks and dogturds over the 3D streets. No excuses!

Here one of my major issues. The rooms are pretty large, and thus the textures need to be stretched out further as well to prevent repeating. But small stuff like these sockets suddenly look too detailed compared to the wall. Putting a slim, pretty woman next to a fat woman makes the fat one look even fatter. The solution? Increase shadowMap resolution, add decals(cracks, holes, paint, damage, ...) on the walls to make them look more detailed, add (a lot) more small stuff nearby. Or even better, less texture stretching & more variants on the texture to compensate the repeating. In other words: more assets > more production > more artists

The real limitation is, of course, the lack of manpower. Currently I have three guys on the assets (in their free time). Julio makes surface & effect textures, Sergi makes objects(and their textures), and Robert is doing a little surprise for the tech-demo. Talking about surprising, Robert just became a father btw! A little, healthy little boy surprise entered our world last Sunday!

Anyway, I can't expect three men to fabricate whole asset-libraries in a short amount of time of course. So, for now the environments are still a bit empty, and small details such as a pipe or outlets look a bit out of place. Too bad, but there isn't much we can about that now, no matter what shaders you can bake. Now you understand why games have such big budgets these days. The stapler-models alone already requires a production team of 8 artists!

No, but seriously, the men separate from the boys by having well-thought, well-designed, well-filled environments. We should start with research and a huge photo-resource. Then create ideas & concept-art to give direction to the modelers. Then a group of modelers and texture artists that can exactly produce what makes a room look like a room. And finally, an engine + tools that fulfills the artist needs. That's the theory... In practice I made a bunch of maps with my limited skills, and now the other guys try to fill it with some textures and objects ... Oops, that doesn't sound too hopeful for the next Demo :)

Nah, I'm sure it will look pretty good, certainly for a hobby project without a budget. We can be proud we did that all by ourselves in the evening hours. But one has to analyze and place critical notes once in a while, right? At least we have some ideas of how to improve the quality next time. And maybe I should spend some more energy on finding extra concept & 3D artists rather than trying to patch everything with new shaders :p

Before the wole modeling process begins, you got to start with the proper ideas. Bad or boring ideas can’t be fixed by shaders or good looking textures. The Radar Station was based on some cool photographs Julio found on
abandoned-places. Too bad we didn’t had time to sketch good maps first. I just started modeling relative big simple rooms connected with each other. Got to admit the Radar Station wasn’t meant for a movie in the first place btw!

Here some more input a friend gave me after Googling around. Not-so-usual designs are important elements if you want to show something impressive. If Tower22 would only be made of corridors and apartments you see in any other flat, it would become boring very quickly...

Sunday, November 13, 2011

The real deal

Man, heard some painfully awkward "interviews" on the radio this week, while driving to one of our harvesters. Not about Joe Frazier puffing his last smoke, Conrad Murray doing magic with medicines, or Papandreou souvlaki. No, it was about how gamers slept in front of the stores, waiting for Call of Duty: Modern Warfare 3. It's mindboggling when 55 year old people, technically left behind in the Nintendo Entertain System 8 bit era, start asking. "So this video-computer-game is about shooting other puppets with the mouse?". Even more facepalming might be the reactions from hyper enthusiast 16 year old CoD "veterans" explaining what a first-person-shooter is, using modern English generation-X words the interviewer never heard about. Online avatar? Deathmatch? Lagging problems? Shader graphics? 100 frags? LOL?!

Maybe what strikes me most is that this is about CoD in specific. C'mon man, it's just a game. A polished, good looking, action packed one. But really nothing new. When fans told the interviewer about how freak'n realistic this new game is, I frowned my butt crack and had to check my ears. Wha-wha-what?! CoD, Realistic? That's like saying "Cowboy tobacco" and "Whale sperm cells" in one sentence; it has nothing to do with each other. Oh, of course this game *looks* realistic, the visuals are excellent. But isn't this also that game where you kill more (dumb) men you can count, and re-spawn 10 meters back within 5 seconds if you got "fragged"? Imagine that would happen in a Afghanistan...

Yes, I fired a couple of real guns in my life, read the real "Band of Brothers" biography book, watched Ross Kemp almost shitting his pants for Taliban gunfire, seen the Seals on Natgeo, and more important, played Hidden & Dangerous 1 and 2. And let me tell you: you certainly can't kill a helicopter with a tomahawk (axe, the rocket might actually work):
Youtube Modern Warfare helicopter fun
Not only CoD is guilty. Battlefield 3 is inbound dudes. So I watched some in-game footage where a boy and girl had some coop-fun. 5 minutes later, the duo had killed an entire army, caught about 40 bullets without dying, blew up a few tanks that didn't pay attention to them running around with dangerous Javelins, and popped one after another enemy as if aiming a gun is childsplay. And don't get me started on the online features. In theory, you can play a realistic, tactical game. In practice, everyone is running into each other like a Braveheart battle. Cause you don't care about your virtual gamelife anyway. Hence, you re-spawn 5 seconds later after you crashed your helicopter after a tomahawk incident. Realism, my ass.

Those milky Lighting-only testshots always kick-ass. Maybe we should't use (diffuse) textures in this game. Saves a lot of work. The hell with realism.

So, maybe ARMA II is what this old whiner needs. Urr... Much harder, check. Lots of factors to count in, check. Big open maps, check. Realistic weapon ballistics, check. Teamwork needed, check. No stupid re-spawn/regain system, thank God check. Fun... Oh, that's because a real war isn't fun either of course. Truly a realistic game indeed.

Why are the realistic, more serious games so painful? Navigating a soldier is more complicated than doing an emergency belly slide with a Boeing 767 in Warsaw. You need 2 keyboards and 4 big handles mounted on your chair just to move the legs. Why are the graphics mediocre? Why is the A.I. even more dull than in most other action games? Why does such games always contain bugs like getting hit by bullets that went through a mountain, or falling through the floor? You can say a lot about CoD or Battlefield, but at least their mechanics are smooth and slick.

Isn't there a good tradeoff? Well yes there is. Or was, I should say. The last title in this series was released in 2002 I believe. We’re talking about Hidden & Dangerous. Damn I wish they made a new part. That game was stiff and didn't had the brightest opponents either. But at least you were afraid of tanks instead of running into them, throwing grenades. Killing guards, disabling MG42's, sniping patroulles or destroying armored vehicles really felt like an accomplishment. A little more recent example of a well balanced game (in my opinion) is Far Cry. Looked good, plenty action, but also using your brains was rewarding in this title.

Obviously, taste differs and personally I prefer a game somewhere in the middle. It needs to be challenging, realistic, but neither a true simulator. Admit it, killing a helicopter with an axe is pretty cool, and a good laugh is also worth a penny. I think my main beef with these games, is that they are too easy; you simply can’t die anymore! CoD, Crysis, and many others have that auto-regain system and otherwise auto-saves every 20 yards. Or how about Bioshock? You didn't even had to redo stuff after getting killed in that game, the dead remained dead, and you kept all your weapons / ammo. Beautiful game, but not a challenge if you ask me. But challenge does not have to equal realism through.

What is realism anyway, asides from good graphics/sound/physics? Would CoD be more fun if you had to stop and take a crap every six (game)hours? Would Battlefield be better if you need to refuel your Jeep before you blow yourself up 2 minutes later? Would Silent Hill be more fun if the player stumbles over random obstacles while running away from a monster? Would Mario be a good game if that (fat) plumber just jumps 60 centimeters high like you and me? Is a boxing-game good if both boxers hang tired in each other arms every 20 seconds? Could Doom be spiced by only carrying 2 weapons and limited ammunition? Would the Sims be cooler if those bastards sleep 8 real-life hours? Would Tower22 be more immersive if the handyman would smoke and drink beer in the bench every day after work?

Games need to be fun in the first place right? If physical rules have to be thrown overboard, then so be it. If it requires 60 dumb soldiers to shoot per minute to keep the player excited, then so be it. Although I wouldn't call my games "realistic" in those cases, it's perfectly fine to do the impossible. Why else would we need games or movies for? You don't say Superman is lame just because he can fly. In fact, implementing realistic features only works out if it actually adds fun to the game. Though in my opinion, modern games removed too much elements just to make games easier and thus accessible for everyone (=$$$), you play a game to escape from reality. Not to eat bread and tying your shoelaces on the TV again.

Ok, the reason for these white shots was testing a simplified ambient method. I'm still fooling around with a realtime G.I. method, but since my laptop doesn't have that much graphical horsepower, I tried a simple method for lower end cards (and distant area's). Each vertex here has 3 pre-calculated ambient-occlusion values: Sky-occlusion, Ground-occlusion and Environment-occlusion. Depending on these 3 factors and 3 colors, the ambient will be calculated. Since we do this per vertex, it's wise to subdivide your geometry a bit (forgot that here).

How realistic will T22 be then? In the first place, T22 needs to be scary. And easy games just aren't scary. So don't expect you can kill a monster with 5 headshots in a row. That's why I never really understood the negative comments on the camera-angles, limited ammo, and stiff controls in (old) Resident Evils. What do you expect? Rushing through the mansion like Duke Nukem? Oh wait, they actually listened to the fans, and changed these points in RE4 / 5. Quality fun games, but scary? No.

Other than in many other genres, human shortcomings such as a limited stamina, fear or not being able to do Chuck Norris roundhouse kicks, are valid (realistic) limitations. Just as long as the game doesn't start feeling unfair. You need to escape or defend yourself, but certainly not in a too easy way! Testing and tweaking the rules should become an important development phase later on. The goal is to create some "Holy shit barely survived that!" moments.

As you may have read, you won't be confronting monsters all the time though. How to fill the gaps then? Another oddity of horror games (and movies) is that it doesn't have to be a funride. When looking purely at gameplay, Silent Hill is pretty boring actually. You don't play it cause it feels so good. You play it cause you want to find the clues, and cause you like to test your heartbeat. I don't want to make excuses though, so we'll try to add some "fun" by doing focusing more on exploration and puzzle braincrackers. As for realistic elements, a day-night cycle, sleeping and maybe even eating are floating in the idea clouds indeed. But it needs to be integrated in such a way that it feels necessary, not an annoying repeat, and enhances the way how puzzles or confrontations can be solved. If it doesn't, the feature should be scrapped.

But yeah, Tower22 is probably not the type of game everyone will enjoy ;) Maybe the comments on CoD are just out of jealousy ;) Asides from bums, I don't expect people to sleep in front of the stores when(if) T22 finally comes out. It doesn't matter though: we'll make what whatever we please, not what sells. And isn't that the essence of making innovative, good stuff?

Wednesday, November 2, 2011

In Control

Countdown, 7 weeks remaining. Funny to see the productivity rises as soon as there are deadlines and to-do lists. Yep, if you want your team (and yourself) not to be sleeping at the job, keep making (sub)targets and easy-to-follow plannings. Or as they would say in Full Metal Jacket, keep throwing hand grenades at Beastman to keep him sharp.

That felt a bit unnatural to me at first, cause basically you're asking your helpers to work hard(er), without giving them a salary in return. But trust me, it's better to push a bit and keep everyone at work rather than kindly asking if one could do asset X somewhere within the next 50 months, if he likes. Don’t forget why an artist joined you in the first place: to create awesome stuff! The more clear the targets, the more being produced, the more enthusiast people are to add their fifty cents.

As for my own progress, I pimped the water with some fluid-dynamics and pretty realistic ripples caused by particles or stuff falling in the water. Improved the parallax effect a little bit for some stone floor, fixed some annoying bugs, and currently I'm breaking my neck (again) at particle-lighting. There are dozens of ways to render particles, but usually the combination of overdraw and complex particle shaders (lighting & shadowMaps) quickly halts your performance. And blending all those damn sprites into a realistic "cloud" is tricky. With simple additive blending, your fog quickly becomes a radiating Fukushima cloud. With classic transparency the quads start biting each other and fade-out the background unpredictably. One second it looks good, the other second it looks as if the air was filled with pregnant flying elephants.

Blurry particle mess. Trying to use lights and shadows on them.

We'll talk again when/if I get those particles working properly. Usually when there is a problem or a new technique that has to be done, I start browsing the internet (really?!). And more than once, I stumble on the feature-lists, brief implementation details, or jealous-making screenshots of other A+ engines. Cryengine, UDK, 4A, Unity3D, Ogre, and so on. I could be proud that my own home-made-hobby engine somewhat approaches the (commercial) big players when it comes to rendering quality. Not saying "Engine22" looks better, but for some free-time plumbing, it isn't that bad.

Yet at the same time, I sometimes wonder why the hell I'm even trying to make my own engine. What's the point? You're not going to win it from the others. Why not making Tower22 with the Cryengine? All those cool water, fog, particle, lighting and whatever LSD tripping effect you’ll need, is ready to kick ass there. And asides from graphics, it has physics, sound, AI scripting, pathfinding, GUI, multiplatform support, editors / tools, documentation, and so on.

Ok, my budget of 100 euro is probably not enough to buy a Cryengine license, but there are cheap or even free engines out there as well. The point is, as a development team, you can actually focus on the game itself instead of an engine + tools that have to be made before you can even start. "Make games, not engines" (Plato, 347-428 BC), that's what they told us. Now why oh why Lord, why do we torture ourselves trying to make something that is A: outdated as soon as you take a crap for 5 minutes, B: takes an awful lot of time, C: unlikely to beat other existing products? Seriously, it reduces the chance of your game ever seeing daylight, unless you have a big team of nutty professors.

Are we just stubborn, or too pride maybe? For me, picking another engine (and throwing overboard my own stuff) feels like surrendering. It's like getting credit for something you didn't do yourself. It's like those modern cars that can automatically park themselves. Any man would say "Auto-parking my ass, watch this honey!".... (bump).

At times like that, I have to remind myself why I'm doing it again. And honestly I can't give a perfect answer, other than I like to program my own engine! If we would switch to a ready-to-use EngineX tomorrow, there is not much left for me. Tweaking some shaders, write some A.I. scripts... yawn. I would become like the redundant manager at the office. Walking around a bit, asking stuff... "Everything ok here?", "Need some coffee maybe?". I can't help the artists much, other than giving directions and feedback. Neither can I compose sound, or make awesome concept-art. And then we have an engine. No idea what really happens under the hood... It just works.

Nah. That sucks. Now I remember why I'm programming again; the need to learn new techniques. Moreover, I want full-control. If something needs to be tweaked, every last bit should be familiar stuff. I rather program my own devices just to be sure it works (or doesn't work) as expected. And I hate flying cause I don't have any control over it. Hmmm... sounds like some sort of psychological issue...

The same scene without particles.

"Make games, not engines". But the same people also say that modern engines are way too much focused on graphical wow-stuff rather than solid gameplay. I disagree that graphics aren't important at all. How about immersion? If Tower22 had to be played on a Wii without shaders to create a scary dark atmosphere and good looking monsters, it will probably suck. Hey, you don't watch Low-Definition TV either, do you? Nevertheless, they have a point of course.

Each engine has a certain feel. No matter what level you play, or which modification you download, certain mechanics and atmospheric aspects keep the same. IdTech has a sci-fi touch, Cryengine excels outdoors, UDK games have a blueish look, and all three are mainly made for first person action shooters. This may work out for game A, but not that well for game B. Although Crysis looks better than its predecessor "Far Cry" in every possible way, I enjoyed the old game much more. Subtle differences in controls, other game-rules, other map-design, different A.I., different pace, different overall look.

When building a game on a certain platform, you automatically inherit some of its DNA. Both the good and the bad aspects. When using Cryengine for T22, the look might be more crisp & flashy instead of a blurry nightmare. And I'm not so sure if I can make one big roaming world instead of loading separated levels. And how about the A.I.? T22 Monsters are completely different than stealthy North Korean soldiers... And how flexible is the engine when it comes to playing weird horror tricks? Like Demo1 that replaced the first room with another room after the monster-chase.

In short, T22 is a complete different game than the action shooters that gave birth to most of the popular engines. But since you can't make a racegame on a soccergame-engine either, I doubt if there exists any engine that does exactly what I want for T22. See? Need to be in full control.

Improved water. The snow that drops on the water creates ripples. Bigger ripples will result in actual 3D waves. Yeah I know, I still have to post another article about water.

So, making games or engines? That entirely depends on you. What is your ultimate target? Learning how to program a game, or (quickly) making the actual game? Are you willing to spend an awful lot of time in researching (new) graphical / A.I. / scripting / physical / whatsoever / techniques? How much time do you have anyway? In case you aim for a complex game, you can safely add at least 4 extra development years if you plan making your own engine. Or make it 8 years, in case you never did it before. Cause you'll be scrapping and redoing parts, if not the entire engine, several times. And last but not least, is there an existing engine that does the things you want?

Here, I made a little dr.Phill test for you.

1. Target?
----0 [a] Release a commercial game
----1 [b] Enjoy my (finished) game
----3 [c] Make a game & sharpen my skills
----5 [d] Learn how to make games
----6 [e] Make a (commercial) killer engine

2. Available time / release date?
----0 [a] 1..2 years
----1 [b] 2..4 years
----2 [c] 4..8 years
----3 [d] I can travel through time. It doesn't matter.

3. How much time can you spend on it each week?
----0 [a] Little. Other things to do
----1 [b] Not so much (5..10 hours)
----2 [c] Pretty much (10..20 hours)
----3 [d] Unlimited, I dream code.

4. Are you working alone, or together with artists that require tools?
----0 [a] Big team (10+)
----1 [c] A small team (<10)
----2 [b] Han Solo
----1 [d] Not relevant, no complex tools needed

5. How complex is your game?
----0 [a] Think in terms of Halflife4 & GTA7
----1 [b] Pretty complex
----2 [c] Pretty simple
----3 [d] Extremely simple. Atari stuff.

6. How important is the quality (graphics, physics, tools, and so on) for you(& team)?
----0 [a] Very, very. A+ quality only.
----1 [b] Pretty much, but I don't have to win
----2 [c] Make games, not graphics

7. Do you like building your own tools & editors
----0 [a] Boring
----1 [b] If I must...
----3 [c] Love it

8. Do you like reading technical papers?
----0 [a] My ass does
----1 [b] Not really, but if I must
----3 [c] Yummy

9. Do you have experience with coding engines?
----0 [a] Dieselengines? No.
----1 [b] A bit
----2 [c] No / a bit, but I'd like to learn
----3 [d] Sure.

10. Are there available (free or commercial) engines in the genre you're aiming for?
----0 [a] Yes, and I can get those
----1 [b] Yes, but I'm not sure if I want to pay for that
----3 [c] No / Yes but not in my budget

11. Where's your heart at?
----0 [a] The creative aspect (making game contents, maps)
----1 [b] Create / Tweaking the game (scripts, A.I., ...)
----3 [c] A mixture of both
----6 [d] The technical aspect (coding stuff)

Now sum the points (max = 35, my score was 22 btw). The outcome is based on absolutely nothing, but at least it got you thinking right?

0..12 points
You really don't have time for technical bullcrap. What you want is a game, not a technical course. Don't torture yourself too much with programming, cause it's likely bringing you nowhere. Don't forget to make fun in the first place. Grab the engine / platform that fits best, and realize your dreams.

13..18 points
The goal is to make a game, but you don't mind getting your hands dirty. Or maybe your type of game is pretty simple, so wrapping up your own code shouldn't be too much of a problem. Don't forget there are intermediates. XNA or Ogre for example will help you with the coding, but you are still in control.

19..26 points
Either you really like to learn how to make an engine, or the type of game you want to make simply forces you into making your own gearbox. An actual release of the game itself will be the cherry on the pie. Go out and play, but don't forget it's not a crime to ask for help or use some ready-to-use libraries.

27..35 points
Nerd ;) You don't give a shit about games really, you just want to do the stuff that the other big boys do, don't you? Whether you can realize a killer engine or not, go ahead and feed those brains.

Monday, October 24, 2011

Up yours

Tactical plans sir.

Another big name wiped off the Risk playboard. Saddam, Bin Laden, now Ghaddafi (or whatever his name is spelled). Who's next? Il Kim 3000? Obama? Don't know what to think of Ghaddafi's fall. I'm “glad” it got taped on film so we don't have to get in doubt with conspiracy theories again. Well, what say about it… He didn't give a fair trial for his opponents either, and dictators generally suck anyway. Then again, Libya was relative rich and developed compared to some other countries in the region. Iraq turned into a hell-pit when Saddam got chased into a hole, and I don't trust the extremists who are ready to jump into this Arabic Spring either. From a dictatorial system to a deep religious system... not my cup of tea.

I hope the youngsters who started these demonstrations can really create a better future without chaos, war, dictators or religious bearded dresses telling them how think, what to do, and what not to do. A tolerant place based on freedom, tolerance, and common sense. But the problem in these locations is that the word usually goes to the one with the biggest sable/AK-47, rather than a democratically chosen intellect with vision. Although… democracy has become a joke in the Western world as well. Can't remember anyone asking me about whether we should join the war in the mid-east, give more power to Brussels, how to deal with near-bankrupt countries in the EU zone, or if we should "free" Libya (for their own (oil) interests). A “No.” from the people still gets turned in a “no but, Yes - with some chocolate sauce”.

The big guys play their game anyway, no matter what we think of it. As long as we're happy with our house, car, widescreen TV and “What’s in Store!”- Bodytoaster Pro, they can keep milking tax and wipe their ass with it in any that pleases them. It's the 1% versus 99% story. A small elite of... fuckers, decides what happens in the world. Whether Ghadaffi should deliver oil, or sleep in a supermarket cooling cell. If banks should be saved whether they screw up or not. When & where to fight a cozy war to bring “Democracy”. Which other cool overpaid jobs they can get via the Old Boys network. And what we, -99%-, of tax-cows should know and do to keep their thirsty machine running. The Bible sin "Greed" is a nice summary of it all.

That's where the Occupy movement comes from I guess. Sounds I'm an anti-capitalist too. Well, not really. In my opinion, those who work hard should earn more than those who lay in their bench every day, bitching about everything. And a bigger salary should motivate people to use their talents instead of putting everyone behind the same factory conveyor belt. Listen up, there's no such thing as a free lunch. Instead of complaining or envying others, you'd better try to accomplish something yourself, and accept that there will always be people with more money, more women, more success, and more golden teeth whether they really deserve it or not. BUT, a system with a small superrich elite that does dark, unverifiable things stinks. But hey! What are you gonna do about it? Unless we really start rioting and build improvised tanks and Anti-Air pickup trucks, the elite probably doesn't care less about another demonstration. Hence, five days later the mess gets cleaned up by a couple of (hard working) garbage men, paid by our own tax of course. Face it, we know too little and have too much to lose to stand up against it. Bend over please.

I don’t see that happening at the Occupy demonstrations… By the way, those Libyans had some excessive welding classes last months!

Enough politics.
So how's the progress on that next little movie? ...Movie? For those who didn't know yet, we're trying to show a (tech)movie end this year. Or begin 2012 in case things get messed up, but the goal is to give you a Christmas present. Don't expect a "cinematic"-horror-gameplay movie though. It's merely a flythrough, showing some engine graphics stuff, and most of all, the audio, 3D and texture work that has been done by the T22 team.

No secret, the goal is to attract some more 3D/Texture/Concept art people with that demo. Cause we really need it! In the Blog statistics (love them), I saw one was Googling for "Tower 22 release date". I bet you can find a T22_Install.exe on some murky Torrent website within a few years, but we really still have to start on this game! That's right, other than the assets you've seen in this Blog, a half-working engine, and a story + ideas on paper, there is no game content yet! The reason is pretty simple. I want to start on the game when:

- The team is big, talented & motivated enough
- The engine works "good enough"
- Development tools are "good enough"
- All the design & plans have been clearly documented
* In the meanwhile, we build 1 or 2 more demo’s. At least one is planned for 2012

In other words, I don't want to build Tower22 on a fundament of shit. The good news; the engine + tools are going pretty well, the paperwork is scheduled, and the team is growing slow but steadily. Hopefully the Tech-Demo gives it another boost. Making a game isn't easy, so compare it with getting the Titanic into movement. But I have faith in it!

Do you know what's annoying? Rendering white paper without getting blinded by HDR bloom.

I didn't answer the question yet. How's the demo progress going? Well, a whole listing of objects(chairs, lamps, junk), textures and audio is still there. But each week I can check three to five assets, so I think the scene has enough material to look and sound properly within two months. No "borrowed" Halflife2 assets this time! As for the engine, there isn't that much noticeable improvement. The sound engine should hear the same with FMOD. The compressed DDS should look the same as the uncompressed TGA's did (I damn hope so!), and upgraded input modules aren’t going to produce anything visual either. There are some noticeable new effects though (asides from quite a lot bug-fixed and little improvements):

- GPU Particles (with lighting)
- Water
- Ice shaders
- Wall overlays (dirt, cracks, snow, frost)
- Anti-Aliasing
- And stuff I probably forgot

Currently I'm playing with realtime water-fluids to replace the stupid rolling ripple texture with something better looking (and for another water article :p). But I'm not so sure if it will make it before Christmas. We'll see. The biggest improvement should be the recording quality! I haven’t been looking for a better way yet, but let’s see if I can use an external device to record the movie so the CPU won’t be hogging and choking the sound.

The (sharp specular highlight) edges on this stinky chair and the drawers in the background are anti-aliased with FXAA. But I’m not 100% convinced. Either FXAA isn’t effective enough (and making it more powerful will blur the entire screen), or the shader has a little bug…

Sunday, October 16, 2011

Compressor, Part 2/2

What the hell we're we doing again? Oh yes, texture compression. In short, the main advantages are less storage space, less (video)memory space, faster loading/streaming, and if you're a lucky guy, a (little) performance boost cause less bandwidth is required. Reason enough to implement compressed texture formats... but how?

When you target OpenGL, you can encode pixelData into the DXT1, DXT3 or DXT5 format. So first (1.) encode, then (2.) store it in a file (a DDS for example), (3.) load the file later on, and finally (4.) send the (compressed) pixelData to the videocard. Sounds pretty complicated, but we have some nifty tools.

1. The Creation
Load a (raw) image, such as a bitmap or TGA file. Then encode it to a DXT format (or BC in case you target DirectX applications). So... we have to dig in compression algorithms now, right? Of course not. Don't reinvent the wheel, be lazy, and make good use of existing tools.

You can download an existing convertor tool or try to find a plugin for your favourite painting program. There are plugs for Photoshop, Paint Shop Pro, Gimp, Paint.NET... These plugins typically convert a common image format to a DDS file. You can skip step 1 and 2 of this tutorial now, peace of cake. Have a good look though. Not all convertors have equal quality and export options.

When my mobile research-lab was crunching on DDS, I had an old version of Paint Shop Pro though. Just ordered a new version (PSP X4), but no cool plugins at that time. I tried some other exporters, but they usually gave wrong output. Inverted RGB channels, flipped images, Lena changing into a guy, et cetera. Some claimed ATI has a good quality exporter, so I tried this instead: ATI Compress

Too bad, this is not a ready-to-use convertor, not even a command-line tool(I hate those, too lazy to type). It's a DLL you can include in your own programmed tools. Normally I would pass, but with the lack of good exporting tools so far, I gave it a try. And I got to say, it wasn't that hard at all (getting into C++ again took me more time). The ATI library is pretty straight forward. It has a function to compress raw image data, and some basic utilities to read/write DDS files.

1.- Load input image (bitmap, buttmap, tga, png, ...)
2.- Generate Mip-Maps (if you like)
3.- Let the ATI Compress library generate compressed pixelData (for each MipMap level)
4.- Store it as a DDS file (or your own custom format)

Mip-Maps ?!
In case you never heard of them, Mip-Maps are smaller ("blurred") variants of your texture. Pretty simple, half the size until you reach a 1x1 resolution. So a 256x256 image gets a 128, 64, 32, 16, 8, 4, 2 and 1 variant. But... why would you do that? Well, when looking a textured surface from a distance, one screen-pixel may have to sample from multiple texture-pixels. This can result in pixelated/blocky results, especially for textures with a high-frequency details or pattern such as black-white tiles. When you have mip-maps, the renderer will (automatically) pick a smaller, more blurry, variant to suppress this annoying artifact. A little downside is that mip-maps require extra image space (though the smaller resolution variants really don't take that much).

Sorry if you died from an epileptic attack.

OpenGL / DirectX have functions that generate mip-maps automatically for you. However, generating them takes time! So each time you load a texture that uses mip-mapping, you're wasting even more time with generating them. That's why some image formats (such as DDS) supports the storage of pre-fabricated mip-maps. So instead of rebuilding them each time again, you store smaller variants of the texture ready-to-use in the image file. In other words, it makes the loading times faster.

2. DDS File-Loader
Once your file has been generated somehow, you got to load it again in your app. I chose to use DDS files. Pretty obvious, cause this format supports compressed pixelData, storing prefab mip-maps, and even cubeMaps or layered (3D/Array) textures if you like. On top, it’s a common standard in Gameland nowadays. Monkeys see, monkeys do.

Luckily the DDS format is fairly easy. Mainly cause it doesn’t store its pixels in a wacky way. The array of pixels is stored exactly as OpenGL or DirectX expects it. This makes DDS fast to read, as you don’t have to swap bits or do other tricks before you load it to the GPU. It’s 1 on 1. But wait… D-D-S… stands for “Direct-Draw-Surace”… Isn’t that DirectX slang?? So we can’t use DDS in OpenGL apps?!

It is a DirectX thing indeed, and yep, you need a header file to get things working. But don’t worry. It’s not that your OpenGL program changes into a malformed Siamese twin with DirectX. Download the DirectX SDK, or if you are a Delphi user, you can use this: Clootie DX Pascal headers
Then include “DirectDraw.h / pas” in your program. Done.

// Delphi code.
function TEX_LoadFile_DDS( filename : string ) : TTexData;
fileCode : array[0..3] of char;
factor : integer;
bufferSize : integer;
readBufferSize: integer;
pFile : THandle;
readBytes : Longword;
{ Open file... Calling Powdered toast man }
pFile := CreateFile(PChar(filename), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0);
if (pFile = INVALID_HANDLE_VALUE) then begin
showMessage( 'DDS Load Error: Cannot open file ' + filename );

{ Verify if it is a true DDS file. Not made-in-China fake stuff }
ReadFile( pFile, fileCode, 4, ReadBytes, nil);
if (fileCode[0] + fileCode[1] + fileCode[2] <> 'DDS') then begin
showMessage( 'DDS Load Error: file is not a valid DDS file.'#13+filename );

{ Read surface descriptor.
A struct that tells what we can expect in this file. }
ReadFile( pFile, ddsd, sizeof(ddsd), ReadBytes, nil );

case ddsd.ddpfPixelFormat.dwFourCC of
// DXT1's compression ratio is 8:1
result.outputFormat := GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
result.isCompressed := True;
factor := 2;
// DXT3's compression ratio is 4:1
result.outputFormat := GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
result.isCompressed := True;
factor := 4;
// DXT5's compression ratio is 4:1
result.outputFormat := GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
result.isCompressed := True;
factor := 4;
else begin
{ Not compressed. Oh shit, didn't implement that! }
result.isCompressed := False;
showMessage( 'DDS Load Error: Uncompressed format not supported!'+#13 + filename );
end; // case ddsd.ddpfPixelFormat.dwFourCC

{ How big will the buffer need to be to load all of the pixel data
including mip-maps? }
if( ddsd.dwLinearSize = 0 ) then
showMessage( 'DDS Load Error: dwLinearSize is 0!'+#13 + filename );
if( ddsd.dwMipMapCount > 1 ) then
bufferSize := ddsd.dwLinearSize * factor else
bufferSize := ddsd.dwLinearSize;

{ Allocate pixel buffer, then read the (compressed)
PixelData (containing 1 or more MipMap levels) from the file }
readBufferSize := bufferSize * sizeof(char); // Calc buffer-size
GetMem( result.pixels, readBufferSize ); // Allocate memory
ReadFile( pFile,^ , readBufferSize, ReadBytes, nil);
CloseHandle(pFile); // Close file

{ More output info }
result.width := ddsd.dwWidth;
result.height := ddsd.dwHeight;
result.numMipMaps := ddsd.dwMipMapCount;

{ Do we have a fourth Alpha channel doc? }
if( ddsd.ddpfPixelFormat.dwFourCC = FOURCC_DXT1 ) then
result.components := 3 else
result.components := 4;
end; // TEX_LoadFile_DDS

Just a shot. Playing around with ingame contrast here...

3. Pumping to the video-card
The final, and probably also most easiest step, is loading the (compressed) pixelData to the video-card. No worries, it’s pretty much the same as generating any other texture. Start with the daily stuff:

glEnable( GL_TEXTURE_2D );
glGenTextures( 1, @resultHandle );
glBindTexture( GL_TEXTURE_2D, resultHandle);
// Texture settings. Using mipmapping here...
glTexParameteri( GL_TEXTURE_2D, );

Next we send the pixelData to the Twilight zone. One little thing to keep in mind is that we might have loaded multiple mipmaps, all in the same array of pixelData. So for each mipmap level, calculate the bytesize and offset in the array.

if textureData.usingCompression then begin
if textureData.outputFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT then
nBlockSize := 8 else
nBlockSize := 16;
{ Size of mipmap level 0 (original size) }
nHeight := textureData.height;
nWidth := textureData.width;
nOffset := 0;

{ Send the compressed mipmap(s) data to the texture }
for i:=0 to data.numMipMaps-1 do begin
if nWidth = 0 then nWidth := 1;
if nHeight = 0 then nHeight := 1;

nSize := ((nWidth+3) div 4) * ((nHeight+3)div 4) * nBlockSize;
glCompressedTexImage2DARB( GL_TEXTURE_2D,
i, //mipmap level
data.outputformat, // DXT1,3,5
pointer( integer( + nOffset)
nOffset := nOffset + nSize; // Offset in pixel buffer next time
// Half the image size for the next mip-map level...
nWidth := (nWidth div 2);
nHeight := (nHeight div 2);
end; // for i
end else ...

Texture quality
Last, here's a little Kung-fu trick. Probably you noticed the "Texture Quality" setting in most games. Chose between "Godlike, medium or fucked-up". Obviously, computers with lower-end hardware and/or limited video-memory should pick a lower setting. And you want this option too, don't you? Pretty easy. Just skip the first mipmap level(s) in the loop. This way OpenGL will only deal with smaller textures, as the higher level(s) get disposed again. That's all you need to know for now, Daniel San.

Saturday, October 8, 2011

Turbo marketing

No more calling home for Steve Jobs. I'm not really familiar with Apple products, but condolences to his beloved ones and many, many iFans. 56 is not an age to die, especially not if your head is still full of ideas and ambitions. Rest in peace Steve.

Pfew. The storm of emails and reactions is a bit over now. If you thought that demo movie was scary, I got my nerves in the throat as well last week! Having this unexpected, “massive” attention on the project is great free advertisement and can open doors, but is also scary at the same time. We hobby-developers, C++ and Turbo Pascal nerds may think T22 is sweet. But the common man who just wants to play a good game looks from a different perspective of course. It's either a cool product, or a piece of shit. If you buy a car, you don't care how much love was put into it, as long as it drives properly. In other words, T22 sort of got a little stress-test.

And... should I look for another hobby (such as whispering horses, playing flute, collecting Iranian stamps), or are we still standing? I suppose so :). Most of the reactions we're positive, a few hated it, and a couple found the second half of the demo movie an anti climax. Ugly HUD logo's, scripted shift!-run! (“QTE”) sequence, a goofy monster, and what in the devils name was that fat sprite doing at the end?

Taste differs of course. Especially when it comes to horror. I’m scared of clowns and porcelain puppets, others love them. Though some responders might have skipped the fact that this little demo-movie was done by a programmer without real art skills, in a 10% finished engine. Do you really want to know why the last part was scripted so much? Ok then... stair-climbing physics were still so bad that the player couldn't run up in a decent tempo. So I putted him on a rail, just like that goofy monster :D The available assets were very limited, which is why the weird robotic-hand comes from this test-model I made years ago in 5 minutes:

Third person?

Oh well, as long as the Angry Video Game Nerd doesn't say Tower22 is shitcrackers and he rather eats boiled apeballs, I guess we're ok. But sure, we still have a looong way to go. Rome wasn't made in one day either, especially not in the late night hours after a day of plumbing work! It's funny to see some think that we're actually almost done with a (sellable) Indie game. For example, I got mail from a website, asking if we could send a copy for review, as soon as the game is playable. I wish we can, but... do you have a minute?

As said before, we first need some more artists at least. The good news is that, just before T22 showed up on the internet, an extra person offered his help on the audio (when not busy with real work). Say hello to David Garcia Diaz(Espanol gringo):

The whole thing got me a bit thinking about... the Power of Internet (oooh). The reason why I'm not shouting T22 of the roofs, is because I like to make sure I show something good. Friends and others sometimes ask me about showing it to publishers, sending it to website X, doing aggressive marketing, and so on. Ok, I’m not trying to beat CryEngine or UDK, but showing half baked garbage is like cutting yourself with a knife. Imagine Apple shows a cheap plastic, not-white-colored, monochrome, clunky prototype of the iPad6. Jobs would beat the hell out of the marketing team!

It definitely becomes clear that internet can be a jump platform that launches you sky-high. Think about young talented boys & girls that suddenly got famous via Youtube. Or the amount of clicks Half-life fan websites get every day. But the Internet can also be a deep pitfall. To show you, here some professor Dolittle statistics:

amount of views on this Blog on an average day: ~50
...(half from them are looking for an Albert Einstein picture, or stuff like Horseporn)
amount of views on the Blog on Friday 30 September: ~2.000
amount of Youtube views last 10 months, 1 week ago: ~2050
amount of Youtube views today: ~28.500

Enough ego tripping, but see what I mean? Because of some "advertisement", the numbers mega-quadripled. If, say 80%, of the viewers leave with a positive feeling about T22, we can be proud on ourselves. On the other hand, if 50% or more doesn't really like it or even hates it, you have a problem. Now Tower22 doesn't involve money, commercial stakes, and neither was it under development for many years already. But imagine your product, blood-sweat and tears, got burned because it leaked in an unfinished state, or just because the majority doesn't like it? I can imagine some developers must feel really, REALLY bad if their (life)work receives a lousy 5.0 on Gamespot, only 2 stars at IGN, or a Crocodile Dundee Turd award for the worst game of 2011.

The first blow is half the battle. Now we weren't prepared to fight actually, but all in all, we can breathe a sigh of relief. Reactions such as "Thanks, another set of underpants ruined", "Dont give up on this!", or people who like to buy this non-existing game are heartwarming. More than ever we have good reasons to keep developing. Cause there is a lot to improve! For one thing, it's time to have a website that explains things a bit better. Although it's really fun to see people speculating about the game;

- Demo1 was a programmer "art" movie with very limited assets
- I know, too much (motion) blur sucks
- Don't worry, I hate QTE too
- The game is far from finished. First trying to form a proper team
- The game is not in Russia. Sorry for the confusion. But yes, the setting is inspired on it.
- Yes, the game is all about the story, and I won't tell you. Hence, some of the team members don't even know the story! Top secret shit.
- The genre is a platform-survival-music game. Ok, survival horror then.
- It all takes place in a massive building. Though it’s not only dusty corridors and Soviet-IKEA apartments…
- No military, failed experiments or spooky hospitals in this game.
- Most the time, you won’t see monsters or other badguys. Slow suspence, getting winded up, claustrophobia and sound should do most of the terror.
- The player is not named Robert (unless we really can’t find a name. I didn’t name my own daughter yet either. Picking names is so damn difficult).
- Your character isn’t an action figure, yet he won’t be completely defenseless either
- A next (Tech) Demo is planned end this year
- Another movie that shows bits of the gameplay and boogiemen is planned for 2012
- A true release date indication? When it’s done!
- The game uses a homebrew engine programmed in classic Delphi7. It uses the libraries OpenGL 2x, Cg, FMOD, Python and Newton.

I like to finish this post with quotes that made me laugh, cry, vomit, or piss my pants. Next time we're back on Compression DDS files!

"This shit is trippy",
"Boner at 3:40"
"YOUR MOM is more scary than Tower22."
"He’s a plumber? Now it doesn’t suprise me that at the
.....destroyed apartment the only thing that didn’t collapse was the pipe.
>>"It’s all a cunning plan to increase his plumbing business by making you shit bricks."

"but the monster encounter and very last bit were more than a little ridiculous."
"I can't wait to shit my pants :)"
"You're in my world now? Batman...."
"I shitted my pants. Twice."
"What the FUCK did I just watch?!?
......And who's going to pay for my now-ruined chair?
"Note to self: chairs aren't good at holding huge amounts of shat bricks "
"If i was playing I would of dived the fuck out that window at the end, falling to your death is better than staying in that fucking haunted shit hole!"
"do you play as steve form minecraft? he looks very blocky"
>> "it's actually steve holt"

“fuck watching this again at 1am "just before bed"
“I have a fever, and the onlyprescription is more motion blur”

Friday, September 30, 2011

The plumber

Woke up, went to work, got myself some coffee, parked my ass on a chair, turned on the laptop, scratched my balls, checked the email... holy butcrack.

Wow. &, a blog about, yep, Indy games, got notice of T22. Suddenly a lot more traffic on this crappy hole on the WWW, a dozen of Youtube abonnees + jokes, and some articles about T22 on these websites.

I'm shy by nature and hate to stand in the spotlights, but having this attention on your (life)work is great. Got to correct a few wrong assumptions though!


...Skyscraper in the Soviet Union...

I mentioned the word "Soviet era style" several times. But... T22 is not really in the Soviet Union. The theme is certainly related, not only on the map design, but in the end the story has not much to do with Stalin & comrades.

...You play as Robert...

Thanks for the name suggestion! But honestly, Robert is a real-life person who is busy designing the player. The protagonist himself has no name yet! But I bet Robert is pleased!

...Then what the # is the game about?!...

Uh... It's hard to tell without spoiling things. The whole story and game is one big quest basically. All I can tell is that you are a caretaker doing jobs for the boss in a big (sort of Soviet style) skyscraper indeed.

And after a while, you do want your freedom (back). So the player, codename Robert, wants "to break free. God knows, God knows I want to break free." "I've Fallen in love"... wait, that's Queen. No love for Robert here!

And yep, the building is pretty much abondon. You'll try to puzzle/search your way out, which makes it a bit different than a zombie slasher or action game. But that doesn't mean you won't get your hands dirty eventually! Be prepared to be affraid, very affraid.

The demo movie is a bunch of scripted events btw. The game itself should give freedom. You decide where to go, when to go, and what to do if something happens. But hey, I wasn't that far programming ;)

...The sound hurts my ears / too much blur...

The sound, SSAO and motion blur are making havoc in this movie indeed. Partially because unfinished business, partially because of the cracky framerate. The movie was recorded on a somewhat older videocard (GeForce 8800) with FRAPS killing the CPU in the background. It made the sound go berserk, and the motion blur even nastier as the deltaTime between 2 frames was relative big.

...I'm a Plumber...

That would be pretty romantic right? Not sure if "a plumber by trademark" means I'm doing a proper job, or actually being a plumber? Too bad. The truth is, I can barely hold a baco. Never ever ask me to fix your toilet, unless you want a sinflood! In real life, I'm programming operating systems for pharmaceutical machines, warehouses, and my sweet 30 ton babies:

...Out soon...

Oh dear :) Don't want to spoil the party, but this game won't be out anywhere soon. Since we try to put the visual standard pretty high, and the T22 world is going to be kinda big, there is sh~tload of work to do. Programming the engine further, and having some maps, models, textures, sounds and animations would be nice too.

Do you remember the famous words "When it's done!". Well, that game is "done" all right. I'm going to say the same :) But seriously, the current target is forming a team, rather than creating the game right away. I can dream all I want, creating a "big" game with just a few hobbyists is not realistic.

So let's see if we can ensemble enough talented people to create a game in our spare time... Or at least make a good start, and then look further to get this baby on a more professional level. Doing this Blog and demo movies are part of the strategy; hopefully it attracts talented people!

That still sounds like a little boys dream, and... yes, maybe it is. So what? It doesn't mean it's impossible. The people we have here now are capable to create a game like this. The only problem is the lack of manpower so far. Let's show those bastards you don't need a 30-trillion budget to create a good game!

Ever thought about sending this pitch to a publisher?

Yes, but the project is still pretty premature. As said, a team too small for mass production, lot's to add to the engine (including fixing the motion blur! ). First things first, then we'll look further. At this point, I simply can't promise anything to an investor. Unless we work 400% on it maybe, but I don't think the other girls in this house would appreciate that :)

What to expect anywhere soon then?

* A second tech-Demo movie is targetted end this year. Not a "cinematic" horror movie like before, merely a showcase of the Radar Station map we use to test objects.
* A third horror-gameplay movie is targetted somewhere next year.
* A (simple) website end 2011 / begin 2012
* In the meanwhile, collecting more people. Currently we are looking for 3D environment mappers, environment concept-artists, possibly 1 more audio dude(tte), and a texture artist. In 2012 we'll be needing an animator as well.
* When the team is big enough and oiled, we'll start creating actual game content.

"Julio Iglesias is in charge of the concept art?.
You mean the singer?"


What color of underpants do you wear?

Transparent-blue or with a panda print.

Halflife2 / Source MOD

No, it's not a Source MOD, neither using another engine such as UDK. it's all coded in-house. And Yes, quite some contents from the first demo movie are from HL2 indeed. Not that I wanted to, but how the hell is a plumber/programmer to create those textures and sounds then? Creating that monster (and animating it) required the maximum of my programmer-art skills. Got to start somewhere. Can't attract good people if I show stuff like this!

Excuses, got to play dirty sometimes. The next movie however will have our own textures and sounds though. In fact, pretty much most screenshots on the Blog from this year are using our own texture sets.

"This stupid video made me broke my Shift key"

Apologees, we'll send a new one.

...Amnesia / Penumbra...

T22 is quite often compared to Amnesia. And that's a good thing! They managed to put down a f#cking scary game with limited horsepower as well. Though it's not inspired on Amnesia. Never heard of the game until recently when one of the team members gave me a link. As a matter of fact, I don't know much horror games anyay. Only played a Doom3, a few Silent Hill's and Gamecube Resident Evils. And Amnesia made me poop my pants. Isn't that ironic?

The gamestyle is a bit similiar though. In Amnesia, instead of fighting, you run for a single enemy that wanders the area. A lot more terrifying if you ask me, although the ability to defend yourself once in a while would be nice...

... The fat lady at the end of that Demo movie, wtf?...

That was just a joke, putting that photo of my girlfriend there. No, Polish women aren't that fat :) Though this woman is as flat as a 2D sprite as well.

Thank you all for reading and your (positive) feedback. It makes it all worth! Back to work now!