Jump to content
XCOMUFO & Xenocide

Research


Beetle

Recommended Posts

I’ve looked at the TechnologyManager class.  I believe the having multiple member functions “isTechnologyAvailable(string)”, “isItemAvailable(string)” etc. is overkill.  Really just need a single function (and underlying map).

 

 

Hi i made several list for easier list exporting, i get little to hurry and made to many of them :). Yes, making one map would be nice, but then we will have little more complicted list exporting. (for example facility list for base view, even now xnet is using isTechnologyavaible(String), but it was quick hack i wanted to made it also by list/map exporting :)

 

About if base X can research Y, it isn't so hard part :) just add few strings TechnologyProject with needed items, and after each reserch completed go thru all xml file in search of new avaible for reserch projects :)

Link to comment
Share on other sites

I think guyver was referring to production in workshops.  (As opposed to creating the C++ item objects)  My thought was that production projects are really very similar to research projects, so I'd do the research side, and then expand to cover production.    I think I talk more about it earlier in this thread.  I've just restarted research (I took a week off.) So will probably post my new thoughts on the topic later today or tomorrow.

This is a bit fluffy at the moment, but here’s my thinking, there’s a base “Project” class that represents a single project. Derived from it are the Research and Workshop projects. At the moment, the only major differences I see between them are:

1. Determine if a project can be started.

2. What to do if instances are created at multiple bases. (For research, it’s still the one project, for workshops, they’re different projects. Or maybe not.)

 

There will also probably need to be

1. A dialog class that interacts with user.

2. Some overall “collection” of projects. (Not sure if there will be separate ones for Research and Workshop or not.)

3. Class(s) for parsing the research file.

 

 

class Project
{
public:
   String         getName();
   virtual bool   canStart(Base& base); // can the project be started at this base?
   virtual void   debitStartupCosts(Base& base, Player& player);
   virtual bool   updateProgress(int timeSinceLastUpdate);  // returns true if project finished
   virtual void   rewardPlayer();

   // functions to assign resources to project
   void              addWorkers(vector<people>);
   void              removeWorkers(vector<people>);
   //... and simialr for Facilities & Bases

   // possibly we'd have additional functions to determine if resources can be used by project
   // I'm overloading use, if value = 0, if +ve, then could be used in updateProgress
   int  getValueToProject(people) { return people.canWorkIn(facilityTypeNeeded); };
   int  getValueToProject(facility);

   // player viewing project
   PercentDone?      getProgress();
   iterator<people>  getWorkers();
   //... etc.

private:
   // resources being used by project
   vector <People>           workers;
   vector <HumanFacilities>  facilities;
   vector <Bases>            bases;

   String   Name;
   ManHours progress;
   ManHours duration;
   String   facilityTypeNeeded;
};

class ProjectResearch : public Project
{
   virtual canStart(Base& base) { return startConditions.canStart(base); };

private:
   CanStartExpression   startConditions;
};

class ProjectWorkshop : public Project
{
   virtual canStart(Base& base) { return ProjectManager::researchedTopics.find(this->name); };


};

Link to comment
Share on other sites

I’ve looked at the TechnologyManager class.  I believe the having multiple member functions “isTechnologyAvailable(string)”, “isItemAvailable(string)” etc. is overkill.  Really just need a single function (and underlying map).

 

 

Hi i made several list for easier list exporting, i get little to hurry and made to many of them :). Yes, making one map would be nice, but then we will have little more complicted list exporting. (for example facility list for base view, even now xnet is using isTechnologyavaible(String), but it was quick hack i wanted to made it also by list/map exporting :)

 

Firstly, I'd suspect that exporting a list of available technologies is probably not going to be very useful. As you point out, in XNET it walks the XML, and then checks if each item is displayable or not. Which I think is going to be the case in nearly all situations. E.g. for equipping troops, I need to iterate through all the equipment in the base, and select the items that troops can currently use. The base view is a bit of a special case, because the “facility selection” dialog currently just gives the names of the facilities. However, if it was to also show the cost of each facility and the time to build (which I think it should) then having a list of “researched” facility types is much less useful. You’re going to want to iterate through the list of all facilities, and prune out the ones that aren’t researched yet.

 

For the case of exporting lists, try this.

class TechnologyManager
{
public:

   enum TechTypes
   {
       techFacility,
       techItem,
       techXnet
   };

   bool isTechnologyAvailable(const String &technology)
   {
       return techs.find(String) != techs.end();
   }

   vector<String>  getAvailableTechs(TechTypes const&  type)
   {
       vector<String> retVal;
       TTechsMap::iterator i = techs.begin();
       while (i != techs.end())
       {
           if (type == i->second)
           {
               retVal.push_back(i->first);
           }
 ++i;              
       }
       return retVal;
   }


private:
   typedef TMap<String, TechTypes>   TTechsMap;

   TTechsMap  techs;
};

 

 

About if base X can research Y, it isn't so hard part :) just add few strings TechnologyProject with needed items, and after each reserch completed go thru all xml file in search of new avaible for reserch projects :)

You misunderstand, what I was saying was that PARSING the file research.xml is the tricky bit. My current idea is that for each research topic in research.xml I build up an expression of the form

if (((itemIsInBase(base, item1)  || itemIsInBase(base, item2))  && technologyIsKnown(tech))

Then I evaluate the expression. If the expression evaluates to true, then I can start the project. If it evaluates to false, then I can’t. The tricky bit is parsing research.xml to build up the expression. As an aside, I believe I can use the code in Chapter 8 of “Ruminations on C++” by Andrew Koenig (yes, the one that invented Koenig lookup) to do most of the work.

 

Guyver has suggested an alternate approach, which if I understand correctly can be summarized as parsing research.xml file and building a single tree, then evaluate the tree to get a list of the researchable topics. However, as the bulk of the work appears to be parsing research.xml, I’m unconvinced that this is the better approach.

Link to comment
Share on other sites

Guyver has suggested an alternate approach, which if I understand correctly can be summarized as parsing research.xml file and building a single tree, then evaluate the tree to get a list of the researchable topics. However, as the bulk of the work appears to be parsing research.xml, I’m unconvinced that this is the better approach.

 

Do you mean you want to read the xml each time? Aside from performance issues, it is always easier to work with something in memory. You don't have to worry very much about optimizing, since you can afford to read item hundred times... And it is more flexible. I mean is evaluating the tree once is all that will have to be done with it?

Link to comment
Share on other sites

IMHO the best way to handle the prerequisites is to create a graph in memory and create prerequisites objects that would evaluate depending which type of prerequisite it is ;) (polymorphism anyone? :) ). From the Xml you just need to create that representation.

 

Greetings

Red Knight

Link to comment
Share on other sites

You misunderstand, what I was saying was that PARSING the file research.xml is the tricky bit.  My current idea is that for each research topic in research.xml I build up an expression of the form

if (((itemIsInBase(base, item1)  || itemIsInBase(base, item2))  && technologyIsKnown(tech))

Then I evaluate the expression.  If the expression evaluates to true, then I can start the project.  If it evaluates to false, then I can’t.  The tricky bit is parsing research.xml to build up the expression.  As an aside, I believe I can use the code in Chapter 8 of “Ruminations on C++” by Andrew Koenig (yes, the one that invented Koenig lookup) to do most of the work.

 

Guyver has suggested an alternate approach, which if I understand correctly can be summarized as parsing research.xml file and building a single tree, then evaluate the tree to get a list of the researchable topics.  However, as the bulk of the work appears to be parsing research.xml, I’m unconvinced that this is the better approach.

How about Python? You can generate Python source code easily basing on what's in XML, compile it to bytecode and store that pre-compiled bytecode as an boost::python::object which you can evaluate when needed.

Link to comment
Share on other sites

I would also go for putting it into a runtime memory structure. some form of directed graph would probably do it. For each thing that you can get, you have a node with edges to all nodes that are prerequisites. For and/or stuff you would have to add another level of nodes. Then you just walk those prerequisites nodes and check if they are available.

The isAvailable could then be a virtual-function that depending on the type of prerequisites checks if it's researched, if it is in storage, etc.

 

Problem is definitly in parsing the xml into that structure. But that stays the same whether you go with the python-conversion or the runtime-structure.

 

Rincewind

Edited by rincewind
Link to comment
Share on other sites

How about Python? You can generate Python source code easily basing on what's in XML, compile it to bytecode and store that pre-compiled bytecode as an boost::python::object which you can evaluate when needed.

 

Do you mean to compile the python source and then store the bytecode inside a C array which is then constructed into an py::object? Why not just keep the python source as it is, somewhere under data/scripts and execute it normally (using boost.python methods like py::call)?

 

And my vote goes for parsing xml into runtime structure. I don't see any point with parsing the xml over every time when somebody wants to know if something can be researched.

 

- Garo

Edited by Garo
Link to comment
Share on other sites

How about Python? You can generate Python source code easily basing on what's in XML, compile it to bytecode and store that pre-compiled bytecode as an boost::python::object which you can evaluate when needed.

 

Do you mean to compile the python source and then store the bytecode inside a C array which is then constructed into an py::object? Why not just keep the python source as it is, somewhere under data/scripts and execute it normally (using boost.python methods like py::call)?

 

And my vote goes for parsing xml into runtime structure. I don't see any point with parsing the xml over every time when somebody wants to know if something can be researched.

 

- Garo

First: dteviot doesn't mean to parse XML every time. He means to parse it once and for each project encountered create an expression (basing on what are prerequisites) that will evaluate if a project can be started. This means that after constructing all expressions from XML source (ONCE!!!), they can be evaluated to see if project can be started. So, once again, XML is going to be parsed ONCE!

 

So, that I made it clear to you (hope so ;) ), what I propose is to generate python code from project's restrictions in XML (without Koenig stuff :) ) and on demand evaluate it. Further more, maybe just allow to inline python code in XML file, so projects can test for their availability in any way they want?

 

Anyway, to make it clear what I mean:

1. XML file is being parsed

2. A project RES_NEURAL_SHIELDING_FACILITY is encountered in file (see below for that entry)

3. Parsing produces the following python code:

def check_RES_NEURAL_SHIELDING_FACILITY():
   if check_xnet("XNET_PSIONIC_AMPLIFIER"):
       if check_combatant("LIVE_GREY_COMMANDER"):
           return True
       if check_combatant("LIVE_CLOAK_LEADER"):
           return True
       if check_combatant("LIVE_CLOAK_COMMANDER"):
           return True
   return False

def grant_RES_NEURAL_SHIELDING_FACILITY():
   grant_xnet("XNET_NEURAL_SHIELDING_FACILITY")
   grant_facility("FAC_NEURAL_SHIELDING_FACILITY")

4. Compiling generated code and adding it to "research" module for use in scripts.

5. Compile generated functions (the stuff after def) into two separate code objects that can be evaluated fast returning True or False python objects in the first case and granting technologies after research is complete.

6. Continue with next entry.

 

For your convinience, here's the sample entry:

	<topic name="RES_NEURAL_SHIELDING_FACILITY">

 <research>
	 <time>1234</time>
 </research>
 
 <prerequisite>
	 <reference xnetid="XNET_PSIONIC_AMPLIFIER" />
   <AnyOneOf>
  	 <reference combatantid="LIVE_GREY_COMMANDER" />
  	 <reference combatantid="LIVE_CLOAK_LEADER" />
  	 <reference combatantid="LIVE_CLOAK_COMMANDER" />
   </AnyOneOf>
 </prerequisite>
 <grants>
	 <reference xnetid="XNET_NEURAL_SHIELDING_FACILITY" />
	 <reference facilityid="FAC_NEURAL_SHIELDING_FACILITY" />
 </grants>    
</topic>

 

That's only an example of how to do that with python easily. I don't know how research.xml will look like finally so it's hard to tell if this solution is right, nevertheless it's easy yet powerful.

Link to comment
Share on other sites

Anyway, to make it clear what I mean:

1. XML file is being parsed

2. A project RES_NEURAL_SHIELDING_FACILITY is encountered in file (see below for that entry)

3. Parsing produces the following python code:

def check_RES_NEURAL_SHIELDING_FACILITY():
   if check_xnet("XNET_PSIONIC_AMPLIFIER"):
       if check_combatant("LIVE_GREY_COMMANDER"):
           return True
       if check_combatant("LIVE_CLOAK_LEADER"):
           return True
       if check_combatant("LIVE_CLOAK_COMMANDER"):
           return True
   return False

def grant_RES_NEURAL_SHIELDING_FACILITY():
   grant_xnet("XNET_NEURAL_SHIELDING_FACILITY")
   grant_facility("FAC_NEURAL_SHIELDING_FACILITY")

Yes, that's percisely what I intended, except I'm using C++ instead of python. And as I also said, it looks to me that parsing the XML to create the expression to evaluate is the tricky bit. I was thinking of using a recursive descent parser for this, but I wondered if anyone had any other solutions. (One I'm contemplating at the moment is a revised XML that is flat, so no need for recursion.)

Link to comment
Share on other sites

Azreal, I’ve got a couple more questions for you about research.xml.

 

Firstly,

<topic name="RES_THANATOS_OPERATION_XENOCIDE">
<research>
 <time>1234</time>
</research>
<prerequisite>
 <xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
 <AnyOneOf>
	 <combatantref name="LIVE_SATYRIAN_COMMANDER_INTERROGATION"/>
	 <combatantref name="LIVE_GREY_COMMANDER_INTERROGATION"/>
	 <combatantref name="LIVE_VIPER_COMMANDER_INTERROGATION"/>
	 <combatantref name="LIVE_CLOAK_COMMANDER_INTERROGATION"/>
 </AnyOneOf>
</prerequisite>
 
<grants>
 <xnetref name="XNET_THANATOS:_OPERATION_XENOCIDE"/>
</grants>
</topic>

 

Interrogations can’t be combatants. So I think what you’re trying to say here is, operation thanatos can’t be started until you interrogate a commander. (Interrogating any grey, satyrian, viper or cloak commander will give you the same thing XNET_ALIEN_BASE.) Therefore, this should be

 

<topic name="RES_THANATOS_OPERATION_XENOCIDE">
<research>
 <time>1234</time>
</research>
<prerequisite>
 <xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
 <xnetref name="XNET_ALIEN_BASE"/>
</prerequisite>
 
<grants>
 <xnetref name="XNET_THANATOS:_OPERATION_XENOCIDE"/>
</grants>
</topic>

 

However, I’m wonder why you have 4 “RES__COMMANDER_INTERROGATION” research topics. It could be a single one:

<topic name="RES_COMMANDER_INTERROGATION">
<research>
 <time>1234</time>
</research>
<prerequisite>
 <combatantref name="ITEM_GREY" rank="RANK_COMMANDER" />
 <combatantref name="ITEM_VIPER" rank="RANK_COMMANDER" />
 <combatantref name="ITEM_CLOAK" rank="RANK_COMMANDER" />
 <combatantref name="ITEM_SATYRIAN" rank="RANK_COMMANDER" />
</prerequisite>  
<grants>
 <xnetref name="XNET_ALIEN_BASE"/>
</grants>
</topic>

 

In fact, from what I can see, every rank based interrogation will gives the same “grants”, regardless of the alien species.

 

Also, I notice that interrogating any leader will only give “XNET_ALIEN_INFILTRATION”, which can also be obtained from interrogating navigators. I assume this is a mistake, and alien infiltration should ONLY come from interrogating a leader?

 

Finally, the research topic “Paradigm shift: offensive operations” is also using

prerequisites. So my question is, should this in fact key off XNET_ALIEN_INFILTRATION?

Link to comment
Share on other sites

Yes, that's percisely what I intended, except I'm using C++ instead of python.  And as I also said, it looks to me that parsing the XML to create the expression to evaluate is the tricky bit.  I was thinking of using a recursive descent parser for this, but I wondered if anyone had any other solutions.  (One I'm contemplating at the moment is a revised XML that is flat, so no need for recursion.)

Python is fully integrated by now, what's the reason to create parser in C++ to create C++ expressions when there's simple python solution? Or flattening XML file... I wonder how Azrael will react if you ask him to redo it all with new schema :). Anyway creating parser and the whole hassle related to building C++ expressions sounds to me like killing a fly with a nuke (like Garo said some time on IRC ;) ). DOM actually gives you a tree-like hierarchy so it only needs to be transfered to something like I shown above (using python) or into a multi-layer graph like rincewind suggested. Remember: KISS :)

 

EDIT: btw, if you really want to shoot flies with BFG then go on, if you think it'll work the best. I trust you'll do the job after what I've seen in items code (awesome job), but I'm trying to save your time.

Edited by guyver6
Link to comment
Share on other sites

Azreal,  I’ve got a couple more questions for you about research.xml.

 

Firstly,

<topic name="RES_THANATOS_OPERATION_XENOCIDE">
<research>
 <time>1234</time>
</research>
<prerequisite>
 <xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
 <AnyOneOf>
	 <combatantref name="LIVE_SATYRIAN_COMMANDER_INTERROGATION"/>
	 <combatantref name="LIVE_GREY_COMMANDER_INTERROGATION"/>
	 <combatantref name="LIVE_VIPER_COMMANDER_INTERROGATION"/>
	 <combatantref name="LIVE_CLOAK_COMMANDER_INTERROGATION"/>
 </AnyOneOf>
</prerequisite>
 
<grants>
 <xnetref name="XNET_THANATOS:_OPERATION_XENOCIDE"/>
</grants>
</topic>

Odd, I don't remember making it that way... I guess I left it like that after the changes in the xsd and after adding the interrogations.

 

Interrogations can’t be combatants.  So I think what you’re trying to say here is, operation thanatos can’t be started until you interrogate a commander.  (Interrogating any grey, satyrian, viper or cloak commander will give you the same thing XNET_ALIEN_BASE.)  Therefore, this should be

 

<topic name="RES_THANATOS_OPERATION_XENOCIDE">
<research>
 <time>1234</time>
</research>
<prerequisite>
 <xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
 <xnetref name="XNET_ALIEN_BASE"/>
</prerequisite>
 
<grants>
 <xnetref name="XNET_THANATOS:_OPERATION_XENOCIDE"/>
</grants>
</topic>

No good, since you can get Alien Base from an Alien Navigator, I think the prerequisite should be:

	<prerequisite>
 <xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
 <xnetref name="RES_[ALIEN]_COMMANDER_INTERROGATION"/>
</prerequisite>

But I'm not sure.

However, I’m wonder why  you have 4 “RES_<alien>_COMMANDER_INTERROGATION” research topics.  It could be a single one:

<topic name="RES_COMMANDER_INTERROGATION">
<research>
 <time>1234</time>
</research>
<prerequisite>
 <combatantref name="ITEM_GREY" rank="RANK_COMMANDER" />
 <combatantref name="ITEM_VIPER" rank="RANK_COMMANDER" />
 <combatantref name="ITEM_CLOAK" rank="RANK_COMMANDER" />
 <combatantref name="ITEM_SATYRIAN" rank="RANK_COMMANDER" />
</prerequisite>  
<grants>
 <xnetref name="XNET_ALIEN_BASE"/>
</grants>
</topic>

Well, that is because there are four different species, and the "rank" thing wasn't available (or no one told me) when I wrote it.

 

In fact, from what I can see, every rank based interrogation will gives the same “grants”, regardless of the alien species.

Yep, but rank wasn't available when I did it, so I had to treat each different alien as a separate topic :)

 

Also, I notice that interrogating any leader will only give “XNET_ALIEN_INFILTRATION”, which can also be obtained from interrogating navigators.  I assume this is a mistake, and alien infiltration should ONLY come from interrogating a leader?

I put that as an alternative way of obtaining Mission entries :) to allow the player to get this entry if he captures another Leader.

Finally, the research topic “Paradigm shift: offensive operations” is also using

<combatantref name="LIVE_SATYRIAN_LEADER_INTERROGATION"/>

prerequisites. So my question is, should this in fact key off  XNET_ALIEN_INFILTRATION?

Same problem as above, Alien Navigators give you Alien Infiltration.

Link to comment
Share on other sites

No good, since you can get Alien Base from an Alien Navigator, I think the prerequisite should be:

 

<prerequisite>
<xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
<xnetref name="RES_[ALIEN]_COMMANDER_INTERROGATION"/>
</prerequisite>

But I'm not sure.

 

Actually, you only get Alien Base from interrogating a commander.

Also, RES_COMMANDER_INTERROGATION is a research topic, not an xnet entry, Which means that there IS a need for a prerequisite condition test of the type isResearched(topic)

 

e.g.

<prerequisite>
<xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
<researchref name="RES_COMMANDER_INTERROGATION"/>
</prerequisite>

 

Please confirm you’re happy if I consolidate the rank interrogations. That is, replace the

RES_SATYRIAN_COMMANDER_INTERROGATION, RES_GREY_COMMANDER_INTERROGATION, RES_VIPER_COMMANDER_INTERROGATION & RES_CLOAK_COMMANDER_INTERROGATION with a single RES_ COMMANDER_INTERROGATION, and do the same thing for the SOLDIER, MEDIC, TERRORIST, ENGINEER and LEADER interrogations.

 

Aside, it looks like we’re going to need the following prerequisite check functions

Note that as well as the prerequisite element of a research entry, there’s also the cost element and the facility required attribute. (None of them look particularly hard to implement.)

 

isItemTypeInBase(base, item)

isAlienTypeInBase(base, alienType, alienRank)

isXnetEntryKnown(entry)

isTechResearched(tech)

playerHasSufficientFunds(amount)

doesBaseHaveFacility(base, facility)

Link to comment
Share on other sites

No good, since you can get Alien Base from an Alien Navigator, I think the prerequisite should be:

 

<prerequisite>
<xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
<xnetref name="RES_[ALIEN]_COMMANDER_INTERROGATION"/>
</prerequisite>

But I'm not sure.

 

Actually, you only get Alien Base from interrogating a commander.

Also, RES_COMMANDER_INTERROGATION is a research topic, not an xnet entry, Which means that there IS a need for a prerequisite condition test of the type isResearched(topic)

 

e.g.

<prerequisite>
<xnetref name="XNET_PARADIGM_SHIFT:_OFFENSIVE_OPERATIONS"/>
<researchref name="RES_COMMANDER_INTERROGATION"/>
</prerequisite>

Sorry, research, not xnet :( fingers slipped.

Then that was my bad, Alien Base can also be obtained from Navigators as technically is a type of mission :)

 

Please confirm you’re happy if I consolidate the rank interrogations.  That is, replace the

RES_SATYRIAN_COMMANDER_INTERROGATION, RES_GREY_COMMANDER_INTERROGATION, RES_VIPER_COMMANDER_INTERROGATION & RES_CLOAK_COMMANDER_INTERROGATION with a single RES_ COMMANDER_INTERROGATION, and do the same thing for the SOLDIER, MEDIC, TERRORIST, ENGINEER and LEADER interrogations.

You're the programmer, you know what's needed better than me B) that sounds good :)

 

Aside, it looks like we’re going to need the following prerequisite check functions

Note that as well as the prerequisite element of a research entry, there’s also the cost element and the facility required attribute.  (None of them look particularly hard to implement.)

 

isItemTypeInBase(base, item)

isAlienTypeInBase(base, alienType, alienRank)

isXnetEntryKnown(entry)

isTechResearched(tech)

playerHasSufficientFunds(amount)

doesBaseHaveFacility(base, facility)

That looks very good, except for "playerHasSufficientFunds", not sure any research would have that as prerequisite?

Link to comment
Share on other sites

Hi Azrael,

 

I've updated research.xml as discussed in the thread.

I've also changed basic.xsd to make sure that item, facility and xnet entries given in research.xml actually exist. (And haven't been incorrectly named.)

(And because I changed basic.xsd, I had to make some tweaks to item.xsd & combatants.xsd as well. (Note, the combatants.xml now fails validation, due to it referring to items that don't exist, and I'm not prepared to try fixing it at this point in time.)

 

Please check that you're happy with the revised research.xml, and I'll check my work in.

 

(I would have sent this as a PM, but for some reason I don't have the option to add attachments to PMs.)

 

And the plasma rifle and heavy plasma rifle cost 2000 to research.

research.zip

Link to comment
Share on other sites

Hi Azrael,

 

I've updated research.xml as discussed in the thread.

I've also changed basic.xsd to make sure that item, facility and xnet entries given in research.xml actually exist.  (And haven't been incorrectly named.)

(And because I changed basic.xsd, I had to make some tweaks to item.xsd & combatants.xsd as well.  (Note, the combatants.xml now fails validation, due to it referring to items that don't exist, and I'm not prepared to try fixing it at this point in time.)

 

Please check that you're happy with the revised research.xml, and I'll check my work in.

 

(I would have sent this as a PM, but for some reason I don't have the option to add attachments to PMs.)

 

And the plasma rifle and heavy plasma rifle cost 2000 to research.

So far looks very good, though since I'm no programmer I'm probably not the one to ask :) You used "rank" to specify whether a creature is alive or dead too, right?

I say check it :) nice work.

Link to comment
Share on other sites

Hi Azrael,

 

I've updated research.xml as discussed in the thread.

I've also changed basic.xsd to make sure that item, facility and xnet entries given in research.xml actually exist.  (And haven't been incorrectly named.)

(And because I changed basic.xsd, I had to make some tweaks to item.xsd & combatants.xsd as well.  (Note, the combatants.xml now fails validation, due to it referring to items that don't exist, and I'm not prepared to try fixing it at this point in time.)

 

Please check that you're happy with the revised research.xml, and I'll check my work in.

 

(I would have sent this as a PM, but for some reason I don't have the option to add attachments to PMs.)

 

And the plasma rifle and heavy plasma rifle cost 2000 to research.

So far looks very good, though since I'm no programmer I'm probably not the one to ask :) You used "rank" to specify whether a creature is alive or dead too, right?

I say check it :) nice work.

Changes checked in.

Bonus, I've also added the prerequisite parser/evaluator code. Enjoy.

Link to comment
Share on other sites

Hi Azrael,

 

I've updated research.xml as discussed in the thread.

I've also changed basic.xsd to make sure that item, facility and xnet entries given in research.xml actually exist.  (And haven't been incorrectly named.)

(And because I changed basic.xsd, I had to make some tweaks to item.xsd & combatants.xsd as well.  (Note, the combatants.xml now fails validation, due to it referring to items that don't exist, and I'm not prepared to try fixing it at this point in time.)

 

Please check that you're happy with the revised research.xml, and I'll check my work in.

 

(I would have sent this as a PM, but for some reason I don't have the option to add attachments to PMs.)

 

And the plasma rifle and heavy plasma rifle cost 2000 to research.

So far looks very good, though since I'm no programmer I'm probably not the one to ask :) You used "rank" to specify whether a creature is alive or dead too, right?

I say check it :) nice work.

Yes, I'm regarding "DEAD" as a rank.

 

Thanks for checking my work. On reflection, I should have been clearer in what I was asking for when I asked you to check the updated research.xml.

I didn’t mean for you to do verify the XML & XSD, rather I wanted you to check that the new research.xml modelled the research tree. That is,

Collapsing the multiple navigator research projects (one per alien race) into a single project was valid. And that the prerequisites for the projects still match the tree. (For example, Navigators still don’t have “alien base” as a possible entry.

 

That said, I’m making more schema changes to, again, make the XML easier to parse. Specifically

1. The

2. The element gains a “quantity” attribute with possible values “OneOf" and “AllOf”

 

e.g.

	<topic name="RES_TERRORIST_INTERROGATION">
 <research>
	 <time>1234</time>
 </research>
 
 <prerequisite>
	 <AnyOneOf>
      <combatantref name="ITEM_SPAWN" rank="RANK_TERRORIST" />
    	 <combatantref name="ITEM_RAPTOR" rank="RANK_TERRORIST" />
	 </AnyOneOf>
 </prerequisite>  
 
 <grants>
	 <AnyOneOf>
   <xnetref name="XNET_ALIEN_TERROR"/>
	 </AnyOneOf>
 </grants>
</topic>
<topic name="RES_XCAP-AG_PLASMA">

 <research>
	 <time>0</time>
 </research>
 
 <prerequisite>
	 <xnetref name="XNET_PLASMA_CANNON" />
	 <xnetref name="XNET_XC-2_STARFIRE" />
 </prerequisite>
 <grants>
	 <xnetref name="XNET_XCAP-AG,_PLASMA" />
	 <xnetref name="XNET_XCAP-AG_CHASSIS" />
	 <itemref name="ITEM_XCAP-AG_PLASMA" />
 </grants>
</topic>

 

become

<!--Alien Terrorist Interrogation-->
<topic name="RES_TERRORIST_INTERROGATION" time="1234">

 <prerequisite>
	 <AnyOneOf>
      <combatantref name="ITEM_SPAWN" rank="RANK_TERRORIST" />
    	 <combatantref name="ITEM_RAPTOR" rank="RANK_TERRORIST" />
	 </AnyOneOf>
 </prerequisite>  
 
 <grants quantity="OneOf">
	 <xnetref name="XNET_ALIEN_TERROR"/>
 </grants>
</topic>

<!-- XCAP-AG, Plasma -->
<topic name="RES_XCAP-AG_PLASMA" time="0">
 
 <prerequisite>
	 <xnetref name="XNET_PLASMA_CANNON" />
	 <xnetref name="XNET_XC-2_STARFIRE" />
 </prerequisite>
 <grants quantity="AllOf">
	 <xnetref name="XNET_XCAP-AG,_PLASMA" />
	 <xnetref name="XNET_XCAP-AG_CHASSIS" />
	 <itemref name="ITEM_XCAP-AG_PLASMA" />
 </grants>
</topic>

 

I’ve attached the updated research.xsd to validate the new schema (just remove the .txt extension that’s there to bypass the restriction on file types that can be uploaded to the forum.)

 

Do you think you can get a volunteer or two from the CTD to update research.xml to the new schema? (And while they’re at it, they might like to replace the “1234” times with more appropriate values? Obtained from, say, Stewart’s spreadsheet or the UFOpedia?)

Oh yes, units for time, I recommend man-hours.

research.xsd.txt

Link to comment
Share on other sites

Hi Azrael,

 

I've updated research.xml as discussed in the thread.

I've also changed basic.xsd to make sure that item, facility and xnet entries given in research.xml actually exist.  (And haven't been incorrectly named.)

(And because I changed basic.xsd, I had to make some tweaks to item.xsd & combatants.xsd as well.  (Note, the combatants.xml now fails validation, due to it referring to items that don't exist, and I'm not prepared to try fixing it at this point in time.)

 

Please check that you're happy with the revised research.xml, and I'll check my work in.

 

(I would have sent this as a PM, but for some reason I don't have the option to add attachments to PMs.)

 

And the plasma rifle and heavy plasma rifle cost 2000 to research.

So far looks very good, though since I'm no programmer I'm probably not the one to ask :) You used "rank" to specify whether a creature is alive or dead too, right?

I say check it :) nice work.

Yes, I'm regarding "DEAD" as a rank.

 

Thanks for checking my work. On reflection, I should have been clearer in what I was asking for when I asked you to check the updated research.xml.

I didn’t mean for you to do verify the XML & XSD, rather I wanted you to check that the new research.xml modelled the research tree. That is,

Collapsing the multiple navigator research projects (one per alien race) into a single project was valid. And that the prerequisites for the projects still match the tree. (For example, Navigators still don’t have “alien base” as a possible <grants> entry.

 

That said, I’m making more schema changes to, again, make the XML easier to parse. Specifically

1. The <time> element will be an attribute of the <topic> element,

2. The <grants> element gains a “quantity” attribute with possible values “OneOf" and “AllOf”

 

e.g.

	<topic name="RES_TERRORIST_INTERROGATION">
 <research>
	 <time>1234</time>
 </research>
 
 <prerequisite>
	 <AnyOneOf>
      <combatantref name="ITEM_SPAWN" rank="RANK_TERRORIST" />
    	 <combatantref name="ITEM_RAPTOR" rank="RANK_TERRORIST" />
	 </AnyOneOf>
 </prerequisite>  
 
 <grants>
	 <AnyOneOf>
   <xnetref name="XNET_ALIEN_TERROR"/>
	 </AnyOneOf>
 </grants>
</topic>
<topic name="RES_XCAP-AG_PLASMA">

 <research>
	 <time>0</time>
 </research>
 
 <prerequisite>
	 <xnetref name="XNET_PLASMA_CANNON" />
	 <xnetref name="XNET_XC-2_STARFIRE" />
 </prerequisite>
 <grants>
	 <xnetref name="XNET_XCAP-AG,_PLASMA" />
	 <xnetref name="XNET_XCAP-AG_CHASSIS" />
	 <itemref name="ITEM_XCAP-AG_PLASMA" />
 </grants>
</topic>

 

become

<!--Alien Terrorist Interrogation-->
<topic name="RES_TERRORIST_INTERROGATION" time="1234">

 <prerequisite>
	 <AnyOneOf>
      <combatantref name="ITEM_SPAWN" rank="RANK_TERRORIST" />
    	 <combatantref name="ITEM_RAPTOR" rank="RANK_TERRORIST" />
	 </AnyOneOf>
 </prerequisite>  
 
 <grants quantity="OneOf">
	 <xnetref name="XNET_ALIEN_TERROR"/>
 </grants>
</topic>

<!-- XCAP-AG, Plasma -->
<topic name="RES_XCAP-AG_PLASMA" time="0">
 
 <prerequisite>
	 <xnetref name="XNET_PLASMA_CANNON" />
	 <xnetref name="XNET_XC-2_STARFIRE" />
 </prerequisite>
 <grants quantity="AllOf">
	 <xnetref name="XNET_XCAP-AG,_PLASMA" />
	 <xnetref name="XNET_XCAP-AG_CHASSIS" />
	 <itemref name="ITEM_XCAP-AG_PLASMA" />
 </grants>
</topic>

 

I’ve attached the updated research.xsd to validate the new schema (just remove the .txt extension that’s there to bypass the restriction on file types that can be uploaded to the forum.)

 

Do you think you can get a volunteer or two from the CTD to update research.xml to the new schema? (And while they’re at it, they might like to replace the “1234” times with more appropriate values? Obtained from, say, Stewart’s spreadsheet or the UFOpedia?)

Oh yes, units for time, I recommend man-hours.

I'll do it tonight, will check research.xml again while I'm at it, I'll try to find Stewart's sheet.

Link to comment
Share on other sites

I notice Alien Infiltrations is named "Alien Infiltration", it's a minor thing, but I now wonder how do I correct the name? if I change it in research.xml, it fails validation, where are the names stored in?

 

Heh, the xml contained a large number of mistakes, fixed them all (I hope), and added an entry which was missing (Gravity Shield), I think I missed it the first time I wrote it, now I need to add the name for it in order for the file not to fail validation.

 

EDIT: Got it, now I just need to find research times in man-hours, wherever they are...

Edited by Azrael
Link to comment
Share on other sites

Alright, I've commited the changes (also fixed a problem in english.xml).

Note, I got the info from XCOMUTIL about research times, however, I don't know what they are exactly, I believe it's the amount of days per 50 scientists... I think, I dunno, whatever they are those are the numbers the game uses, with a possible exception:

- I dunno the days to research interrogations or live alien studies, as they are nowhere to be found, so I used the same used in the autopsies (180).

 

If you're working on research, you can get some ideas about how it worked in X-Com from here.

 

Also, I got an idea while looking over XCOMUTIL cfg file, how about having captured Aliens giving you research boosts? for example, it takes 600 days (or whatever they are) to research plasma pistol, having a captured Alien Soldier would reduce it by xx amount, as having an alien to interrogate should make things easier.

I think that it was that way in X-Com, from what I gathered from XCOMUTIL.cfg, from this table:

// Research Help from Captives
//   Day = Scientist/Days to complete research (unsigned short)
//   Mul = Difficulty multiplier x 10 ( max = 255 = 25.5 times normal )
//  Rank = % reduction of remaining research time

XCOM
ResearchHelp

// Day Mul Cmd Ldr Eng Med Nav Sol 

   50  10   0   0   0   0   0   0 //  0 Laser Weapons
  180  50   0   0  50   0  50   0 //  1 Motion Scanner
  210 100   0   0   0  80   0   0 //  2 Medi-kit
  500 100  50  25   0  80   0   0 //  3 Psi-Amp

  800 100  20  20  50   0  20  10 //  4 Heavy Plasma
  400 100  20  20  50   0  20  40 //  5 Heavy Plasma Clip
  700 100  20  20  50   0  20  10 //  6 Plasma Rifle
  400 100  20  20  50   0  20  40 //  7 Plasma Rifle Clip
  600 100  20  20  50   0  20  10 //  8 Plasma Pistol
  400 100  20  20  50   0  20  40 //  9 Plasma Pistol Clip
  900 100  80  60  70   0   0   0 // 10 Blaster Launcher
  300 100  25  20  70   0   0   0 // 11 Blaster Bomb
  550 100  20  20  20  80   0   0 // 12 Small Launcher
  180 100  20  20  20  80   0   0 // 13 Stun Bomb
  200 100   0   0  50   0   0  50 // 14 Alien Grenade
  450 100  25  20  50   0   0   0 // 15 Elerium-115
  600 100   0   0   0  80   0   0 // 16 Mind Probe

  450 100   0   0  50   0  25   0 // 17 UFO Propulsion
  450 100   0   0   0   0  80   0 // 18 UFO Navigation
  450 100   0   0  50   0  25   0 // 19 UFO Construction
  150 100   0   0   0  80   0   0 // 20 Alien Food
  150 100   0   0   0  50   0   0 // 21 Reproduction Chamber
  150 100   0   0   0   0  50  50 // 22 Alien Entertainment
  150 100   0   0   0  80   0   0 // 23 Alien Surgery
  150 100  80  80   0  80   0   0 // 24 Alien Abduction
  400 100  25  20  50   0  40   0 // 25 Alien Alloys

  600 100  20  10  30   0  20   0 // 26 Firestorm
  700 100  20  10  30   0  20   0 // 27 Lightning
  900 100  20  10  30   0  20   0 // 28 Avenger

  100  10   0   0   0   0   0   0 // 29 Laser Pistol
  300  10   0   0   0   0   0   0 // 30 Laser Rifle
  460  10   0   0   0   0   0   0 // 31 Heavy Laser

  420  10   0   0   0   0   0   0 // 32 Laser Cannon
  660 100  20  20  50   0  20   0 // 33 Plasma Cannon
  880 100  20  20  50   0  20   0 // 34 Fusion Ball Launcher

  510  10   0   0   0   0   0   0 // 35 Laser Defense
  620 100   0   0  50   0   0   0 // 36 Plasma Defense
  800 100   0   0  50   0   0   0 // 37 Fusion Defense
  930 100   0   0  50   0  40   0 // 38 Grav Shield
  360 100   0   0   0  80   0   0 // 39 Mind Shield
  420 100   0   0   0  80   0   0 // 40 Psi-Lab
  670 100   0   0   0   0  80   0 // 41 Hyperwave Decoder

  250  10   0   0   0   0   0   0 // 42 Laser Tank
  430 100  20  20  50   0  20   0 // 43 Plasma Hovertank
  690 100  20  20  50   0  20   0 // 44 Launcher Hovertank

  180  10   0   0   0   0   0   0 // 45 Sectoid corpse
  180  10   0   0   0   0   0   0 // 46 Snakeman corpse
  180  10   0   0   0   0   0   0 // 47 Ethereal corpse
  180  10   0   0   0   0   0   0 // 48 Muton corpse
  180  10   0   0   0   0   0   0 // 49 Floater corpse
  180  10   0   0   0   0   0   0 // 50 Celatid corpse
  180  10   0   0   0   0   0   0 // 51 Silacoid corpse
  180  10   0   0   0   0   0   0 // 52 Chryssalid corpse
  180  10   0   0   0   0   0   0 // 53 Reaper corpse
  180  10   0   0   0   0   0   0 // 54 Sectopod corpse
  180  10   0   0   0   0   0   0 // 55 Cyberdisc corpse

  300 100  70  50  20  20  35  20 // 56 Alien Origins
  500 100  60  30  10  10  25  10 // 57 Alien Origins - Leader
  600 100  50  20   0   0  15   0 // 58 Alien Origins - Commander

  180  50  25  20  50   0   0  50 // 59 Personal Armor
  205 100  25  20  50   0  15  25 // 60 Power Suit
  330 100  25  20  50   0  30   0 // 61 Flying Suit

/ResearchHelp
/XCOM

Link to comment
Share on other sites

Also, I got an idea while looking over XCOMUTIL cfg file, how about having captured Aliens giving you research boosts? for example, it takes 600 days (or whatever they are) to research plasma pistol, having a captured Alien Soldier would reduce it by xx amount, as having an alien to interrogate should make things easier.

I think that's what the element in a topic was intended for. If you have researched X, then you get bonus multiplier Y% applied to your research efforts on this topic. Of course, at the moment it only applies to discovered tech. However, I think I can mod it to apply to facilities, items or combatants, just like prerequisites do.

 

However, I'm going to be busy with RL for the next few days, so you'll have to wait a bit.

Link to comment
Share on other sites

I notice Alien Infiltrations is named "Alien Infiltration", it's a minor thing, but I now wonder how do I correct the name? if I change it in research.xml, it fails validation, where are the names stored in?

 

Heh, the xml contained a large number of mistakes, fixed them all (I hope), and added an entry which was missing (Gravity Shield), I think I missed it the first time I wrote it, now I need to add the name for it in order for the file not to fail validation.

 

EDIT: Got it, now I just need to find research times in man-hours, wherever they are...

Just I case I misunderstood you, and you still need to know, the "master" names are now stored in basic.xsd. WARNING: if you change the name of, say, an item, in basic.xsd, then you will need to change it in ALL xml files (e.g. research.xml & item.xml) or they will fail validation. I made this change ensure names are the same across all files.

Link to comment
Share on other sites

I notice Alien Infiltrations is named "Alien Infiltration", it's a minor thing, but I now wonder how do I correct the name? if I change it in research.xml, it fails validation, where are the names stored in?

 

Heh, the xml contained a large number of mistakes, fixed them all (I hope), and added an entry which was missing (Gravity Shield), I think I missed it the first time I wrote it, now I need to add the name for it in order for the file not to fail validation.

 

EDIT: Got it, now I just need to find research times in man-hours, wherever they are...

Just I case I misunderstood you, and you still need to know, the "master" names are now stored in basic.xsd. WARNING: if you change the name of, say, an item, in basic.xsd, then you will need to change it in ALL xml files (e.g. research.xml & item.xml) or they will fail validation. I made this change ensure names are the same across all files.

Yep, did it last night :)

 

Take your time :)

Link to comment
Share on other sites

Alright, I've commited the changes (also fixed a problem in english.xml).

Note, I got the info from XCOMUTIL about research times, however, I don't know what they are exactly, I believe it's the amount of days per 50 scientists... I think, I dunno, whatever they are those are the numbers the game uses, with a possible exception:

After checking the UFOpedia article you quote, the "day" value in the column you give is the number of "scientist days" it takes to develop a tech. E.g. Laser Weapons would take 1 scientist 50 days. (Or 50 scientists 1 day)

 

- I dunno the days to research interrogations or live alien studies, as they are nowhere to be found, so I used the same used in the autopsies (180).

Sounds reasonable. Note, the data we're using is a starting point. No doubt it will need to be tweaked later for game balance.

 

If you're working on research, you can get some ideas about how it worked in X-Com from here.

 

Also, I got an idea while looking over XCOMUTIL cfg file, how about having captured Aliens giving you research boosts? for example, it takes 600 days (or whatever they are) to research plasma pistol, having a captured Alien Soldier would reduce it by xx amount, as having an alien to interrogate should make things easier.

I think that it was that way in X-Com, from what I gathered from XCOMUTIL.cfg, from this table:

// Research Help from Captives
//   Day = Scientist/Days to complete research (unsigned short)
//   Mul = Difficulty multiplier x 10 ( max = 255 = 25.5 times normal )
//  Rank = % reduction of remaining research time

XCOM
ResearchHelp

// Day Mul Cmd Ldr Eng Med Nav Sol 

   50  10   0   0   0   0   0   0 //  0 Laser Weapons
  180  50   0   0  50   0  50   0 //  1 Motion Scanner
  210 100   0   0   0  80   0   0 //  2 Medi-kit
  500 100  50  25   0  80   0   0 //  3 Psi-Amp

<snip>

/ResearchHelp
/XCOM

 

Are you sure that the numbers are % reductions? Some of them add up to more than 100%

Also, I really don't understand what the multiplier does, or how it works. Do you?

 

Finally, thanks for your efforts. =b

Link to comment
Share on other sites

Alright, I've commited the changes (also fixed a problem in english.xml).

Note, I got the info from XCOMUTIL about research times, however, I don't know what they are exactly, I believe it's the amount of days per 50 scientists... I think, I dunno, whatever they are those are the numbers the game uses, with a possible exception:

After checking the UFOpedia article you quote, the "day" value in the column you give is the number of "scientist days" it takes to develop a tech. E.g. Laser Weapons would take 1 scientist 50 days. (Or 50 scientists 1 day)

 

- I dunno the days to research interrogations or live alien studies, as they are nowhere to be found, so I used the same used in the autopsies (180).

Sounds reasonable. Note, the data we're using is a starting point. No doubt it will need to be tweaked later for game balance.

 

If you're working on research, you can get some ideas about how it worked in X-Com from here.

 

Also, I got an idea while looking over XCOMUTIL cfg file, how about having captured Aliens giving you research boosts? for example, it takes 600 days (or whatever they are) to research plasma pistol, having a captured Alien Soldier would reduce it by xx amount, as having an alien to interrogate should make things easier.

I think that it was that way in X-Com, from what I gathered from XCOMUTIL.cfg, from this table:

// Research Help from Captives
//   Day = Scientist/Days to complete research (unsigned short)
//   Mul = Difficulty multiplier x 10 ( max = 255 = 25.5 times normal )
//  Rank = % reduction of remaining research time

XCOM
ResearchHelp

// Day Mul Cmd Ldr Eng Med Nav Sol 

   50  10   0   0   0   0   0   0 //  0 Laser Weapons
  180  50   0   0  50   0  50   0 //  1 Motion Scanner
  210 100   0   0   0  80   0   0 //  2 Medi-kit
  500 100  50  25   0  80   0   0 //  3 Psi-Amp

<snip>

/ResearchHelp
/XCOM

 

Are you sure that the numbers are % reductions? Some of them add up to more than 100%

Also, I really don't understand what the multiplier does, or how it works. Do you?

 

Finally, thanks for your efforts. =b

np =b

 

I am not sure exactly how those reductions work, I just got the general idea (or at least what I'd like to see ;)). About the difficulty multipliers, maybe it gets harder to research something as difficulty increases?

Link to comment
Share on other sites

Alright, I've commited the changes (also fixed a problem in english.xml).

Note, I got the info from XCOMUTIL about research times, however, I don't know what they are exactly, I believe it's the amount of days per 50 scientists... I think, I dunno, whatever they are those are the numbers the game uses, with a possible exception:

Azrael,

 

Don’t mean to bother you, but I’ve just done a quick look through the amended research.xml and have a couple of questions/observations.

 

1. RES_GRAVITY_SHIELD_FACILITY grants Neural Shielding?

2. RES_TERRORIST_INTEROGATION is missing

3. RES_NAVIGATOR_INTERROGATION doesn’t grant anything.

 

Final comment, I thought the package I uploaded included changes to combatant.xsd and item.xsd, to match the changes in basic.xsd. But you didn’t check these in?

Link to comment
Share on other sites

1. RES_GRAVITY_SHIELD_FACILITY grants Neural Shielding?

Whoops (corrected)

2. RES_TERRORIST_INTEROGATION is missing

Yes, I removed it, makes no sense since you can't actually interrogate a terrorist species, as they are not intelligent (Silabrates, Artopods, Ventriculants, Spawns,...), that was my mistake.

3. RES_NAVIGATOR_INTERROGATION doesn’t grant anything.

And it doesn't in X-Com, the mission entries are given by Soldiers, not Navigators as I originally thought. Researching Navigation Interrogation allows you to research Tachyon Emissions Detector.

Final comment, I thought the package I uploaded included changes to combatant.xsd and item.xsd, to match the changes in basic.xsd.  But you didn’t check these in?

Eh, no, you did, you only gave me the new research.xsd, the rest was in your research.zip which you commited yourself :)

Edited by Azrael
Link to comment
Share on other sites

3. RES_NAVIGATOR_INTERROGATION doesn’t grant anything.

And it doesn't in X-Com, the mission entries are given by Soldiers, not Navigators as I originally thought. Researching Navigation Interrogation allows you to research Tachyon Emissions Detector.

There's an entry in research.xml that goes:

	<topic name="RES_NAVIGATOR_INTERROGATION" time="180">
 <prerequisite>
	 <AnyOneOf>
      <combatantref name="ITEM_SATYRIAN" rank="RANK_NAVIGATOR" />
      <combatantref name="ITEM_GREY" rank="RANK_NAVIGATOR" />
         <combatantref name="ITEM_VIPER" rank="RANK_NAVIGATOR" />
    	 <combatantref name="ITEM_MORLOCK" rank="RANK_NAVIGATOR" />
	 </AnyOneOf>
 </prerequisite>  
 <grants quantity="OneOf">

 </grants>
</topic>

Because it doesnt' grant anything, it won't be offered as a research topic. Need to add

to the entry. (This is because most of the interogation topics can be researched multiple times, until there's nothing left to learn.)

 

Final comment, I thought the package I uploaded included changes to combatant.xsd and item.xsd, to match the changes in basic.xsd.  But you didn’t check these in?

Eh, no, you did, you only gave me the new research.xsd, the rest was in your research.zip which you commited yourself :)

You're quite correct.. Whats the smiley for "D'oh"

Link to comment
Share on other sites

  • 1 year later...

Now, Research Requirements.

The research tree comprises the a set of "topics" that can be researched.

Each topic is made of:

  • Prerequsites – conditions that must be satisfied before the project can start
  • Cost (Persondays) of research required
  • Grants - what player gets for researching the topic

The basic types of prerequisite conditions are:

  • Having completed a specific research topic.
  • Having access to a specific a X-Net entry
  • Having a specific type of item in a base's store
  • Having a specific type of captured alien (species and rank) in a base
  • Having ability to build a specific base facility

Additional notes

  • Also, the prerequisite conditions for a project may be satisfied by a combination of "basic prerequisites." For example, having any one of a set of requirements. (e.g. Leader integration can be satisfied by having one of several species of leader.) Or requiring all requirements of the set. (e.g. Alien goal) Or a combination of the above.
  • Also, some topics are automatically granted at the start of the game. This give player access to the starting technologies.
  • Some topics don't need to be researched, they're automatically granted when all prerequisites have been satisfied. (e.g. The GAIA X-CAP becomes available as soon as the Eclipse and Gaia missiles have been researched.) This is indicated in the XML file with a time of 0.
  • If a project has an item as a prerequisite, one instance of the item is consumed by the project.
  • If a project has a combatant as a prerequisite, is the combatant "consumed" by the project.

Types of grants:

  • A research topic
  • An X-Net entry
  • Ability to use (and possibly build) an item
  • Ability to build a base facility

Additional notes

  • A project may grant a combination "grants". It may grant either all items in the set, or only one item in the set.
  • If a project can grant "Any one of" the grants in a set, then the project can be researched multiple times, with each time giving a different grant, until all grants have been given.

Additionally, we may want to put some tests against the research tree. (especially, as users are supposed to be able to alter the tree.) Some tests we could do are:

  • Making sure that every item (in items.xml) can be granted by one or more research projects.
  • Making sure that there are no research topics that are inaccessible. (e.g. a topic depends on another topic that isn't in the tree, or a there's a loop in the prerequisites. E.g. Topic "A" has Topic "B" as a prereq, but "B" has "A" as a prereq, or even deeper trees)

Edited by dteviot
Link to comment
Share on other sites

The research tree comprises the a set of "topics" that can be researched.

Each topic is made of:

  • Prerequsites – conditions that must be satisfied before the project can start
  • Cost (Persondays) of research required
  • Grants - what player gets for researching the topic

The basic types of prerequisite conditions are:

  • Having completed a specific research topic.

  • Having access to a specific a X-Net entry. (That is not necesarily true as every topic has a reference in the XNET, you can think of it as a root with automatic unlocking and the rest depends on the attached grant ;) ).
  • Having a specific type of artifact in a base's store. (Dead aliens are artifacts too).
  • Having a specific type of captured alien (species and rank) in a base. (live aliens are a different story, as there are other requirements).

  • Having ability to build a specific base facility I would put it as: "Having built a specific base facility" instead of having the ability to do so as that is similar to the XNet entry).

Additional notes

  • Also, the prerequisite conditions for a project may be satisfied by a combination of "basic prerequisites." For example, having any one of a set of requirements. (e.g. Leader integration can be satisfied by having one of several species of leader.) Or requiring all requirements of the set. (e.g. Alien goal) Or a combination of the above.
  • Also, some topics are automatically granted at the start of the game. This give player access to the starting technologies.

  • Some topics don't need to be researched, they're automatically granted when all prerequisites have been satisfied. (e.g. The GAIA X-CAP becomes available as soon as the Eclipse and Gaia missiles have been researched.) This is indicated in the XML file with a time of 0.This is an special corner case that can be handled directly by a grant.
  • If a project has an item as a prerequisite, one instance of the item is consumed by the project.
  • If a project has a combatant as a prerequisite, is the combatant "consumed" by the project.

Types of grants:

  • A new research project.
  • Add an entry to X-Net.
  • Unlock ability to build and use an item.
  • Unlock ability to build a base facility

Additional notes

  • A project may grant a combination "grants". It may grant all items in a set or only one randomly selected item in a set.
  • If a project can grant "Any one of" the grants in a set, then the project can be researched multiple times, with each time giving a different grant, until all topics have been unlocked.

Additionally, we will add some sanity checks against the research tree. (especially, as users are supposed to be able to alter the tree in development.) Some tests we could do are:

  • Making sure that every item (in items.xml) can be granted by one or more research projects.
  • Making sure that there are no research topics that are inaccessible. (e.g. a topic depends on another topic that isn't in the tree, or a there's a loop in the prerequisites. E.g. Topic "A" has Topic "B" as a prereq, but "B" has "A" as a prereq, or even deeper trees)

 

- Added comments by dteviot.

Link to comment
Share on other sites

Types of grants:

  • A new research project.
  • Add an entry to X-Net.
  • Unlock ability to build an item
  • Unlock ability to use an item
  • Unlock ability to build a base facility
Unlocking the ability to use an item will also unlock the ability to build the item, if the item can be built.
Items.xml has the information on wether an item can ever be built by a player. (It records if an item can be bought, built, neither or both, and the build/buy costs.)
 
If a project has a combatant as a prerequisite, is the combatant "consumed" by the project?
Zombie, can you answer this one please?
 
Oh, checks should probably include that research has an unlock for every X-Net entry as well.
 

  • If a project can grant "Any one of" the grants in a set, then the project can be researched multiple times, with each time giving a different grant, until all topics have been granted.
  • Duplicated text. (Must have got sloppy with cut and paste.

    Link to comment
    Share on other sites

    If a project has a combatant as a prerequisite, is the combatant "consumed" by the project?

    Zombie, can you answer this one please?

    Recent knowledge into game files have shown that the unit disappears from inventory once you research it. So yes, it basically is consumed. I must point out that if you interrogate a live alien for a certain project and the alien is also a prereq for another project you will unlock both topics at the same time. (For example, in the original game if you research any alien then you unlock the alien origins project. If you captured a live Sectoid Leader and researched it instead of a lower-ranking alien first, you would open up Alien Origins, info on the Sectoid species and unlock Psionic research all in one swipe). In this case, the alien is not consumed directly after it gives up info on what you wanted - it is consumed after the other projects with the alien as a prereq are closed. Since this always happened at the same time in X-COM, I guess you could consider it gone no matter what. The multiple projects issue might not even be a problem in Xeno, but I haven't seen the research tree Az created to make an educated guess otherwise. :)

     

    - Zombie

    Link to comment
    Share on other sites

    If a project has a combatant as a prerequisite, is the combatant "consumed" by the project?

    Zombie, can you answer this one please?

    Recent knowledge into game files have shown that the unit disappears from inventory once you research it. So yes, it basically is consumed. I must point out that if you interrogate a live alien for a certain project and the alien is also a prereq for another project you will unlock both topics at the same time. (For example, in the original game if you research any alien then you unlock the alien origins project. If you captured a live Sectoid Leader and researched it instead of a lower-ranking alien first, you would open up Alien Origins, info on the Sectoid species and unlock Psionic research all in one swipe). In this case, the alien is not consumed directly after it gives up info on what you wanted - it is consumed after the other projects with the alien as a prereq are closed. Since this always happened at the same time in X-COM, I guess you could consider it gone no matter what. The multiple projects issue might not even be a problem in Xeno, but I haven't seen the research tree Az created to make an educated guess otherwise. :)

     

    - Zombie

    Thanks for that Zombie.

    As regards the research file, it can represent this. But it does mean we would need to put separate research projects into the file. One for "Sectoid" and one for "Sectoid Leader". At the moment, it has a "Leader interogation" entry that is any leader type, but it doesn't unlock any species specific topics.

    Link to comment
    Share on other sites

    • 1 month later...

    Hi,

     

    as apparently I didn't quite get over my xeno addiction, here I am again, trying out the new xna-branch (And I must say, I'm really impressed). To get a feel for the codebase, I'm trying to get the research-stuff working.

     

    Here's my question: Does there exist already a machine-readable mapping from the symbolic ID's (e.g. RES_LASER_RIFLE) to the real names to be displayed in the research screen?

     

    Rincewind

    Link to comment
    Share on other sites

    Hi,

     

    as apparently I didn't quite get over my xeno addiction, here I am again, trying out the new xna-branch (And I must say, I'm really impressed). To get a feel for the codebase, I'm trying to get the research-stuff working.

     

    Here's my question: Does there exist already a machine-readable mapping from the symbolic ID's (e.g. RES_LASER_RIFLE) to the real names to be displayed in the research screen?

     

    Rincewind

    Observations.

    • Issues with Strings.Designer.cs file into svn. It's autogenerated, which means it gets completely mugged when switching between english and deutch versions of VS.
    • I think you didn't see the Research classes that Red Knight provided.
    • Remove Utils.LoadString(string resourceName, string fallback). If the resource string is not there, it needs to be added, not worked around.
    • Add Copyright notice to files.
    • In GeoscapeScreen, when a topic has been researched, do NOT call TopicResearched() in Geoscape and then put up a dialog.
      The correct pattern is to define a new GeoEvent, and put the event into the Event queue for handling.
      Reason for this, is the Research dialog may involve going to diferent screens (e.g. XNet)
    • Please make sure all code you add has no warnings, and all functions have XML comments.

    Link to comment
    Share on other sites

    [*]Issues with Strings.Designer.cs file into svn. It's autogenerated, which means it gets completely mugged when switching between english and deutch versions of VS.

     

    True, any ideas for a workaround?

     

    [*]I think you didn't see the Research classes that Red Knight provided.

     

    Yeah, I realized that a little too late. I now have my design changed a to resemble his. Discussed it with him on msn as well.

     

    [*]Remove Utils.LoadString(string resourceName, string fallback). If the resource string is not there, it needs to be added, not worked around.

     

    Hmm, I would rather have a game that falls back on the symbolic names than explode :-) Also, this way, CTD can easily add the "real names" step by step and we still have a working version. But I'm open to suggestions.

     

    [*]Add Copyright notice to files.

     

    Will do!

     

    [*]In GeoscapeScreen, when a topic has been researched, do NOT call TopicResearched() in Geoscape and then put up a dialog.

    The correct pattern is to define a new GeoEvent, and put the event into the Event queue for handling.

    Reason for this, is the Research dialog may involve going to diferent screens (e.g. XNet)

     

    Hmmm, I agree that there may be different actions required when something is researched. Nevertheless, I think a delegate/.NET event is the right approach for this. GeoEvent just reinvents a .NET-event system, I think. With my approach, handlers can be registered with ResearchGraph. The current dialog that pops up is just one way of handling that event.

     

    Again, just my two cents. Maybe we can discuss this a little on irc?

     

    [*]Please make sure all code you add has no warnings, and all functions have XML comments.

    So far, I added XML-Comments to all public functions. I didn't see any warnings left. Will check now, though.

     

    On a more general note, I think we have to change away from the c++ way of thinking. The xna-design is fundamentally different. Especially all the components/services stuff makes some things a whole lot easier.

     

    I branched to have a playground for the gui stuff. I will report what I find out here. (So far, all existing GUI-libs still seem to be either very limited (and not focussed on what we need) or rather incomplete). I'll keep working on it, though.

     

    Rincewind

    Link to comment
    Share on other sites

    [*]Issues with Strings.Designer.cs file into svn. It's autogenerated, which means it gets completely mugged when switching between english and deutch versions of VS.

     

    True, any ideas for a workaround?

     

    [*]I think you didn't see the Research classes that Red Knight provided.

     

    Yeah, I realized that a little too late. I now have my design changed a to resemble his. Discussed it with him on msn as well.

     

    [*]Remove Utils.LoadString(string resourceName, string fallback). If the resource string is not there, it needs to be added, not worked around.

     

    Hmm, I would rather have a game that falls back on the symbolic names than explode :-) Also, this way, CTD can easily add the "real names" step by step and we still have a working version. But I'm open to suggestions.

     

    [*]Add Copyright notice to files.

     

    Will do!

     

    [*]In GeoscapeScreen, when a topic has been researched, do NOT call TopicResearched() in Geoscape and then put up a dialog.

    The correct pattern is to define a new GeoEvent, and put the event into the Event queue for handling.

    Reason for this, is the Research dialog may involve going to diferent screens (e.g. XNet)

     

    Hmmm, I agree that there may be different actions required when something is researched. Nevertheless, I think a delegate/.NET event is the right approach for this. GeoEvent just reinvents a .NET-event system, I think. With my approach, handlers can be registered with ResearchGraph. The current dialog that pops up is just one way of handling that event.

     

    Again, just my two cents. Maybe we can discuss this a little on irc?

     

    [*]Please make sure all code you add has no warnings, and all functions have XML comments.

    So far, I added XML-Comments to all public functions. I didn't see any warnings left. Will check now, though.

     

    On a more general note, I think we have to change away from the c++ way of thinking. The xna-design is fundamentally different. Especially all the components/services stuff makes some things a whole lot easier.

     

    I branched to have a playground for the gui stuff. I will report what I find out here. (So far, all existing GUI-libs still seem to be either very limited (and not focussed on what we need) or rather incomplete). I'll keep working on it, though.

     

    Rincewind

    Link to comment
    Share on other sites

    [*]Issues with Strings.Designer.cs file into svn. It's autogenerated, which means it gets completely mugged when switching between english and deutch versions of VS.

     

    True, any ideas for a workaround?

    I think there's a command line to generate the file.

    So possible solution would be remove the Strings.Designer.cs, and update the .vsproj file to generate the file. (Just not quite sure how to do that.)

     

    [*]Remove Utils.LoadString(string resourceName, string fallback). If the resource string is not there, it needs to be added, not worked around.

     

    Hmm, I would rather have a game that falls back on the symbolic names than explode :-) Also, this way, CTD can easily add the "real names" step by step and we still have a working version. But I'm open to suggestions.

    Looks like we disagree with this, I'd rather have the function fail if a string is missing, so that we know there's a problem. Instead of silently failing.

    A possible comprimise, give the function a different name, but same signature as the other LoadString. e.g. SafeLoadString(string resourceName). That means we can have the function work if the string is missing, but can do a simple search/replace of the source to put in the less tolerant LoadString() for imporoved error checking.

     

    [*]In GeoscapeScreen, when a topic has been researched, do NOT call TopicResearched() in Geoscape and then put up a dialog.

    The correct pattern is to define a new GeoEvent, and put the event into the Event queue for handling.

    Reason for this, is the Research dialog may involve going to diferent screens (e.g. XNet)

     

    Hmmm, I agree that there may be different actions required when something is researched. Nevertheless, I think a delegate/.NET event is the right approach for this. GeoEvent just reinvents a .NET-event system, I think. With my approach, handlers can be registered with ResearchGraph. The current dialog that pops up is just one way of handling that event.

     

    Again, just my two cents. Maybe we can discuss this a little on irc?

    The problem is what happens if during an update time slice two (or more) events occur that both want to put up a dialog? E.g. A research project is completed, and a facility is completed, and a Craft reaches attack range of a UFO. The event queue is to deal with that when a screen change may occur. (From memory, a finished research project shows user XNet entry, and user can set a new project.)

    Have a look at the files here, especially GettingModalDialogsToWork.htm and Research.htm

     

    [*]Please make sure all code you add has no warnings, and all functions have XML comments.

    So far, I added XML-Comments to all public functions. I didn't see any warnings left. Will check now, though.

    I'd prefer comments for everything, the more we can do to make the code clear, the better.

    Oh, and if you can, please run Code Analysis over the source as well.

    (Yes, I know there's still 6 warnings left in my code. I'll deal with the exception shortly, the others, if you can provide a good solution, let me know.)

    Link to comment
    Share on other sites

    ×
    ×
    • Create New...