• Advertisement
Sign in to follow this  

Concept questions in XNA RPG starter kit

This topic is 1927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First, let me introduce myself and give some background. I got 2 Bachelor degrees, the second one Computer Science. Like probably pretty much everyone else in that era my education consisted of Java and a bit of C/C++. But, thanks to my age and my enjoyment of my one assembly class, a class 1 US railroad scooped me up right away for their maintenance/improvement department. So since Jan 2 2007, I have been working in an assembly macro language and occasional COBOL (an old one, don't know which.) A lot of the wisdom one would gain from working on real-world problems post-graduation, I have not gotten in the object-oriented languages. (But I know what's really going on in a list or for loop! wink.png ) Object-oriented languages make sense to me, I just lack familiarity with language specifics.
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?

Share this post


Link to post
Share on other sites
Advertisement
Question 1, generally people look down on hard coding each item as being a bad practise. Entirely soft coding everything (ie external scripts and XML files) is also bad practise. Got to strike a balance.

Question2 I have no idea.

Share this post


Link to post
Share on other sites
From what I can tell, the Content is just that - the content of the game.

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...

Share this post


Link to post
Share on other sites
Thanks 6677, Shadow.
I see what threw me off on #2. I read "windows" as 'panes', bounded areas on the screen...not the OS. Makes much more sense now.

Share this post


Link to post
Share on other sites
Not on XNA RPG starter kit, but in genaral.
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement