UnitType class design

Dec 23, 2008 at 2:24 AM
I thought I'd branch out the UnitType class discussion since it is significant in itself.  I'm trying to tweak the design a bit more before modifying the existing game code to utilize it.

One of the remaining issues for the class is how to denote a unit type's movement class (i.e. static, towed, leg, tracked, etc).  I currently have an enum (see below) and the UnitType class has a member of that enum type.

    /// <summary>
    /// Contains all the movement types for ground units.
    /// </summary>
    public enum GroundMovementClass
        Static = 0, Towed, Leg, Truck, Wheeled, HalfTracked, Tracked

The problem I see is that the movement types are hard-coded vs. dynamically loaded at run-time, minimizing the ability to use the xnaPanzer engine for other realms, e.g. fantasy, space, etc.  I'll probably stick with the current structure for now since it's quick and easy but the issue did raise a red flag in my noggin.  

Anyone have suggestions on the subject?  Thanks.

Dec 26, 2008 at 10:10 PM
I was finally able to get the Xml Reader working for the UnitType class.  The XML for a sample UnitType is as follows:

<?xml version="1.0" encoding="utf-8" ?>
  <Asset Type="XmlContentShared.UnitType">
    <Name>Pz IIIJ</Name>

Dec 26, 2008 at 10:42 PM
Dec 30, 2008 at 12:29 AM
Rot roh, my attempt to tweak the project's structure in VS2008 has backfired: the run-time complains that the Maps\tacmaps_terrain_xnaPanzer.bmp file cannot be found.  It is looking for the path under C:\Shared\Projects\XNA\xnaPanzer\xnaPanzer\bin\x86\Debug\Content, which makes little sense to me.  I would think it should be looking for it under C:\Shared\Projects\XNA\xnaPanzer\xnaPanzer\Content, but obviously I am uneducated in the 'proper' XNA project structure.

In any case, I will likely have to wipe the xnaPanzer project (the primary project in the 3-project solution) and recreate it.  This will be an interesting exercise (albeit a time waster).


Dec 30, 2008 at 1:38 AM
Makes perfect sense now.  I am recreating the solution files and hope to commit them tomorrow night.

Dec 31, 2008 at 3:04 AM
I have rebuilt all 3 projects and all looks good except for three things: (1) compiler error: XML element "AirAttack" not found in UnitList.xml.  Obviously a wire is crossed because the UnitType class has the AirAttack value, not the Unit class; (2) I accidentally put the projects one level higher in the folder structure, i.e. there should be ..\xnaPanzer\xnaPanzer\.. but there isn't--causing Subversion not to like it--will have to correct; and (3) I have renamed and slightly restructured the projects, thus they no longer match the existing faulty projects--I'm hoping I can simply upload the new structures and ignore the old files/structure (doubt it).

I'll be glad when I'm back on track doing actual development instead of project maintenance (due to XNA ignorance).


Jan 5, 2009 at 2:18 AM
I have finally been able to re-create and commit the xnaPanzer solution (containing 3 projects).  All now works EXCEPT for one seemingly simple error: "XML element 'UnitType' not found in UnitList.xml file."  Not sure what is wrong.  Hopefully one of you gents can take a fresh look at it and immediately see the problem.  I'd be quite thankful!

Take care.


Jan 8, 2009 at 1:32 AM
I created a test Map class with xml reader/writer methods--works well, as expected (it displays the map name on the GUI).  This really makes me wonder what is wrong with the UnitList.xml file since it is not being accessed properly (for unknown reasons).  Anyway, I deleted the UnitList.xml file and will likely have to re-create the entire Unit schema (class, reader/writer, xml) from scratch (this time I will NOT copy from UnitType schema).