Members - Reputation: 835
Posted 07 September 2012 - 11:05 AM
Also, and I don't know if this is true of most US college educations or not, but we were not exposed to a lot of professional tools and their many helpful functions. Repositories, IDE's, revision control tools, not even build files. No project ever really replicated the environment and implications of working on software in teams as part of a much greater whole. And I don't really have to worry about much of this in the mainframe environment I currently work in. Between these facts and my very-heavily-K.I.S.S.-slanted mindset I have a lot of trouble quickly grasping and integrating concepts which I feel have probably become second nature to others as professionally old as I am.
So, I get programming. I'm not new to it, even before my degree. But I may not know about certain default library possibilities. And in truth I would appreciate dummy-level explainations of larger concepts.
Now let me ask questions and put some meat to the bones of my large introduction...
A coworker of mine and I are working on an XNA game. Our work is coming along slowly, as writing code for games isn't exactly the same as our professional tasks, as I'm sure many of you are aware. I recently downloaded JWalsh's XNA 4.0 version of the roleplaying starter kit to take a look at how things were done in there. There are lots of things that I don't understand about how/why things are done the way they are, but I only want to ask about a couple of them right now.
1) Why chose XML for the specific objects in the game, such as character classes or swords. Why not just make another class? (FYI, I have an irrational dislike of XML. But I am still going to ask the question and listen to the answer.)
2) I understood the point of the project and projectContent seperations. But what's the mindset behind the 4-piece breakdown: RPGContent, RPGDataWindows, RPGProcessors, and RPGWindows? A lot of the classes seem to exist in multiple places, but with different purposes. Why seperate those purposes?
Members - Reputation: 1054
Members - Reputation: 385
Posted 08 September 2012 - 12:48 PM
The DataWindows is the Windows version of the data structs & classes. This may be kept in a separate project so that it can be referenced by BOTH the processor and game projects.
The Processors are custom content processors. This is where the import logic for the items resides. The Game.ContentManager uses this logic to load the resources in the appropriate manner.
The Windows is the Windows version of the game logic.
I could very well be wrong though...
Crossbones+ - Reputation: 5200
Posted 14 October 2012 - 06:02 AM
If the only difference between the objects is the data, it makes sense to write that class just once, and initialize it with different data.
The class itself would take that data in the constructor, so you could just have an init function initializing all your items.
But it makes sense though to keep the data separate in a file, for easy tweaking without having to recompile the game.
The style is called data driven programming.
For example when concentrating on game design, its useful to just focus on the data.
With xml you can define any kind of data, its human readable, and it's easy to write a parser for, using any of the available xml libraries. No need to invent something of your own design.
Maybe the biggest gain is though when your team expands, and it might not even be the same person responsible for the code and the data.
Also, maybe your graphics guy wants to help tweak the game data too, he will likely feel much more comfortable changing a few values in a text file, and just relaunch the game, instead of having to install the build environment and fiddle around in source files.
Edited by Olof Hedman, 14 October 2012 - 06:30 AM.