Weaving in the crowd

The crowds in shopping malls have always frustrated me. I’m not the type to meander around the corridors looking for bargains or sales. If I want to buy something, usually I already know what’s the item and where I can get it.

So I’ll arrive at the entrance of the shopping mall, and I know where the shop that has my desired item. It’s a straightforward point A to point B thing. But there are so many obstacles! I feel like I’m running an obstacle course, dodging one after another, stopping to let one pass, speeding up to avoid another. What are these obstacles?

My fellow human beings.

Mall plan route

Judging from where I am, the right side of the corridor seems packed. So I move straight, and encounter a slowly moving elder. That’s easy, and I swerve around quickly to encounter…

The family of five. You never really know what kids will do. I’ve had experiences where I would be walking and minding my own business, and then out of nowhere two screaming children would materialise on my left and sprint in front of me to my right. So I swerve a bit more to my left to encounter…

The giddy teenagers, who just emerged from one of those trendy fashion stores. Don’t go near them, because they could suddenly point their fingers somewhere, and go “Oh look, ZARA!” and run enthusiastically toward said store. You need a wide buffer area to improve your chances of dodging their stampede. That, and their unforeseeable and inexplicable fits of high-pitched laughter. So swerving, I encounter…

The young parents with their 6 month old baby in a stroller. This one’s easy, because they will usually move very slow. The stroller also restricts their range of angular movement, so if it’s pointed one way, that’s the direction the parents are moving towards. Easy to predict the point they’ll reach in say, 2 seconds, which is the amount of time I have before I reach them. By which time, I’ll encounter…

The bored boyfriend. This one can be easy or hard, depending on where said boyfriend decides to wait out his girlfriend’s retail rampage in the store. If he decides not to be a free model for the store, he will move out a little onto the corridor. At which traffic will then flow around him and make my path that much harder. This one’s a bit more considerate, choosing to stand close to the store instead. Simple to pass through, and I’ll encounter…

The sentinels. They are a bunch of friends, laughing and talking. Quite ok actually, if not for the fact that their preferred battle formation is a single file moving horizontally. This isn’t a CSI search and comb; you don’t need to spread out into a line. If you want to maximise face time, the line is the worst formation. A circle is much better, like around a camp fire for example (haven’t they heard of complete graphs?). The worst thing is they’ll block a lot of the corridor, leaving you with very little maneuverability. They’re like the sentinels of some hidden treasure, who found an intruder, and are inexorably moving forward to crush the invader… Moving sharply to my left, I avoid them and finally reached my destination. *whew*

The above story was fictional. Well, I didn’t meet the characters all in one trip anyway… but they’re real. This is my long-winded way of saying, sometimes even if you know the destination, there are many unforeseen variables. Such as a software project. Ok, that analogy is a little weird…

I want to point out that, in order for me to successfully navigate around all the colourful characters who so innocently obstruct my path of least resistance, I have to read them. I have to read their body movement, posture and facial expressions to decipher what their likely directions of movement are.

That takes some practice, because you need to know that the person slowing down in front of you might change direction, or even stop completely. Of course, you will need to detect that the person is in fact slowing down…

I used to get angry because of the people blocking me. Why are they moving so slow? In time, I’ve learnt to control my anger. I’ve even turned it into a game of sorts. Here’s how you can play too.

At a moderately populated shopping mall, decide on a destination, preferably one that’s on the same level as your starting point. Your goal is to reach that destination at a more or less constant speed. Say your walking speed is 2 metres per second. You can speed up a little, or slow down a little, but you may not break into a run or stop completely.

This should test your knowledge of human behaviour, how good your reflexes are, whether you can adjust your route on the fly based on real-time data and so on. It also trains you to be more aware of your surroundings, your body position and posture, the length of your stride and so on.

I have 2 killer moves to help you: the shoulder slant and the side step. In the shoulder slant, you swivel one of your shoulders forward and the other backward. This way, you’ll be able to squeeze through some “cracks” in the obstacle run. Because sometimes, there’s never a good time, so when an opening appears, take it. With practice, you’ll learn which shoulder to swivel forward too, depending on situations (swivelling the left shoulder forward means the left foot is more natural to use for the forward leg).

The side step is particularly useful for when the idiot in front of you who don’t know where to go, decides to stop completely. At this point, you must rapidly decide if you want to go to the left or right of this confused and lost person. And then do a side step. Basically you open up your legs sideways. So instead of moving your leg forward in a normal step, you move it to the side.

You need to decide quickly because your momentum will carry you forward, and you don’t want to knock down the fella, right? Because of your forward momentum, there’s almost non-existent side-ways momentum. Thus if you move to the left, you must exert pressure on your right leg to “bounce” to the left. It takes a little practice…

Also, if you decide to go right, and your left foot is in front of you, then the natural movement is to move your right foot to the right in a wide split so as to avoid the now stationary person in front of you. Similarly for the decision to go left.

What if you decide to go right, and your right foot is in front? Uh, try to avoid this situation… Don’t try any fancy dance moves or you might entangle your legs and fall down. Just stop (and you’ll lose the game, but it’s better than public embarrassment). With some practice, you’ll learn to move in the direction based on the length of your stride and where your feet are.

And that’s some 1000+ words to tell you to be observant of human behaviour, to be conscious of your surroundings and to be aware of your body position and posture.

Featured demo – Concentrate

I’m starting a series featuring demos. If you don’t know what demos are, bring yourself up to speed with 5 of them.

Demos are multimedia applications combining programming, art, and music. There might be a storyline, an artistic direction, a showcase of physics concepts or even a statement by the creators. Plus they’re just fun to watch.

2 facts I’ve gleamed from watching demos. Sometimes, if there are text in the demo, and you want to read them, be prepared to watch the demo over and over again. Because the text will generally appear for split seconds. Second fact, “greets” or “greetz” refer to greetings or salutes by the creators to other demosceners (or sceners).

We’re not going to just watch demos. We’re also going to analyse them. Let me just give you the demo first. It’s “Concentrate” by Adapt. It was submitted to the Breakpoint 2008 demo event. Download it. It’s about 15.4 MB in size and about 5 minutes in length.

Keep these 2 points in mind while watching:

  • The sparks waterfall – collision detection, physics, gravity.
  • Texture in texture.

The technique used in the 2nd point goes like this. You render a scene onto a texture. Then you add an object, map that texture onto the object, and rerender the scene. Let me show you an example. Say I have this scene:

Texture scene

I render the scene onto a texture. In this case, I saved it into a bitmap. In the demo, it’s saved in memory. Then I created a cuboid and mapped the texture onto it, and then rerendered the scene.

Texture scene mapped

One characteristic of demos is that you usually have to watch them a few times to truly appreciate the beauty, the art and the skill used to produce it. Feel free to space your demo viewings.

Then tell me your experiences in the comments. What did the demo make you feel? What did you notice? Can you recreate a certain effect? Can you figure out how you can code certain parts? This is like an open homework project, so let’s discuss!