XNA UK User Group
A helping hand for bedroom coders throughout the land.
RandomChaos Game State Manager Source Release

Blogs

RandomChaos

Syndication

So, as I said in my last post, I have decided to put up the source code for the GSM. To use it in your projects, either add the project to your solution and add the reference from the project tab of the Add Reference window or, build it and brows for it when adding it as a reference. Then you need to make sure the built content folders and there contents are in the build folder of your project or you will get build errors.

I am also including a game written using the GSM to show how you can simply inherit from it to build a quick and easy menu system for your game. In this case I chose something I knew would be quick to write as a demo, Space Invaders. All assets, both image and sound are courtesy of Classic Arcade Games.

All in all it took me about 3 days to code the game with the GSM, so that's about a hour and a half a night,hmm, maybe 2, so say 6 hours to do this. Now the assets are pre built so did not have to do those, well broke them up a little and formatted them, but not much really. Anyway, I think it shows how fast you can create a simple demo.

  

It's pretty simple stuff, I have not put any nice animation, the bunkers can't be damaged and the invaders are not animated.. I know, half a job... Oh well, you have the GSM source now and my half done Space Invaders....enjoy.

If you have any queries or issues using the GSM, give me a shout, just remember, it comes warts and all...

Download located here.


Posted Mon, Apr 7 2008 9:49 PM by Nemo Krad

Comments

GameDevKicks.com wrote RandomChaos Game State Manager Source Release
on Mon, Apr 7 2008 10:49 PM

You've been kicked (a good thing) - Trackback from GameDevKicks.com

OmaR_ShaRif wrote re: RandomChaos Game State Manager Source Release
on Sun, Apr 13 2008 1:33 PM

Hello,

I think your GSM is very useful, but I have a question.

I have a MainMenu that I display by default, and I put sound in this mainmenu, and I would like to stop the sound when I choose one of the item.

I think I have to play with the AdditionalSelectCode event, but I'm unable to do so, how can I do to stop all the sounds with this event, I don't know much of delegates, I tried something based on a course on the internet, but nothing goes well.

I really enjoy if you can put an example of how to do this.

Thanks

Nemo Krad wrote re: RandomChaos Game State Manager Source Release
on Sun, Apr 13 2008 8:14 PM

OK,

AdditionalSelectCode is an event like any other, just wire it up like you would any other event. If you have not wired events before let me know and I will put up and example.

Once you have wired the event up you can get the MenuItems ParentMenu object and use it's StopMusic method to stop the sound.

Glad you like my GSM and find it useful.

Let me know if you want the event tutorial..

JSouth wrote re: RandomChaos Game State Manager Source Release
on Thu, Apr 17 2008 4:31 PM

Hey, I am just getting into XNA game development and was working on my own screen system similar to this. I am going to check out yours, it sounds like it does exactly what I was looking for. I would love to see the tutorial for events that you mentioned when you have time to put it together.

H wrote re: RandomChaos Game State Manager Source Release
on Fri, Apr 18 2008 4:43 AM

hiya,

i'm new to xna and i have just developed a game which has a menu screen but i can work out how to get from the menu screen to the actual game. can you please help

Nemo Krad wrote re: RandomChaos Game State Manager Source Release
on Fri, Apr 18 2008 9:01 AM

J South,

As soon as I get the time I will put up an event sample.

H,

I guess the best advice I can give you is download the source from here and see how I am doing it through my GSM. I do not know the mechanics of your system so will find it hard to comment.

OmaR_ShaRif wrote re: RandomChaos Game State Manager Source Release
on Tue, Apr 22 2008 6:43 AM

Sorry I'm late.

Finally, I made a new game "from scratch", without using your GSM.

I had some issues with the fact that all the menus are all launched at the same time, and that they all stay "alive".

Thought your GSM is very interesting, I don't have much time to learn more about the using.

Thanks

(sorry for my poor english :P)

Scott wrote re: RandomChaos Game State Manager Source Release
on Mon, Aug 10 2009 7:00 PM

I understand that no one has posted here for over a year.. but...

I've recently found your GSM, and have started to use it as a basis for some hobby game building (for PC).

One of the features that I'm trying to implement is the ToggleFullScreen, while it's easy enough to call the toggle routine, the GSM doesn't seem to understand that the device has changed sizes.

I've poked around within the classes, I just wanted to make sure I wasn't missing something obvious to make the GSM auto adjust to resolution changes.

I've already started down the path towards implementing this within the GSM, but any helpful advice would be appreciated!

Thanks!

Nemo Krad wrote re: RandomChaos Game State Manager Source Release
on Tue, Aug 11 2009 12:55 PM

No worries.

If I remember right you can set up the Top, Left, Width and Height elements of the objects so you can have more than one menu screen on screen at any one time.

I guess you could wire up an event that you can call to modify the offset by the new coordinates when you flip the screen.

Might be worth doing this in the manager and then adding a defualt coord update method to the screen objects so you only have to do it in one call.