Ecrofirt

Now I know XNA is supposed to be for game development, but its ease of use should also allow for very simple screen saver programming.

In only a few hours I've got a completely working version of the Windows Starfield screen saver up and running, and I'm sure other people here could come up with stuff that's a ton more creative than that.

What would be hard about turning these into completely working screen savers Well, let's look at what goes on with a screen saver:

1) The program gets sent one of 3 switches: /c - which should bring up the Options menu, /p - to bring up the preview window, and /s to actually run the screen saver. These are easy to handle.

2) The program closes itself upon mouse movement or a key press. This is just as easy.

With that being said, has anyone else thought about the possibility of making XNA screen savers I think the ease-of-use could help a lot of really neat screen savers get off the ground.


Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

Jim Perry

I'm more interested in doing games with XNA than screensavers, but that's just me.




Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

XNA Rockstar

Yeah, I was thinking the same thing.  Right now, I have a 3D space screensaver and while I was watching it one day, I thought how cool it would be to have my own screensaver running on it instead.  Maybe even using graphics or levels from one of the games I've already made.  For example, picture the winner of the XNA Homebrew competition, Wildboarders with either a script or AI programmed into the main character so he moves and jumps through the level.  Then I pictured sending my custom screensaver to my friends and family...and I got even more excited.

But I haven't looked into the technical side of how it would all work.  Ecrofirt (or anyone else in the know), have you gotten one up and running so that Windows recognizes it as a screensaver   Or is it even possible to do with the XNA framework





Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

WilderLand

Well the real problem revolves around the fact that the .NET 2.0 framework needs to be installed for XNA to work, which is a fairly hefty download. If it is for yourself, its not a problem, but if you plan to distribute it I'm not sure a lot of people would download something so massive for a screen saver. Now as Vista becomes more prevalent, this issue should go away, but for now most desktops have .NET 1.1





Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

MattDavey

22.4mb doesn't seem all that hefty to me!





Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

Jim Perry

Me neither, especially since you only need to do it once and anyone that downloads it will probably be downloading more things that use it. Even tacking on a zero doesn't make it hefty with broadband. So it takes a minute or two. Not a big deal. It's different if you're on dial-up I'll admit, but I only know 1/50 people or so stuck using it.




Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

xna3der

Argh my computer all of a sudden doesn't want me to login to these accounts...using my moms comp.Anyways i have thought of making a screensaver using XNA in fact i did what you did sit there and watch a 3D one (man she needs a new keyboard) in fact after reading this i went ahead and started one it detects when the mouse moves(sorta i will post later on mycomp) and it's full screen now to add stuff.

xna3der Koded.





Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

Richard Kain

I've actually created a fully functional 3D screensaver before. Of course, I did it using Irrlicht 3D and coded it in C++. It's actually quite challenging. Now, I'd imagine that doing it with C# and Games Studio Express would be a lot easier. I experimented with Visual C# express screensaver template, and it was very easy to work with. It would just be a matter of incorporating the general structure of a Game example with that of a C# screensaver. The most important matter is incorporating the arguments into the Main() function, as those arguments are absolutely essential for a screensaver to function properly. I don't actually think its necessary to detect mouse movement, I'm pretty sure Windows handles that itself automatically. And you have to program reactions for each of the different arguments.

For the condition of receiving the /c argument, you have to set your screensaver to pop up a WinForms window that will allow for any changes, or just to display credit information. If you don't set something up for this, nothing will happen when the user pushes the "settings" button on the screensaver tab. And that is unprofessional. A good screensaver has something happen when you hit settings. Even if its nothing more than a simple box with a "Close" button. Also, the /c argument has to use WinForms, you can't do it the same way games are handled. WinForms are event driven, while the Game template is loop/update driven. And the /c argument's nature makes WinForms a necessity.

The /p argument is a bit easier. For that, you can use the same code that you use for the screensaver proper, but just set it to run and render at a much lower resolution. If you want to save on loading time, you can change it up to use lower-resolution assets, or even just have it display a static preview image instead. The preview should give some idea as to what the full screensaver will be like, but it doesn't have to actually reproduce it at all. Whatever you find works best should be acceptable.

The /s argument is arguably the most important. This is where the actual screensaver is defined. This is where you are definitely going to want to implement the Game template. This argument is ideally suited to use the XNA framework. Now, its best not to accept user input for this section. Ideally, it would be best to set this to run in fullscreen, and leave the mouse pointer hidden. You can have it do anything you want it to, but it should be automatic. There are ways to disable the mouse movement trigger, and input your own for exiting the screensaver. But for a first effort, I would stick with the default Windows mouse movement exit.






Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

SevenOfEleven

I was able to make a screensaver using directx.

Would love to know how to combine xna with the screensaver code too.

Writing a game is great but its good to have your own screensaver too.

Getting tired of seeing the MS windows 3d screensavers.





Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

Bill Reiss

If you take the code from this project:

http://www.codeproject.com/csharp/scrframework.asp

and combine it with samples to render XNA to a Windows Forms window handle (for example a PictureBox):

http://www.tonigreco.it/_xna_/list.asp

you should be close to what you're looking for.






Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

Ecrofirt

Hey, I thought people might be interested in this.

I've created a visual studio installer package for a bare bones XNA screensaver. It contains the following:

1) The ability to handle common screensaver switches /s /c and /p, as well as no switches or other bad switches. /s runs the screensaver, /c brings up the options menu, and /p doesn't preview anything.

2) An InputManager game component that exits the screensaver if any changes occur to the mouse or keyboard during program execution.

3) A blank settings WinForm that will pop up if the user runs the screensaver with /c. It's your job to add whatever options you need for the screensaver, or you can easily remove the form entirely.

4) Code to hide the mouse pointer, set the graphics device to use the same size as the user's desktop, and make the graphics full screen.

When you compile your project, it will still have the .exe extension. Manually change this to .scr and move it to the system32 folder, and it works perfectly as a screensaver. I've had one I made running as my screensaver for 3 weeks now!


Here's the template for anyone interested:
XNA Screensaver Starter Kit

Here are some things I recommend:
* Since you're making a screensaver, it's probably best to use embedded resources so as to not clutter up the system32 folder.
* I've found it works well to save your settings in the user's application data folder.

Enjoy, and I only ask that you give me a 'thanks' if you happen to use this as a base for a screensaver.


-James O'Meara




Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

XNA Rockstar

Sweet!! Thanks for taking the time to put this together. I'll have to check it out later today.



Re: XNA Game Studio Express Has anyone thought of making XNA screen savers?

Ecrofirt

Please let me know if you run into any issues with it.

I've already gone and fiddled with the InputManager a bit so it should work slightly better.