Content Management Differences from XNA 3 to XNA 4 - xna

In XNA 4, the Content structure seems much different than it was in 3 (there's the new Content project there by default with the project I created). I'm essentially just trying to understand what the purpose of the structural change was. Am I required to put all my content in the "content project?" Is it just supposed to help me be neater? Is this what people mean when they're talking about the "content pipeline?"
Thanks!

The XNA 4 content project is the project that will store all assets in the game (textures, sounds, etc)
The content pipeline, as MSDN describes, is "A set of processes applied when a game that includes art assets is built. The process starts with an art asset in its original form as a file, and continues to its transformation as data that can be retrieved and used within an XNA Game Studio game through the XNA Framework Class Library. "
Content can be loaded using a ContentManager. Here you can find the basics to using it.

Related

How to create and immediately be able to use spritefonts during runtime?

I'd like to know if it is possible to select a typeface, font size and be able to use it right away during runtime in an XNA application.
If it isn't possible using built-in runtime methods, maybe it's easier (or better, or faster) to do it using some automation software (like autoit) to create spritefont file in the background, and be able to use it afterwards in an XNA app without restarting the app?
I'm going to use this mainly on my own computer for testing and picking fonts, so I'm okay if it requires full VS installation along with XNA framework and any other stuff.
Easy put, it can be done, but you have to use WinForms, link to tutorial in order to load spritefonts. You could do it simpler, by making a couple of spritefonts before you do anything (or create spritefonts for every font you have and add them to the content). This is so, because of how XNA handles spritefonts. As you've seen, SpriteFonts are basically an xml file. This is not how the final binaries are. The final binaries are images containing every character in the font you selected at that size. That way, the gamer doesn't have to have the font installed in order to play your game, and therefore you can do some awesome stuff with fonts and the user can't use that font (unless he rips it).
I have not yet found a tutorial for winforms and spritefonts, but I suppose that the model version needs only a little modification for it to work with spritefonts.

XNA Content DLL

Where is the content DLL? When I try to build my game (using Primary Output from the Setup Wizard for both my game and content), it gives me this error:
Could not find file 'C:\Users\XXXX\Documents\XNA\PowerChampions\PowerChampions\PowerChampionsContent\obj\x86\Release\PowerChampionsContent.dll' 'The system cannot find the file specified.'
Anybody know how to solve that?
There is a list of things you need to check to solve this error. Let's start with cleaning and rebuilding the whole XNA solution, the one containing an XNA project and an XNA Content project (you have both in your project right?).

How to use an .xnb file in MonoGame on Windows 8?

I've got an .xnb file from a Windows Phone project made on Windows 7. I'd like to use the same asset in a Windows 8 Metro app. I've got MSVS 2012 RC on Windows 8 with a project from the MonoGameWindowsMetroApplication template. I put the .xnb file in the project Assets folder and tried to load it, but I get an exception telling me that the asset can't be loaded. What properties or configuration do I need to be able to use the .xnb file?
While MonoGame is working on the Content Pipeline piece of the framework, you can simply use the same Content Pipeline engine that you used for the Windows Phone 7 game to create a Content Pipeline and use the associated .xnb files in your Windows 8 XNA MonoGame project.
I have a blog tutorial series on building XNA games with MonoGame for Windows 8, and if you look at Part 3, I provide a step-by-stepy walkthrough of accomplishing this. My hands-on lab and information on my blog was reviewed and approved by the MonoGame team.
See info here: http://blogs.msdn.com/b/tarawalker/archive/2013/01/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame.aspx
The runtime Xna framework has many type reader objects that read the various xnb files. Some of the type readers are for xnb files that were processed from fbx models, others are xnb files processed from 2d image files, etc.
When you call content.Load<T>(xnb file name), The content manager uses the appropriate reader to read the byte information of the xnb file into the appropriate Xna class. The byte information in an xnb file is designed to be used in a specific Xna class, no other. There are no Xna classes in metro.
All this to say there are no type readers in the metro environment that read these xnb files. You would have to write your own. It's not that hard though, that's similar to what I did. I now process an fbx file into xnb by building an Xna project, then my xna project writes the runtime model's data to my own binary file, which I read from my metro app. But I could've simply read the xnb also. I just would have had to study the contentManager's & Model class' type readers to see how the byte info was distributed.
After all is said and done, it just means I don't have to learn the FBXSDK which would be the standard way (and arguably preferred way) of bringing in model info.
EDIT - sorry, didn't clue into the use of the mono framework. I don't know anything about that... Maybe they do have a way of importing xnb files.
Are you on the develop3D branch? I think you need to add a dummy Content project and add it to that project, not your assets, build that project first, then you need to reference that project in your MonoGame project.
I didn't succeed on that yesterday as I'm using the current stable but one of the MonoGame guys told me to do just that yesterday. Here are some instructions:
https://github.com/mono/MonoGame/wiki/MonoGame-Content-Processing
In MonoGame content pipeline is not present, at least as off now.
Its very easy.
1)Create a xna project in VS2010
2)add all your assets over there.
3)Rebuild your project. Go to bin/x86/debug/content and copy all contents from there
Now go to your VS2012 Mono Project bin/x86/debug look for content folder, if its there copy all content there else create a content folder and copy all content there.
Now without changing even single line of code just run your project and you will find everything working great!!!
Let me know if you find any difficulty doing that.

3ds Max 2010 / 2012 workspace files parsing

We are in the process of parsing out what 3ds Max files we need to keep as "source" for an Xna Game engine application.
Necessarily, there are .X (ActiveX model files) we need to keep of course. That I understand.
However, our 3D developer bailed on us and left us in a lurch. I am now tasked with the inglorious task of parsing which files to keep.
We've got a bunch of utilities, PDF documentation and other, what I would consider, "noise" files comingling the necessary stuff, like .X, .MAX, .VRMESH (I think?) or other such files.
Any pointers on what to watch out for taking an inventory what we've got, need to keep, could get rid of, or at least archive (which we have anyway)?
Thanks...
Michael
In 3ds Max there's a feature called Asset Tracking. It lets you see (and change) all the texture paths for the scene. Take the latest version of every 3ds Max scene, go through the asset list and copy each referenced texture to the desired folder. Note that it's possible to use relative paths here.
I'm sure next time you'll provide your artists with a directive on folder structure, source control and general organisation!.

Can we wrap individual 2D games developed in XNA in dll?

We have to develop 5-10 individual 2D game modules using XNA. Is it possible to wrap these individual games as dlls and use it on one console(Exe)? If yes, How we can read the user input(using input devices like Keypad, Mouse, Joystick) from dlls?
Need an input from XNA experts. I am new to XNA technology.
Thanks in advance.
I would say yes. .Net allows you to have one exe that references external dlls to load functionality. There are numerous libraries (MEF comes to mind) that builds on this fact to enable plugin architectures.
XNA games are primarily .Net assemblies. Therefore you should be able to make a "shell" exe that can be configured to load Game modules from selected external dlls.
What you should have in mind is how Content is handled. Since content files are stored separately from the binaries, so you will need a scheme for how content is "bundled" with your dll.
You should read up on the GameComponent mechanism, perhaps your game modules should be implemented as GameComponents.
Regarding input: you could handle input both in the shell or in the individual modules. Either way you need to define an interface between the two so that control can be delegated to the shell when needed, e.g. to navigate to some common Settings menu.

Resources