Return of Weekly Updating: do that again

snapman's picture

Just when you thought I wasn't going to be updating anymore, a new update comes right out of nowhere!

A while ago I read an interesting article about the indie games scene, and the creation of what they referred to as "a new genre of game" that had arisen entirely due to the efforts of independent developers. While I think it can trace its roots to some rather big budget games first, it is an interesting notion: The origin of the time manipulation game genre. While it probably traces directly to the Prince of Persia commercial title "The Sands of Time", the concept has evolved a fair bit past simply rewinding time, fast forwarding time, pausing time, or perhaps the real father of the genre, bullet time. Now games like Cursor 10 and The Misadventures of P.B. Winterbottom have multiple timelines: parallel, intersecting, reversed, accelerated, and slowed all together. It's a very interesting concept, allowing for a lot of creativity on the part of the player, as to how the recorded movements are arranged or manipulated.

Which brings me to tonight's topic: Recording and playing back motion in KnP. The mechanic is something new, but that doesn't mean you can't make it in something old. My first thought on this was a description I read once of sending information between multiplayer game clients. It read something like this: "You don't just send the current location of all the players, you also send their direction and velocity. That way the computer can fill in the space between updates by moving the character according to the most recently sampled velocity and location" While taking a look at the path motion in KnP, it looked a lot like the principle from the motion sampling for multiplayer games I'd read about. But there was no way to manipulate a path object during a game, I saw a way to recreate it. If I could draw a path of objects, and have another object read them one at a time, I could record and play back motions.

Using objects for path nodes was necessary because KnP has no support for arrays of any dimensions (except 0!). But I had to make each object numbered, and store a speed and direction. I finally decided I didn't need to store a direction, since that would be taken care of by the position of the next node in the path. So I used a simple trick to number each objects alterable value A immediately after creation, along with storing the recorded object's current speed. Quickly I had a path of numbered objects with stored speeds. It was just a matter of waiting 5 seconds, and adding an object that would start reading at the beginning of the path, changing its speed as it read. The following object very nearly matched the motion of the recording object, with little difficulty or error.

I chose to destroy the path as it was read, but it would be easy to reuse the path as in TMOPBW, or reverse along the path like in sands of time. Or even record multiple paths, by setting the alterable value C!

Attached is the result of my experimenting. The first stage uses the mouse, which is capable of achieving speeds in excess of the KnP maximum 100, so it's not perfect. The second stage records the movement of a platform movement object, with one-way collision between the player and the echo. Press SPACEBAR to switch between the examples.

(It is important to note that this technique is better than constantly creating objects, and repositioning the trailing object at the oldest one. This trick is much smoother by simulating interpolation between points by the recorded velocity. Also, this technique allows for more complex timeline manipulation that this short example file demonstrates)

movement record.zip9.19 KB


kirkjerk's picture

Haven't had a chance to look

Haven't had a chance to look at the actual attachments, but the description reminds of "Food Fights" instant replay feature -- if would play back levels with lots of action, but if memory serves, sometimes would seem to glitch and show a near death as an actual death. At which point, IIRC(aipd) the game would say like "Oops" and abort the replay, which feels like a last minute programmer for a difficult to track glitch

snapman's picture

As cliche as it is, I think

As cliche as it is, I think I'm going to try to use this for a POP:Sands of Time reverse thing.

SpindleyQ's picture

Thanks, Kirk, now I'm going

Thanks, Kirk, now I'm going to have the Food Fight instant replay music in my head for a week.

I enjoyed your demo and

I enjoyed your demo and decided to play around with the idea. I got lazy and used the inferior technique you mentioned of constantly creating objects. Still, it seemed pretty smooth since I was creating the objects 100 per second and repositioning at the same rate.

Then I got playing with it a bit... drew some lines between the objects, etc. I didn't think anyone would be interested enough to download the demo, but everyone takes time to look at Youtube... or maybe I'm wrong? :D