Sinister Soups Serving Musings On Game Development and Play


You’re Thinking It Wrong

Well, maybe not wrong, but too much. That was my problem, overthinking. I'm sure it's not a novel lesson to be learned, but it's worth repeating that sometimes, keeping things simple is the only way to go, and trying to make things more complex than they need to be is not only a waste of time, but ultimately doesn't give you the result you want.

Unfortunately, programmers tend to be wired to overthink things, or at least to try to model reality where reality has no business.

I'm working on a game in my spare time, and it's a game that involves physics. Or rather, it involves the perception of physics-like interactions. We're talking bouncing, and more specifically: levers. When one object lands on one end of a first-class lever (aka. a see-saw), the object on the other end should experience forces proportional to the normal component of the force of the landing object, and the distance of both objects from the fulcrum of the lever.

In other words, if an object lands near the end of the lever, it should launch the object on the other end of the lever further than if it landed near the fulcrum.

So I got it into my head that I would be calculating the torque of the landing object, or maybe taking the forces on one side and the other, but force (and therefore, acceleration) is useless unless you know how long it acted for (acceleration is change in velocity over time, after all) so how long should I apply the force to the object I'm launching? And what about angular momentum, linear momentum's bastard cousin? Shouldn't momentum be conserved... or something? So does that mean that I need to apply not only an acceleration but also a starting launch velocity based on the angular momentum applied to the lever?

As you might be able to tell, it's been years since I took a physics class, and my understanding of this particular aspect was fuzzy at best even then.

My friend, who is also working on this game, pointed out that all of this was a waste of time, because it likely wouldn't be fun anyway, and what we really needed was a set of rules that was fun to play, not necessarily "physically accurate." I knew he was right, of course, but I wanted to do both, I wanted the simple tweakable system, and the realistic physical simulation, the latter probably more as a challenge to try to figure this stuff out again.

Ultimately, I realized that even if I did get a realistic physics simulation working, both of my objects would have about the same mass, and therefore, either one landing on the lever wouldn't do much at all to the other. It certainly wouldn't result in the kind of wacky catapultation that we were aiming for.

So instead of mucking with the math any longer, I sat down and wrote a reasonable approximation of what I wanted to happen, not what would happen in real life. I simply launched the object on the end of the lever at a constant velocity scaled by each object's distance from the fulcrum. Not only did this give a pretty satisfying feeling to the way objects are launched, but it also immediately exposed a bunch of fun values to tweak. Now we could tweak the constant launch velocity, what weight either object's distance played in the final velocity, as well as the simple fact that there was now a working function where any sort of formula could be devised if we found that this one didn't work for us.

In other words, when I stopped overthinking it, I was able to quickly and easily cook up a system that was a lot more customizable than boring old reality, and allowed us to focus on fun gameplay, rather than my pedantic obsession with simulating reality.

A simple but valuable lesson then: don't spend even a minute worrying about how to implement a gameplay system if that system's goal is not fun gameplay. If you're thinking about how to implement a gameplay system, think about how to implement it so that it feels fun, and is easy to tweak for yourself and other designers.

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

You must be logged in to post a comment.

No trackbacks yet.