Sunday, June 27, 2010

As the world turns

Each time after posting another crappy story on Sunday, I'll have a smoke and think about what to do next week. The nice thing about having "small" targets such as the upcoming "movie" (sounds more promising than it probably is) is that you can make a listing of concrete tasks. So, what's for dinner this week? I'm still not really happy with the clothing, but at least there is a foundation and a very useful importer tool now. But there is more than clothing.

When talking about engines, the first word most people probably come up with = graphics. But there is much more of course. Physics, AI and sound for example. But also “less spectacular” aspects such as GUI, menu’s, full-screen support, inventories, scripting and game logic. You won’t impress the crowd by telling that your engine supports easy-to-configure triggers or a highly programmable HUD. But if you want to go further than fancy shader showcases, these are very important components. A game engine without proper support for such things is like a beautiful girl without brains.

Still had to do some visual treatment though. A stupid old chair…? Hold on, it has a fur shader on the green cushion! It's a little bit too rough here, as if it was made from rigid yak fur, but that can be solved easily by making the "hair" shorter, mip-maps and/or fading out as the distance towards the camera grows.

One of the not-so-typical things to do is making a railing system. You know, when Steven Spielberg is shooting a movie, camera's and dinosaurs are mounted on rails and synchronized by perfect timing. In games, predefined rails can be useful for cinematic events as well. Or how about lifts, trains, robotics or anything else that has to follow a fixed path?

The engine already had a "railing" module. This is basically a set of nodes that are connected with each other. Between nodes there are connections that tell how fast to move, acceleration specs, barrel rolls, looking directions, and so on. It's also possible to (randomly) switch when a node is connected to multiple other nodes. Think about setting up roads in a game like GTA, where the CPU can decide whether to go left or right.

Still there were two issues. 1.) Who, what, when and where to rail? 2.) Setting up that rail is a horrible job, especially if you have lots of curves or when the object has to follow it extremely tightly. Don't want to derail trains India style of course. As for the second problem, I chose to make an importer. It worked pretty well for cloth, so why not defining a rail-line in Lightwave as well, where the vertices would be nodes? The engine has buttons and function to move entities such as these nodes, but honestly, why trying to beat the controls from a professional package such as Lightwave, 3DS Max, Maya, Blender or whatever you're using? The target is to make a game, not a superb modeler. In other words, plotting that path goes a whole lot easier in Lightwave. I'm using weightMaps to define additional info for the nodes such as speed and curving. It can still be adjusted afterwards though.

2 polygons and not a single more. I liked the furry velvet look in Super Mario Galaxy. And if the Wii can do it… With all the respect, but Miyamoto should had put some more mushrooms in the Wii hardware. Anyway, no shells or transparent layers for this furry look. I’m using “Steep Parallax Mapping”. An enhanced way of doing normalMapping. I wasn’t really interested in making my brick walls looking bumpy though. Just needed a furry look for that chair. By chance I came across this paper.
Steep Parallax Mapping
Besides parallax mapping and fur, it can also be used for straight short grass. Just a tip…


The other issue is the trigger that puts something on a rail. Trains don’t just drive automatically (at least I hope so). A guy with a moustache first has to hit the pedal. Hence, the whole train first needs to be placed on that rail to begin with. We would call that “spawning” in game nerd terms. To make a long story shorter; game events need to be triggered somehow. For example, unlock a door after killing 20 goblins. Or play Sepultura when opening the toilet door in sector X.

Such events are usually very specific. They depend on the game, your condition, the environment, and so on. You could code all of this into the engine but… that’s exactly NOT the point of an engine. Try to make a strict distinction between general purpose and game specific tasks. Which is why most developers go for scripting languages. No exception here, game rules, AI decision making, object interface, cinematics, and sector events are using Python scripts to get your dirty things done. For example, I could put that stinky chair on a rail when entering sector X for the first time while having a shoe-horn in my inventory.


Again that chair? Sorry, I didn’t have much other furry friends to show so far. About the shader, the result of the marching loop is a height factor that can be used to give an offset to your texture coordinates. I’m using this height as a texture coordinate for a small lookup texture that gives a shade value (height ~0 = bottom = dark, or sand for grass. Height ~1 is tall = bright).

As for that movie, I need some scripted events as well. To make life easier, there is “Cinematic Script” in the engine. Basically this is a set of one or more timelines with scriptcode. Just like in all other scripts, we could use it to spawn objects, put shit on a rail, play sounds, and so on. But also interactive events like making the player bash a button to stop his head being chopped off by an angry chainsaw zombie. Cinematics does not necessarily mean that you lose control over the player. You are the puppeteer, script whatever you want.
- 02:40 Ridge comes in to tell Barbara that he was cheating with her dog.
- 03:10 Barbara cries and shouts "how could you, after all we went through together"?
- 03:13 Ridge tells it was Forester and Brooke who made him doing this
- 03:42 Barbara's dog comes home after work and decides to play open cards, he is pregnant.
- 03:43 Pregnant from Barbara's step-parrot
- 04:10 Claudia storms in to announce she will marry for the 7th time with Andy
- 04:46 The phone rings, Andy died in an ufo accident
- 05:00 Title screen "next time in As the turd turn"

No comments:

Post a Comment