Sunday, August 29, 2010

Press the Red button

Working on another computer is like cooking in a strange kitchen. All tool are missing or placed in a different drawer. After installing six million tools, I was finally able to work on the project again. Let’s see how many brain cells were lost during the last two weeks.

Noticed that more and more console games are using scripted "hit-the-right-button" sequences last years? God of War and Resident Evil are good examples of this. At some points, you'll have to hit the right (gamepad) button within a short time to dodge, climb-up, respond or uppercut your opponents through a window. Or more annoying, to dance with CJ in GTA San Andreas.

Button bashing is nothing new. Remember this? Sixteen billion pulses per second where needed to break through ruby. Poor SNES pads.

Personally I'm not a big fan of this. As you get older, your reaction time starts to get worse again. Really, I didn't finish God of War simply because I couldn't kill one of the boss characters that required a whole combo of pushing the proper buttons. Since I'm not playing that much with Playstation gamepads either, I just couldn't figure which button to hit. Square?? Where the hell, shit too late. Game over.

Then again, there are some exceptions. Resident Evil 4 for example contains a superb cinematic fight between Leon (you) and Strauser (Dolph Lundgren). It's good because it's just a cool piece of CGI. But instead of watching only, you also take part a little bit by dodging knifes occasionally. Like an interactive movie.

I had a new idea for this guy when falling half asleep... This won't be his final shape!

I'm more into the Halflife approach where the player never-ever loses control over our bearded friend. But having cinematic button-bush sequences can actually help you visualizing the scene precisely the way you want. Especially in horror scenario's where camera-work is crucial for the Boo! effect. You can't expect the player to be watching at the right places all the time, and the first-person view makes it even more difficult to focus on specific parts or to show player motions like climbing back from a abyss or making a counter-attack. Imagine a movie car-chase would be filmed from the lead driver perspective only… you’ll miss about half of the scene.

So I decided to look at some related options
- Taking over control of the player
- Using button(bash) as input for a motion
- Making an alternative temporary camera setup (shoulder cam, watch the player from the front, peek around a corner, etc.)

All possible, but again, you need to insert such features smoothly into an engine so it becomes available for the mapper/scripters in an user friendly way.

One of the better pictures if you ask me. The dusty sprites may need some softening though. This can be achieved by using the depthMap from the camera point of view. For each particle pixel, check if it's nearby geometry. Ifso, fade it out so that the intersections won't be visible.

It's already possible to let the player follow a fixed path (“railing”). But I needed to show a "PUSH! PUSH!!" button that gives impulses to how fast the player runs, instead of a predefined speed. With script functions I can adjust the rail following speed, or give a temporary speed boost (for button bash mechanisms). The boost pulse is also used as a shader parameter to temporarily highlight the indicator image. Although it can be fuzzy sometimes, quite a lot is possible with the scripting, triggers, railing and GUI definition files by now.

Run Dummy, Run! That Shift button looks a little bit odd though... Not the same as those candy Nintendo/Xbox buttons, or the symbolic Playstation ones. Anyway, it's now possible to put the camera somewhere else. Let it follow another entity, or give a fixed location. Ideal if you want the good old fixed Resident Evil1 camera.

Monday, August 23, 2010

Lonely planet

Hey, we're back, alive. Good to see a couple of new visitors came along here as well. So I'd better start writing something useful again. Though except from some vacation stories, I’m still out of ammo. I was hoping to do some work on the laptop, but the bastard gave up on me. A few hours before leaving, one of the cooling fans started to make an ugly loud noise.

So, yesterday I booted my old desktop system again after a long, long time. And guess what, I like it. Good old Windows XP, a wide screen, big mouse, and it actually runs my game slightly faster on a bigger resolution as well. Almost forgot why I used to prefer desktops in the first place. Laptops are expensive, you can't simply upgrade a video-card, and they never live longer than 1 or 2 years. The only advantage is their mobility of course, although my Toshiba weighs 25 tons (the adapter alone is a nuclear power plant on itself). Probably my girl won't appreciate it if I install the desktop in our bed, so guess I'll have to sneak out the next few weeks. Don’t know about you, but most of the productive programming hours are during night for me.

Let's hope Toshiba fixes the damn thing quicker than Hewlert Packerd. Still angry if I think about that. The screen didn't work anymore, so I wrote a letter on top of the laptop. "Screen not ok, videocard kaput maybe?". "DO NOT REMOVE HARD-DRIVE WITHOUT NOTIFYING ME, HERE MY EMAIL/MOBILE NUMBER:" blabla. Really, I pointed out everything. Thus, they replaced the hard-drive, gave me back a laptop with still a broken screen, and threw away my drive full of data. Without notifying me of course. Had to send it back another 2 times before the problem was fixed. Half year later the screen was toasted again, so I gave up on that HP laptop. I'd better call the plumber rather than sending it to HP again.

Well, I managed to finish the monster model + animations though, noisy fan or not. @Peter Welzien, thanks for the Sculptris tip! The only thing that remains is drawing a proper skin, and importing the skeleton animations properly. So far my monster would end up in "The Thing", with twisted necks & arms broken Steven Seagal style. Probably some bone matrices are inverted or something. I didn't had the brainpower to trace the bug though, as I was alcoholized most of the time last 2 weeks. Better not mess with your code when being drugged.

Part of the monster model, untextured. A clayish material is used for now.

Talking about drugged... I probably had the weirdest experience of my life in the Ardennes. I'm really not into "drugz", but my friends bought these "truffles". Sort of mushrooms, a mother nature product, and 100% legal in Holland, so I thought what the hell... Sweet mother Maria on a stick.

I always found Fear and Loathing in Las Vegas just a weird movie, but it actually depicts pretty well what happens. Complete chaos. Everything is strange, funny, maybe scary. Your body malfunctions and all you can do is shit your pants if you don't watch out. And although everyone is on the same frequency and "understands" each other with just a few mimics, conversations never go further than 2 or 3 words. Because talking is too damn difficult. Blrrp, dudu blup.

So for the next 4 hours, I saw trees plumbing into the ground, the horizon getting stretched, flattened and bulging. And my friends in that wooden house made me think of an Al Bundy soap series with cardboard decors & a laughing band. So much noise and things going on, can’t relax for a second.

Strange enough the effect smoothly leaves without leaving headaches or any other bad feelings. As if nothing happened. Except there is this aftermath you start to notice... Garbage everywhere, chairs placed inside flower bushes, mattresses below the car, a parasol penetrating the airbed of one, bottles of beers that only miss 1 sip all over the place. The funniest thought is that the neighbors might have seen a bunch of idiots nervously walking/sitting/moving around all the time, talking gibberish, observing little bugs or stones from the gravel driveway. Difficult to explain the whole effect, and therefore probably just as difficult to understand what’s going on from a neighbor point of view. Seeing a couple of guys acting… rather strange.

Uhm, nothing to do with the story, but here's another shot of the monster model. Yes I made it unclear on purpose. Don't want to spoil everything already

Not sure if I'll ever do that again, but it was quite a funny experience. Most of it. I'd like to have control over my body, but with this stuff you'll be downgraded to retarded levels. The only thing you can do is go with the flow, otherwise you might end up in big panic. But since I have a little daughter, I'm quite a careful person. I was continuously stressed and being afraid one of my friends would do something stupid such as starting the car, lighting the campfire, fall down the balcony, burn the kitchen, etcetera. But wonderfully, we only had some wet pants because aiming while peeing became damn difficult. Anyhow, if you ever feel like trying such stuff, I would advise to do it together with persons you trust, and preferably someone sober to keep an eye. You could ask your mom for example.

Second week I spend in Poland. Didn’t see much from the recent flooding there. Just the typical Polish landscapes; forest, forest, farm, a few houses in forest, and more forest. More towards the cities Wroclaw and Katowice it makes place for deserted buildings, old train stations, and lots of graffiti. Or the famous grayish concrete flats of course. Preferably right next to a stinky factory pipe. To make the view somewhat more happy, much of the houses and flats are painted in bright pink, yellow, aqua blue or ochre green colors though. “Happy concrete”, as I like to call it.

Not a foto of me, but this is a typical train station. However, with a shining sun even places like these can look quite charming. It makes a HUGE difference if you visit Poland in the winter or summer.

Greetings from Bielsko-Biała!

The sober communistic flats and architecture are part of the inspiration for the Tower 22 design though. So I was quite enjoying my view from the train (although… after sitting 16 hour in that wagon…). Don’t know why but the threatening, maybe even somewhat inhumane buildings are fascinating. How the heck can a person live there? Well, acclimatizing works pretty fast, and for the people who live there, this is common business. Still, the contrast between the rather beautiful nature and the cold soulless buildings is sort of unique for a spoiled Western boy like me.

That said, just like many other Eastern Europe countries, Poland evolves quickly. Although my parents in law still use a steam-driven telephone, they also have a huge flat LCD TV. Things are just a little bit simpler here. You’ll walk on your slippers to the bar, instead with your shiny shoes. You’ll drink cheap big cans of beer instead of expensive wine. Instead of separating garbage you’ll just burn everything in the house central oven (which gives a chemical odor all over the place during the winter). Ladas drive in front of Mercedes cars, and pretty girls walk next to old grandma’s who are escorting their cows back home.

I like just walking around here. Whereas villages in Holland are typically well ordered like a Sim City map with straight boring blocks of houses and occasionally a piece of grass, the environment here is much more varying. Curly roads, strange secret paths, and beautiful houses right next to wooden cottages where a witch could live. It’s like those Zelda villages, asking to get explored.

This photo from Milowka was taken during Christmas by the way. I didn’t had a photo camera with me! Stupid.

Well, let's try to make something again for the next weekend. Ow, while being in Poland I red about Crytek's way to do realtime ambient lighting; Light Propagation Volumes. First I'll finish that movie, but this is definitely something I'd like to try out soon. Hopefully I can turn this rather difficult technique into something readable. Although Spherical Harmonics are not exactly my piece of bread either...

Thursday, August 5, 2010

We ain't going to Ibiza

Mailman brought post on thursday already? Yep, I'm going on vacation tomorrow. So just to let you boys(and girls?) know. When nothing appears the next 2 weeks, I'm not dead. Unless my plane or train crashes, I get toxinated by alcohol, kidnapped by terrorists, or eaten by Russian bears.

I'm going to Poland, nearby Zywiec(from the beer) to be precise. Not exactly the place-to-be for spectacular vacations, but I'll have to show my face to the parents in law of course. I can't complain, only have one or two family visits per year. By the way, I decided to take the train this time. Why?
A: Because it gives me that adventurus feeling, being on a looong trip (instead of flying less than 2 hours)
B: The ICE in Germany can drive 400 kmh (in theory), and the second train has a bar-wagon. Maybe I can enjoy a drink with a charming Eastern-Europe James Bond girl!
C: Because I don't like flying, period.

But first, while girl and kid are already in Poland... a week Ardennes with the guys. Woman have to understand that we men have to "ventilate" sometimes as well. Making garbage, doing nothing, drinking, eating raw meat, swearing, etcetera. Look, dogs need to play and run, pigs like to roll in shit, and so do we men have our needs. Because of you we're already behaving ourselves the whole year. Cleaning up, shaving, being polite, wearing clothes and such... So please, just once a year, let us be men again. And Hey, we're not complaining either when you go shopping (on our costs) or having silly girl icecream-on-the-bench nights.

Any programming news maybe? Well... no. I made a bug somehow that took me 3 nights to trace back. Just a stupid adjustment in one of the miliion codelines made a chain reaction of crap. Joy.

The laptop is going with me, so there is plenty of time for modelling and finishing stuff for the movie. If I'm capable that is. No internet though. The most advanced technology at my parents-in-law house is probably the steam driven radio. So... I'll be back.

Sunday, August 1, 2010

Pull my finger

Again a busy week. Long days at work, and our little daughter got two years old yesterday. Just like any Muslim has to visit Mecca at least once, every Dutch family has to visit the "Efteling", our variant on Disney World. So that’s what we did with family and friends. Including our long lost Indiana Jones friend that finally came home this week. After travelling around the world for a year. From Ecuador to Argentina, from India to Bali, from Neptune to the Andromeda solar system, and who knows where else he has been. Looking forward to hear all the stories next week, when he joins us at another “well deserved” vacation in the Ardennes (a stunning 250 kilometer from here). Yeah I know, besides the neighbor countries, Poland and Prague, I haven’t seen much from the world yet.

Anyway, not much programming, but a fun weekend nevertheless. Lovely how that little girl is still completely fascinated by chunky moving robot dragons and plastic pirates on strings. Beautiful to see how pure children still are. Untouched, unprejudiced, still clean from all the bad things in this world. Then to think I never really was a childrens man. Not that I don’t like them, I do, but I just didn’t know how to behave when they are around. I’m too serious for doodoo-daada conversations, scared to break them / make them cry, or scared to get a slap by a concerned mother that thinks I’m a pedophile or something. But there you go, things can radically change in a few years :)

Thank God this train only moves about 3 miles per hour, without loopings. One of the fears that comes with being a daddy is, besides chasing away 16 year old boyfriends on scooters, having to ride the rollercoaster with your daughther one day.

Okidoki. Game programming then. I spend the scarce free hours this week on making a trigger system. I wrote about scripting several times before, but in case you don’t really know what they are… Scripts are adjustable pieces of text/code that can tell what to do. Usually written in a higher (somewhat “easier”) level programming language. Just like with any other programming language, you can apply all kinds of logic. However, in this case the actual work is still done by the underlying engine. Script tells “play sound” or “walk to point B”. Then the engine does the actual (difficult) work. Compare it to cartoons where you have the Muscle and the Brain. The engine is the dumb guy that does all the dirty jobs, the script is the evil genius that makes the plans.

One of the biggest pro’s about using scripts is that they are A: relative easy to write. And B: you can change them afterwards without having to change/recompile the engine code. This makes it perfectly possible to separate specific game stuff (rules, events, behavior) from the engine. But there is also a downside; script runs slower. Although computers are fast these days, it’s still not recommended to perform complex routines inside a script, and certainly not every cycle. Which is why scripts are usually just small pieces of code that instruct the engine. Engine asks what to do, script briefly instructs.

The ping-pong communication between the two can be a little bit chaotic sometimes. And although scripts are great, I still try to avoid them as much as possible in order to keep things simpler and faster. Since I’m quite familiar with PLC’s, AND/OR/NOT’s, pulses and delays, I thought “why not making a trigger system?”. Here a trigger is a set of conditions and events.

After doing it 54259 times, I'm starting to hate designing forms with lots of checkboxes and such. I looked for an "Object Inspector" component for Delphi7, but couldn't find a free one... Maybe I should make one myself... or maybe not.

The picture above shows an example. A set of engine built-in conditions and events can be used to compose a trigger. For example, check if the player is inside a certain part of the map, is looking at object B for at least 2 seconds, and has a screwdriver in its inventory. IFSO, play a sound, spawn an object, change the weather, or whatever.  
- Test if entity is inside a region. Eventually filter on group, velocity, etc.
- Test if entity A can see entity or point B
- Compare entity property or global variable (health / battery less, equal or more than X)
- Do a date/time or weather check (handy for populating streets in GTA kind of games)
- Test if person has item X inside inventory
- …
- Play sound
- Hide/Show objects
- Give something
- Spawn object
- Start cinematic script
- Adjust entity property or global variable (health += 10, … )
- Change light / atmosphere, day/time or weather
- Open or close doors
- …
Now it’s possible to construct quite complex logic, without having to use scripts. All the items above are common checks and do not cover specific game code either. And otherwise scripts can still be used to define specific conditions or events.

Last but not least, the trick is to know which triggers to check and which not. In an open roaming world like this one, you could have thousands of triggers in total. Although the checks are fairly simple, you still don’t want to evaluate that whole shitload. Especially not if 99.9% of the conditions will turn out false anyway. Therefore I made an “active list”. Each sector (a room or corridor for example) carries its own set of triggers. As soon as you get nearby enough, it will put its triggers into that “active list”, from where they get evaluated every cycle. The few triggers that are not bound to a specific location can still be inserted/removed manually via a script as well.

Now this stuff didn’t bring me nice new pics for this week, so you’ll have to do with this dusty crap. Same old apartment room, but decorated with some of the newer objects I added last months. Nice to have a growing library of garbage to put in that world. If the horror idea fails, we can still turn it into The Sims go Soviet.