Jump to content
  • Advertisement
  • entries
  • comments
  • views

Music Tweaks, and Pac-Manimation

Sign in to follow this  


I've tweaked the music--instead of the drum track stopping when the player isn't eating pellets, it drops to one-third volume. It's an improvement, but it still seems a bit jarring. I think I'm going to ramp the volume up or down over a beat, or maybe half a beat. Quick, but more gradual than an immediate jump from full to one-third volume.

I also have the player model doing an eating animation now. It was easier to implement than I expected. The model is essentially a three-quarter sphere, like a globe placed sideways so the polar axis goes horizontally. Vertices are given an additional parameter (currently called "group" due to lack of proper descriptive skills), with all vertices on one longitudinal arc being given the same group number. These are numbered sequentially from 6 on the "upper lip" to -6 on the "lower lip."

I take the time since last beat over the beat length, multiply this ratio by 2 pi. The absolute value of the sin of that gives me a variable that goes from 0 to 1 to 0 to 1 to 0 over the length of a beat. (If you can think of a better way, let me know.) This "chomp factor" gets passed to the shader that draws the player. There's a check to make sure the player is moving before that calculation is made. If the player is stopped, the variable is set to 0.

In the vertex shader, I construct a rotation matrix. Vertices on the upper lip are 45 degrees off the horizontal. Their group is 6; 45 / 6 = 7.5. So I take group * 7.5 * the chomp factor to determine how far to rotate the vertex this frame. Longitudinal arcs farther back have lower group numbers, and those on the bottom of the model have negative values, so it works out pretty well. The mouth closes a given amount, and the other vertices space themselves out evenly as the surface of the player model expands.

It worked on my first try.

I likely need graphics to better describe the method. I'll get them up soon.[s] Also, no video with this update, much as I'd like to. It takes a couple hours to upload a video to YouTube on our connection, and the housemate works from home on Fridays; I don't want to eat up his bandwidth. I'll do my best to get one posted Sunday or Monday.[/s]

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!