I've put together a very basic sound engine for my Lunar-lander-on-a-disc game, although it isn't in a released version of the game yet.
It's my first time using XAudio2; it went fairly painlessly. The only trouble I had was with my synchronization between the playback thread and the sound generation thread. Originally I was using an event but it was possible for the consumer to occasionally generate two events (meaning it had consumed two buffers) while the producer was busy. After this happened a couple of times (I am currently triple-buffering) the producer and consumer would wind up writing to and reading from the same buffer, with nasty-sounding results. I switched to a semaphore which keeps a count of how many unqueued buffers there are and it works fine now.
At the moment my sound engine is very, very low-level. I generate sound in small batches (17 ms at a time, one video frame's worth) and feed it to XAudio2 for playback. I'm not using any pre-recorded audio yet and I'm not really doing much signal processing yet either. Since I'm triple-buffering there are a couple frames of latency; I may shrink the buffer size to reduce that.
Now I'm trying to come up with a good, interesting rocket engine sound. All I have so far is some white noise that has been filtered with a 64-tap low-pass FIR filter. It's also shaped with a basic envelope for when the thruster is on or off.
I am currently generating the white noise at 44.1 KHz and filtering it down which is incredibly wasteful. I'm going to switch to synthesizing the noise at 11 KHz or lower and upsampling to the final rate since I am knocking out all the high frequencies anyway. I want to experiment with a dynamically-changing filter as well so I can get interesting transient effects at the start and finish of a rocket firing. I'd like to give the noise more of a 1/f or 1/f-squared shape as well since I think it might sound better (louder bass, softer treble). It's just kind of a generic hiss right now.
I've experimented in Audacity with phasing and it produces some really nice whooshy effects so I may try to come up with a way of relating phasing to what is going on; maybe do phasing based on the nozzle angle or something, so that as the nozzle sweeps back and forth you get some stereo effects.
The steering jets will get their own sound generators as well, and then it's on to impacts, weapons, and whatever else is needed.
Tuesday, December 21, 2010
Monday, November 1, 2010
Reviews: Sherman Alexie and Marjane Satrapi
Here in the Pacific Northwest it hasn't been long since the land changed hands. A lot of sad things happened and are still happening. I used to walk over to the site of the Whitman Mission on Saturday afternoons. Some people brought religion and farming and smallpox there and got killed in 1847 and it started a series of wars. I haven't ventured into any of the area's many reservations other than passing through on the highways, but when I fly over the Yakama reservation and see the trailer homes on the barren hills surrounded by their trash collections I imagine the sadness radiating upward. (Maybe my imagination's way off, though!)
The Absolutely True Diary of a Part-Time Indian is Sherman Alexie's semi-autobiographical novel about leaving the Spokane Indian Reservation, with illustrations by Ellen Forney. Arnold Spirit (“Junior”) is fourteen when he discovers his mother's name in his geometry textbook; the school hasn't acquired new books in the last 30 years. His teacher convinces him he has to leave the reservation to fulfill his potential. Junior transfers to Reardan High in a nearby white farm town, where he and the school's mascot are the only Indians. His tribe (apart from his family) take it as betrayal. When he makes the Reardan basketball team he finds himself up against his former best friend.
“Diary” is poetic, funny, sad, and raunchy. It ought to ring true with anyone who has had to leave home and family to get where they are.
Speaking of cultural displacement, the Pacific Northwest area now has a large Iranian immigrant population, including a bunch of Baha'i.
Persepolis: The Story of a Childhood

Marjane Satrapi was in grade school in Tehran when the Islamic revolution happened. Suddenly she was forced to wear a veil and attend segregated school. Then things got worse. Her parents eventually shipped her off to France when they realized that she wouldn't be able to have the life they wanted for her.
Once she found her feet in France, Satrapi produced this beautiful black-and-white graphic novel autobiography. She's done several more volumes and an animated film. It's been a while since I read this but I recommend it highly as well if you want to know more about what's happened in Iran.
The Absolutely True Diary of a Part-Time Indian is Sherman Alexie's semi-autobiographical novel about leaving the Spokane Indian Reservation, with illustrations by Ellen Forney. Arnold Spirit (“Junior”) is fourteen when he discovers his mother's name in his geometry textbook; the school hasn't acquired new books in the last 30 years. His teacher convinces him he has to leave the reservation to fulfill his potential. Junior transfers to Reardan High in a nearby white farm town, where he and the school's mascot are the only Indians. His tribe (apart from his family) take it as betrayal. When he makes the Reardan basketball team he finds himself up against his former best friend.
“Diary” is poetic, funny, sad, and raunchy. It ought to ring true with anyone who has had to leave home and family to get where they are.
Speaking of cultural displacement, the Pacific Northwest area now has a large Iranian immigrant population, including a bunch of Baha'i.
Persepolis: The Story of a Childhood

Marjane Satrapi was in grade school in Tehran when the Islamic revolution happened. Suddenly she was forced to wear a veil and attend segregated school. Then things got worse. Her parents eventually shipped her off to France when they realized that she wouldn't be able to have the life they wanted for her.
Once she found her feet in France, Satrapi produced this beautiful black-and-white graphic novel autobiography. She's done several more volumes and an animated film. It's been a while since I read this but I recommend it highly as well if you want to know more about what's happened in Iran.
Turrets Debut

Turrets make their first playable appearance in today's update to my lunar-lander-on-a-disc game, available on its website.
In addition the rocket has now been outfitted with machineries of aggression: Press right mouse button to fire projectiles out of the rocket's nose, and B to drop a bomb. Bombs start out with the same velocity as the rocket so you can use your ballistic trajectory plot to see where they will go. The nose gun has its own new trajectory plot.
Various other things have been tweaked. The landing gear now uses Chipmunk's damped-spring constraints instead of doing the spring and damping in the step itself. The damping is significantly different between the two approaches; I've tried to tune it back to be similar to before, but with less bounciness. I've also made some semi-successful attempts to tune the landing gear shock movement range to prevent inversion when you hit it sideways, but it's still doable.
The rocket doesn't activate its orientation thrusters when either of its feet are touching the ground unless the main thruster is firing. This makes landings a bit more difficult since you cannot cancel unwanted rotation quite as easily. I might try having the orientation thrusters automatically switch to rotation cancellation once you touch ground if this feels too hard.
I tried and removed missiles that accelerate continuously. They look cool but they make the game really easy, so I'm still thinking about them.
Another change is that there is now a two-planet progression. The first planet has fewer caves and fewer astronauts. The second planet is the classic one.
Monday, October 25, 2010
Work heats up
Work's getting more hectic. I am plodding forward on the lunar lander game nonetheless. I've spent a little bit of time working on coming up with distinct styles of randomly-generated planets in preparation for having a series of them in the game. The big failure there was an attempt to make a loose archipelago of small asteroids. I will need to attack it in a completely different way from how I was doing it. Planet generation needs to be spun off into its own thread so the game is always responsive.
Turrets are getting tuned up now too; hopefully they will make their debut soon. Making the game more challenging is a top priority. Last night I tried making turrets wait to shoot until they can hit the rocket at its closest point; it didn't feel very good. Not enough shooting. I could make them take that point in time and space out shots before and after it but I don't think it's worth the trouble. Next I tried taking the turrets off a synchronized shooting schedule. I'd had them synchronized because I thought it would provide a good rhythm to the game but due to the varying flight times of the shots it didn't, really. Now each turret shoots as soon as it has a shot and then runs its own recharge timer. This feels pretty good. I need to work on having the turrets turn to line up their shots, which will give them an initial reaction time. That may affect how their schedule operates.
The turrets' bullets now hit the rocket. They impart a fixed impulse and a fixed amount of damage. I may fudge the impulse so it applies less torque than is physically accurate. It's cool seeing the rocket get knocked about but if it tumbles too much it just gets annoying. The bullets make use of Chipmunk's sensor shapes; they don't participate in actual collision response, just report contacts. I handle the rest. (I'm thinking of the bullets as an energy ball right now.)
Next is to give the rocket a means of fighting back and disabling the turrets. I am unsure whether I will do a bomb-dropping weapon or a shooty weapon first. Bombs are interesting from a trajectory point of view (this game is all about trajectories) but if they allow you to take out turrets from outside their range it might not be very fun. Limited inventory is the typical way to solve this. Shooting will involve aiming distinct from the aiming used to fly so it'll be an interface problem. I will probably use the same aim and have different buttons for thrust vs. shoot, but the question is what to do with the rocket's auto-rotation. You don't necessarily want the rocket spinning around while you squeeze off a few shots during an approach. I could drop auto-rotation except while thrusting; may try that. Pedro found the auto-rotation confusing. On the other hand, that's giving up some control of the rocket.
Some other similar games like Gravitron 2 (available now on Steam and XBox Live; go get it) have direct rotation control which solves the aiming problem, but it creates problems when interacting with the landscape. Gravitron's landings and impacts feel very unsatisfying to me.
Turrets are getting tuned up now too; hopefully they will make their debut soon. Making the game more challenging is a top priority. Last night I tried making turrets wait to shoot until they can hit the rocket at its closest point; it didn't feel very good. Not enough shooting. I could make them take that point in time and space out shots before and after it but I don't think it's worth the trouble. Next I tried taking the turrets off a synchronized shooting schedule. I'd had them synchronized because I thought it would provide a good rhythm to the game but due to the varying flight times of the shots it didn't, really. Now each turret shoots as soon as it has a shot and then runs its own recharge timer. This feels pretty good. I need to work on having the turrets turn to line up their shots, which will give them an initial reaction time. That may affect how their schedule operates.
The turrets' bullets now hit the rocket. They impart a fixed impulse and a fixed amount of damage. I may fudge the impulse so it applies less torque than is physically accurate. It's cool seeing the rocket get knocked about but if it tumbles too much it just gets annoying. The bullets make use of Chipmunk's sensor shapes; they don't participate in actual collision response, just report contacts. I handle the rest. (I'm thinking of the bullets as an energy ball right now.)
Next is to give the rocket a means of fighting back and disabling the turrets. I am unsure whether I will do a bomb-dropping weapon or a shooty weapon first. Bombs are interesting from a trajectory point of view (this game is all about trajectories) but if they allow you to take out turrets from outside their range it might not be very fun. Limited inventory is the typical way to solve this. Shooting will involve aiming distinct from the aiming used to fly so it'll be an interface problem. I will probably use the same aim and have different buttons for thrust vs. shoot, but the question is what to do with the rocket's auto-rotation. You don't necessarily want the rocket spinning around while you squeeze off a few shots during an approach. I could drop auto-rotation except while thrusting; may try that. Pedro found the auto-rotation confusing. On the other hand, that's giving up some control of the rocket.
Some other similar games like Gravitron 2 (available now on Steam and XBox Live; go get it) have direct rotation control which solves the aiming problem, but it creates problems when interacting with the landscape. Gravitron's landings and impacts feel very unsatisfying to me.
Friday, October 8, 2010
Lander Game WIP
Just posted a new version of my Lunar Lander game on its site.
There are only minor changes from the previous version. The braking line more accurately matches up to the powered trajectory plot, and there are indicator circles around the landing targets when they are very small.
There are some additional undocumented keys that will go away in the future, for things I am working on or experimenting with:
F1-F3 set the camera to one of three different modes (Auto, Manual, and Experimental).
F toggles a debug display of what the camera is trying to frame.
G toggles the ramp motors (ramps are not finished).
Home rescues the nearest guy instantly; useful for testing the camera framing and the end game.
There are only minor changes from the previous version. The braking line more accurately matches up to the powered trajectory plot, and there are indicator circles around the landing targets when they are very small.
There are some additional undocumented keys that will go away in the future, for things I am working on or experimenting with:
F1-F3 set the camera to one of three different modes (Auto, Manual, and Experimental).
F toggles a debug display of what the camera is trying to frame.
G toggles the ramp motors (ramps are not finished).
Home rescues the nearest guy instantly; useful for testing the camera framing and the end game.
Wednesday, September 29, 2010
Conversation starter #3
Sure-fire topics for easily striking up conversations with strangers:
With guys: Shaving
With new parents: Poop
With Pacific Northwesterners: Dietary restrictions
Approximately two-thirds of Seattle-area residents (a number I just made up) have some sort of dietary restriction, whether due to ideology, allergy, or both. If you're at a party just say "No thanks, I'm gluten-free right now" and you'll be off and talking with a bunch of the attendees. "Oh yeah, I have a gluten allergy too. These cookies are too good to pass up, though."
You can cross this with the new-parent poop topic: "Yeah, we're trying cutting lecithin and nuts from her diet; her poop was looking sort of greenish and she was howling at all hours of the night."
Thanks to preschool I now know that peanut allergies can be classified into airborne and contact variants. Parents take turns bringing snacks for the class and holy cow does that afford opportunities for dietary-restriction talk.
I have uncharitable theories about why this is. The Northwest is full of tech types who believe that religion is superstitious nonsense that is beneath them. Unfortunately for all of us, the universe is capricious and hard to understand, much less control. The urge to do both is within us all, though, and it finds its way out one way or another.
My related theory is that food allergies is a religion that does not set off the "no other gods before me" alarm in Judaism/Christianity/Islam. Thus it is a good mix-in religion. The Northwest is full of people who have been transplanted from all over the world. A mix-in religion is a great way to bond people of different faiths together.
With guys: Shaving
With new parents: Poop
With Pacific Northwesterners: Dietary restrictions
Approximately two-thirds of Seattle-area residents (a number I just made up) have some sort of dietary restriction, whether due to ideology, allergy, or both. If you're at a party just say "No thanks, I'm gluten-free right now" and you'll be off and talking with a bunch of the attendees. "Oh yeah, I have a gluten allergy too. These cookies are too good to pass up, though."
You can cross this with the new-parent poop topic: "Yeah, we're trying cutting lecithin and nuts from her diet; her poop was looking sort of greenish and she was howling at all hours of the night."
Thanks to preschool I now know that peanut allergies can be classified into airborne and contact variants. Parents take turns bringing snacks for the class and holy cow does that afford opportunities for dietary-restriction talk.
I have uncharitable theories about why this is. The Northwest is full of tech types who believe that religion is superstitious nonsense that is beneath them. Unfortunately for all of us, the universe is capricious and hard to understand, much less control. The urge to do both is within us all, though, and it finds its way out one way or another.
My related theory is that food allergies is a religion that does not set off the "no other gods before me" alarm in Judaism/Christianity/Islam. Thus it is a good mix-in religion. The Northwest is full of people who have been transplanted from all over the world. A mix-in religion is a great way to bond people of different faiths together.
Monday, September 27, 2010
Minecraft, Layton Reviews
Took a week of vacation at home; sigh, yes, a “staycation.” Amongst other things I managed to play a few computer games:
Minecraft
I've spent a ton of time playing this game. Rock, Paper, Shotgun ran a play diary which convinced me it was worth shelling out for in its alpha state. I have not been disappointed.
Here's a fan-made trailer for the game:
Minecraft (in survival mode) drops you into an infinite, randomly-generated world. Your immediate goal is to survive the nights, when various monsters come out. Once you have your basic safety assured, though, you are free to explore, dig mines for rare materials, and construct grandiose architecture. The game's in alpha and has been built by one man so far. Due to its increasing popularity he is hiring help though.
Professor Layton and the Unwound Future
Just finished this third game in the Layton series of puzzle games. It's as charming as ever; the production levels are steadily rising as the series progresses, with more voice acting and more beautiful animated movies than I remember in the previous installments.
A Layton game strings together a big collection of brain teasers with a barely-related story in which Professor Layton and his boy sidekick Luke solve mysteries. In this case they have received a message from someone claiming to be Luke from ten years in the future, requesting aid. Layton's lost love also comes into the tale; she was a scientist who died in a mysterious laboratory explosion ten years prior.
If you get stuck you can spend hint coins for increasingly specific tips. If you've played the previous Laytons, I think they've dialed back the puzzle difficulty quite a bit here. I don't mind too much; I was fairly frustrated in a few places in the first game.
A couple other games I've been playing but haven't finished:
Zak and Wiki: Quest for Barbaro's Treasure
A point-and-click adventure game for the Wii platform. Kind of fun. I'm playing through it a little bit at a time with my four-year-old.
Dragon Quest IX: Sentinels of the Starry Skies
I am generally pretty burnt out on Japanese role-playing games. This one seems like it's quite charming, despite having a very, very traditional battle system. I'm trying to save my JRPG stamina for the Ghibli-co-produced ones coming out next year so I don't know if I will finish this one.
Minecraft
I've spent a ton of time playing this game. Rock, Paper, Shotgun ran a play diary which convinced me it was worth shelling out for in its alpha state. I have not been disappointed.
Here's a fan-made trailer for the game:
Minecraft (in survival mode) drops you into an infinite, randomly-generated world. Your immediate goal is to survive the nights, when various monsters come out. Once you have your basic safety assured, though, you are free to explore, dig mines for rare materials, and construct grandiose architecture. The game's in alpha and has been built by one man so far. Due to its increasing popularity he is hiring help though.
Professor Layton and the Unwound Future
Just finished this third game in the Layton series of puzzle games. It's as charming as ever; the production levels are steadily rising as the series progresses, with more voice acting and more beautiful animated movies than I remember in the previous installments.
A Layton game strings together a big collection of brain teasers with a barely-related story in which Professor Layton and his boy sidekick Luke solve mysteries. In this case they have received a message from someone claiming to be Luke from ten years in the future, requesting aid. Layton's lost love also comes into the tale; she was a scientist who died in a mysterious laboratory explosion ten years prior.
If you get stuck you can spend hint coins for increasingly specific tips. If you've played the previous Laytons, I think they've dialed back the puzzle difficulty quite a bit here. I don't mind too much; I was fairly frustrated in a few places in the first game.
A couple other games I've been playing but haven't finished:
Zak and Wiki: Quest for Barbaro's Treasure
A point-and-click adventure game for the Wii platform. Kind of fun. I'm playing through it a little bit at a time with my four-year-old.
Dragon Quest IX: Sentinels of the Starry Skies
I am generally pretty burnt out on Japanese role-playing games. This one seems like it's quite charming, despite having a very, very traditional battle system. I'm trying to save my JRPG stamina for the Ghibli-co-produced ones coming out next year so I don't know if I will finish this one.
Subscribe to:
Posts (Atom)