Archive for January 12, 2011

Game State Management

0

On the way to scripting my intro, I realized that I just didn’t have the infrastructure in place to do so – yet. I finally happened upon the XNA Game State Management example. It has a pretty awesome interface with a relatively simple concept; many game screens for different purposes with logical layering and so forth. I am going to integrate this into my main engine and try to use what it brings to the table to help with my introduction, and in the process I think I’m going to get a menu system for “free.” This will slash a couple of things off the to-do list.

Config.ini

0

I just finished ripping out the configuration code I was using and replacing it with EasyConfig, so now I have a nice configuration file. Here’s a snippet of what that looks like:

[MenuControls]
# Keyboard Menu Controls
AcceptKey = "Enter"
BackKey = "Back"

# Xbox Menu Controls
AcceptButton = "A"
BackButton = "B"

[Video]
Width = 1280
Heigh = 720

So I really like that library, and it’s the kind of thing I appreciate most during development of anything – why re-write something that’s been done a million times if there’s a good library like EasyConfig that you can use instead?

What to do next… I think what I’d like to next is figure out how to script some really basic cutscenes. I just don’t know what the best way to do this is yet, so it’ll require some research. I hear that the C# “yield” keyword is pretty great, but I don’t yet understand it, so hopefully it won’t take me too long to figure out. What I’d like to be able to do is have some really basic script files that are perhaps referenced in my maps and triggered when the player gets to a certain point. For now I just want to get the first cutscene in the game going, with a title and little bit of audio/animation. It’s going to be really cool, I think, based on some of the sound effects I found, and there are many more to try.

Does it sound like it’s raining?

0

Yep! I just got done adding a new class to allow game objects to play audio, using the helpful information here. I’m using XACT to manage all of my audio files, so I created an initial Wave Bank and Sound Bank and instantiate those with the AudioEngine class, and then just take requests from other objects when they want sounds to be played. For now, I’ve allowed my map files to have a “BackgroundTrack” property defining the name of a background track to play for the map, and it’s the sound of rain to go along with the rain particle effect that I’m using in the current demo.

So it’s great that all that’s figured out. The next thing I need to do soundwise is figure out how to have so-called “3D Sound,” but in my 2D environment, so that as the player gets closer to certain sound-making objects the audio for them gets louder. I realize now that the “dynamic audio” I had in mind is not exactly difficult, because I can just play sound whenever I want with any object; all they need to do is request the correct sound be played at the correct time. I’ll probably move on to other functionality for now, because at the moment I just wanted to make sure that I could create a basic Audio class and be able to play sounds or background tracks with it.

The real next step is going to be integrating a configuration library I found called EasyConfig, which will let me define configuration files easily and intuitively. After that’s done, I’m going to move on to either creating a MovingPlatformComponent that moves between a list of points at a given speed, or creating a simple way for me to script basic cutscenes so that I can create the opening sequence for Ne+.

Go to Top