|
Posted on 06.15.07 by Mike K @ 10:45 pm
Last post talked about the random thoughts I’ve had about how to pull off the rope dynamics in Umihara Kawase, this classic SNES game that drives us all mad. I made some bold suggestions, and decided to try them. After a couple hours of work, while not as complete as I want, it’s far enough along to be able to demonstrate to me if I have a right idea or not. Rather than let this fun experiment disappear in to obscurity through e-mail or forums, and since I never have enough blog content, I’ll post it here and try to explain more broadly what’s going on in my test. Though really, this is just Raigan and I talking back and forth.
ESC - Exit The point of this application is to simulate a stiff wrapping Umihara Kawase rope, not a nice bouncy spring built one. Actually at this point, it doesn’t attempt to wrap around scenery. The rope is capable of it, but I’m just manually hard coding a list of points in between the end points. I’m assuming there’s will be a system that looks at the collision, notes the edges I cross, and correctly pushes them on to the front or back of an STL deque. So … uh … for now, pretend they’re pulleys, or fitting through some really fine cracks. What you’re seeing on screen is 4 separate rope simulations. I’ve noted on the image in a 2×2 grid what is what. “Magnitude” means I use Magnitude (length = sqrt(x*x+y*y)) for all my length calculations, and “Manhattan” means I use Manhattan (length = abs(x)+abs(y)) for them. The “Free” row means both points move freely, and “locked” means one doesn’t. If you’re just tuning in, Manhattan is correct when axis aligned (i.e. [10,0], [0,-4], etc), but increasingly more wrong (too long) as it approaches a 45 degree angle. It doesn’t break, it’s just different, very diamond shaped instead of circular. Think of it as a worst case square root approximation for vectors that still works. To solve the rope, I need a few things. The sum of the length all rope segments, which is one place where I’m using a Magnitude/Manhattan, one for every segment. I take the difference between my set length and my calculated length to see how “broken” it is, much like a spring. I then pull or contract my end points to fix it. It’s a cheap verlet solver, so all I need to do is move the point and it will work out beautifully in a few frames. So I take the vector from end to point for each side, divide it by the length of that segment (My other Magnitude/Manhattan use, one per side), which gives me a normalized vector I can use to apply part of the rope length difference. And I subtract this from each side. So yeah, unfortunately, I did have to use two divides, one for each side. If your target never moves, you *could* get away with 1 divide (but what’s the fun in that?). But yeah this is a quick demonstration to see how each method works. Each test case is given the exact same data. So, my thoughts (UmiRope_Riggid.exe). Because the error in the Manhattan versus Magnitude, the rope is shorter. The rope being shorter to me isn’t that big of a deal, and this is why I initially didn’t see Manhattan being a problem. It’s a really cheap way to calculate an approximate total length of the rope, if it has many segments. However, Manhattan has it’s real notable flaw in calculating the new positions of the ends. In my opinion, it’s not terrible, it’s just not very natural looking. A cheaper than a “real” square root approximation would still be ideal here. Is this Umi-like though? Not quite yet. The Umihara Kawase rope is somehow very elastic, erratic, bouncy, where this is very rigid. Alright, more bouncy then. I included a variant that’s more bouncy, by using a 20% of the solve amount (UmiRope_Bouncy.exe). While reacting differently, I don’t think it’s an improvement. After it calms itself down, it looks more or less the same an the rigid example. Hmm… I am going to have to take a look at the game again. It might be possible to introduce another error that makes the Manhattan look more sproingy. But generally speaking, this approach to solving the rope is cheap. The only bottlenecks being a division per end, two multiplications per end to scale the vector in the normalization step, and two more to scale the normalized vector up by each side’s part of the difference, and everything else can boil down to adds, subtracts, and shifts. And if division is a problem, it can be replaced by indexing in to a table of reciprocals (1/1, 1/2, 1/3, 1/4, …), and multiplying by this reciprocal in the place of the division. So 5 multiplications plus a bunch of adds/subtracts/shifts, per side. At least, to solve the rope. Everything else I think is just some good “hopefully simple” logic to figure out what points to add to your list (deque). I’ll toy with that later. - - - Source is included. The notable functions are, all in main.cpp: cParticle::Step() - which is how we move each end of the rope. The multiply there is a friction hack, removing it makes coming to rest take more time. cManhattanRope::CalcRopeLength() and cManhattanRope::StepRope() are the variants needed to use Manhattan instead of Magnitude (i.e. Normalize). You can see the divide here, which is normally hidden in the normalize function. Steps are called in main, lower in the file. Filed under: Stuffing and Technobabble and The Spider Comments: 1 Comment |
|
Posted on 06.14.07 by Mike K @ 11:22 pm
Raigan and I have had an extremely brief dialog on in game ropes. It makes sense, for a while we were both doing rope driven games. Well, due to my failings as a communicator, I sort of just never got back to him. Yet, I absolutely love the topic, and certainly spent much time puzzled by it. Apparently I’ve also made the conscious effort to push my way in to obscurity. My apologies, everybody who’s mailed me. We virtually “ran in to each other” again a few weeks back, in a discussion on 2D game water physics, and so the need to share my thought looms over me again. Now that he’s in blog town, I knew I had no choice, and went ahead with zee said “scooping of theories” out of zee brain, and defaced his blog with it. I hope you don’t mind. The question. How the heck do you pull of physics like that on the SNES!?! As I saw, the discussion is less of a question of how to do a rope, but how do you make a rope work so beautifully on such *nothing* gaming hardware? The following is the slightly edited “shotgun blast to the face” I dumped in his comments. Learn more about the game here. - - - Here we go. My thoughts on how they pulled that off on the SNES, AKA 2-3 MHZ tiled beast. To put things in more perspective, a CPU with 8bit registers, and no internal multiplication or division. However, I think I read somewhere that there was either a hardware multiplier or divider, essentially some hardware address you plug some numbers in to, and several cycles later you can read back a result. This compared to the GBA with it’s 32bit registers, and it’s “so very nice” multiplication opcode. No big deal, it’s only 1 rope. First off, I think the biggest thing they had to their advantage was the tile graphics hardware. All Nintendo hardware except the N64, GameCube, and Wii have tile map 2D graphics hardware. Memory for 8×8 tile graphics, and memory for a map to build from those tiles. So really, you’re either making a tiled game, or your not making a game on those systems. So that means, as far as testing against collision, you’re only testing against easy aligned tiles (surfaces with normals (1,0), (0,1), and the negatives). Our rope, technically only needs to be concerned with things in units of tiles. A 64 pixel tall wall is merely 8 tiles, and only 8 “unit tests” as we interpolate across the line. Also, a locked framerate. So long as we don’t travel more than 8 pixels in 1 frame, we should be able to stay completely stable. Lets also say each tile only finds nearest edges on it’s exposed sides (i.e. no tile adjacent to me, then it’s an exposed side). And an optimization for rope segments, every 2 bends we can put the previous part to sleep. We just need enough memory set aside to support a dozen or so bends. The final big thing is something I ran in to durring my adventures deeper in to physics and maths. Something in math nerd speak called the Manhattan Length or Distance (I forget it’s proper name, I just call it the Manhattan). The Manhattan is a length formula for a line, in much the same way as magnitude (or magnitude squared, how I love thee). The formula is the sum of all the absolute value parts of a vector. I.e. Manhattan = abs(x) + abs(y). No doubt you’ve played with this yourself, and scoffed it off because it’s not an accurate length. That is, except in one key case… When it’s axis aligned! No square root required! (1,0) or (0,1) respectfully, the Manhattan or length is 1, and so would the magnitude. Why is this important? Tile hardware is axis aligned! So as long as we wrap around axis aligned things, our rope segments are accurate. Even if not, so what? Worst case, our rope shrinks a bit going over a slope. You’ve probably noticed how extra bouncy/elastic the rope in Umihara is. My best guess, is it’s because they live with the horrible innacuracies of the Manhattan Length. And truth be told, asuming that’s what it is, it still looks great. Eventually you’ll pendulum your self to a stop whilst hanging vertically. So there you go, Mike’s “how they did Umihara Kawase“. - - - Disclaimer: This is all theory. I’m too lazy to disassemble the ROM. It’s enough for me so that I can sleep at night. Filed under: Stuffing and Technobabble and Opinion and The Spider Comments: 2 Comments |
|
Posted on 04.10.07 by Mike K @ 2:45 am
It’s not secret Sony doesn’t yet have the same market penetration as the 360. So as a developer looking at ones options, Sony’s Bluray+Cell monster isn’t quite the most attractive choice yet. And what we consider a Live Arcade title as far as complexity, is a retail game on the Wii or DS. There’s a number of technical reasons why cross developing for Wii and DS is a headache (memory, ridiculously different polygon limits, gba graphics hardware, interfaces, …). But the PSP is to the PS3 what on board video is to a modern NVidia or ATI card. It’s usable. You’ll have to lower details everywhere to fit within your 2MB+32MB restrictions, but there’s enough commonalities you can safely cross develop. And it’s already happening. Lemmings, the classic Psygnosis game. Available in both the PS3 marketplace, and for the PSP. Grip Shift, a great stunt racing game. Available in both the PS3 marketplace, and for the PSP. Oh by the way, #1 baby! Of course, without NPD numbers, I have no clue if this strategy has worked for the above games. For that matter, I’m not even sure budget PSP games sell well (Platypus?). I found GripShift in the equivalent of the bargain bin at a grocery store for $15, and have the sneaky suspicion it hit the market as a PSP game long before the PS3 marketplace. Technically speaking, if you’re coding with the PSP in mind, then porting or cross developing for the PS3 should be straight forward (compared to Wii + DS). In theory, a 3GHz PPC should be able to handle the workload of a 200-333mhz MIPS. You still have your standard issues of developer + publisher + royalties relationship to consider for the PSP side. But what makes this interesting is that you can have an alternate revenue source for your game. And if you self fund, there’s more power to you as far as royalties. So as long as you’re not silly enough to still be playing the revolutionary graphics game, you can pull a Lemmings. One of the more unfortunate aspects for developers going downloadable is the lack of boxed game, to mount and show off. I know, it’s a novelty, but there’s something really positive about holding the CD, box or cart in your hand. Microsoft has code cards where you pull a tab back, and enter it in to redemption box in the marketplace. The only problem is I’ve only seen these included with the Arcade Joystick (it’s crap, don’t buy it). As well, they have Live Arcade game compilations every so often, but with the marketplace filling up, your chances of making the next compilation are becoming slimmer and slimmer. Going PS3+PSP gets you something. So is that a selling feature to go Sony? Perhaps, perhaps not. I’m just rambling. Filed under: Stuffing and The Business of Things and Technobabble Comments: None |
|
Posted on 04.07.07 by Mike K @ 3:49 pm
Hrmph. Strange. Anisotropic filtering in OpenGL on NVidia cards finally started to work after switching from uncompressed to DXT3 compressed textures. Whodathunk. Filed under: Stuffing and Technobabble Comments: None |
|
Posted on 03.27.07 by Mike K @ 10:54 am
Lets try a little experiment. (Try to) read this. Sykhronics Entertainment Anyone that’s followed my work probably won’t be miffed by that mean looking first word. But if you stuck around, you stuck around for my work, not my clever name. You probably have your own pronunciation of it too. I’ve certainly heard some interesting ones from telemarketers that whois’d my domains for a phone number. Lets see if we are thinking the same thing. Here’s me saying it. How did we do? Drop me a comment. That crazy invented word “Sykhronics” is something I came up with some 9 years ago, in 1998 I believe. At the time, Gamma Flare Games just didn’t seem cool anymore. It’s been a branding for personal productions, and when I started my own company, it became my company name. Having worked under the branding for so many years, I never really thought about it twice. I simply saw that registering it as a business was the next logical step. Oh, and it has a silent “H”. Whodathunk. To me, the name sounds (sounded?) cool. Kinda like a bastardization of Psi or psyche and electronics. Brain or mind technology, or something. Growing up a nerd, you tend not to be the cool kid, so you invent your own cool. But you see, I was generally oblivious to the idea that difficult names are hard to say. You see, I have another difficult name to deal with. My own last name. Kasprzak. Spell check likes to tell me that I spelled Kasparov wrong. Here’s how my family says it. I’m sure the Polish have their own pronunciation, but this is the Canadianese bastardization my family and I use. There are pluses to obscure names. If it’s not too similar to anything people have heard before, then it becomes memorable. But that’s the trick. Lets take a fictional company, Muttant Games. Without a dog for a logo, you might miss the “Mutt” aspect. If you have any sort of comic or cartoon background, you probably see it as Mutant Games. But in fact, you were being clever, so your logo is a deformed dog thing. This is a pretty tame case. But lets hop over a more obscure. Xanyatkiera Industries. WTF!? It’s nearly as bad as one of those ridiculously bad sci-fi names with all the apostrophes (Nak’tyla’i of Zya’ka’dal’ee). If anything, I’m just trying to encourage people stay away from the obscure. That goes for character names too, not just companies. There’s something to be said for the clarity of phonetically consistent names. I don’t know about most people, but if I come across an Apostrophe Name, I tend to glare away and make something up that matches the apostrophe pattern. That’s bad for storytelling, as it’s a strike against your immersion. My apologies to the lizard people and aliens that do have them in their names, but you can find an adaptation that’ll please everyone if you try. Spaces, extra e’s, whatever. Back to companies, picking a name that’s available in .com form is ideal, since it’ll only cost you $8 to claim your professionalism. Obviously the more obscure you get, the better the chances it’s available. There’s a reason catfish.com is taken, but fishycat.com isn’t (*yoink*). Names are important. Just a few a things things to consider, before you end up beginning every business meeting with the pronunciation game. Filed under: Stuffing and The Business of Things and Technobabble Comments: None |
| « newer posts | previous posts » |








