Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Wondering if there is anyway to run an XNA game with out displaying anything.

I have a working game that runs in a client server setup where one player is the host and other people can connect to his game.

I now want to be able to run the game as a host on a decicated server with no graphics card, basically I dont want to run any Draw() logic at all.

Do i really need to go through the entire game and remove all references to XNA?

How have people done this?

EDIT: The reason I want to do this is because I have a working client server setup in the game and I dont want to make a separate "headless" server program.

share|improve this question
    
Why can't you just write code in Draw like if (headless) { return; }? –  ashes999 Feb 4 '13 at 2:41
1  
@asher999 Not sure if that will completely remove all draw and graphics logic from the game. A virtual server may not have any real graphics adapter at all. –  Jens Berfenfeldt Feb 4 '13 at 11:44
    
Changing the output type or skipping drawing will not magically remove XNA's dependency on a graphics device. If you are loading any content that requires a graphics device (especially textures) there is a very good chance those will fail to load using either of the proposed solutions. –  dadoo Games Feb 11 '13 at 14:14

6 Answers 6

up vote 10 down vote accepted

Just make a normal C# project and include the XNA binaries. This will gain you access to the XNA data types and framework methods. My game does this and it works flawlessly.

share|improve this answer
1  
I'm guessing you wrote a wrapper that acts like XNA calling the needed methods such as Update for you? I'll give this a go, thanks. –  Jens Berfenfeldt Feb 4 '13 at 11:46

The answer is: don't do this. If you don't need to make a game - i.e; you're not looking to take advantage of the things XNA offers, why do it? You really should be looking into developing a custom piece of software that can successfully simulate the game you wish to play - typically a console system of some sort. If you give more details, I will update my answer with a less generic response.

share|improve this answer
1  
I can give you one reason: unit testing. Often you want to test a piece or section of code without having to load or draw and graphics. –  Stephen Tierney Feb 4 '13 at 1:10
3  
@StephenTierney I can give you one other reason: he's not trying to, he's trying to run a game server (on a dedicated machine). Please re-read the question and consider taking back your downvote. –  Vaughan Hilts Feb 4 '13 at 1:11

Well if you simply wish to eliminate the draw calls have you tried using this : Suppress Draw

share|improve this answer

To build on untitled's suggestion, you can just include references to the DLLs and use them without using any of the default game loops. For examples of this you can look at the winforms tutorial series on the creators club: http://xbox.create.msdn.com/en-us/education/catalog/sample/winforms_series_2

Also if you want to get even more fancy you can replace the entire XNA game loop with your own custom one, and control the entire process. For more information on this look at http://stackoverflow.com/questions/6361691/custom-xna-game-loop-in-windows

share|improve this answer

If you change the Output Type of a XNA Project to "Console Application", the application will simply open an empty Console at start-up, without ever opening the actual game's window. This might be useful for what you are trying to accomplish, since you want to do tests, and you can very easily use the Console as a debug window.

share|improve this answer

You can also consider overriding the update and draw calls, and simply return.

Also, dont call the graphicsdevice in your main game classes, which should stop the xna window from being instanced on the game acting as your server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.