Jump to content


Photo

Facility Types


  • Please log in to reply
47 replies to this topic

#1 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 22 November 2005 - 01:03 PM

A few things I've noticed.
1. In the facilities.xml, "manteinance" should be spelt "maintenance"
2. There doesn't seem to be a type for Defense Array facilities. E.G. GAIA Defense Facility.
3. I'm not sure there's a need for separate research and workshop facility types. The Facility types already seem to share common types. E.g. A FAC_ALIEN_CONTAINMENT_FACILITY and a FAC_GENERAL_STORAGE_FACILITY are both storageFacilityType.

1's easy to fix

I'd like to discuss items 2 and 3 before making changes.
Initial thought for 2 is just create the type. Possible attributes of a defense array would be: range (km), accuracy (% chance of hit per shot), damage per shot, reload time (secs).
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#2 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 22 November 2005 - 05:50 PM

My two cents :)

2) I think we should add this type of facility to xml shemas
3) Yes in .xml file we can't distinguish if givent storage facility is general or alien storage. (I think i was already asking somebody about that, but know don't remeber it). I implemented it by checking by type names which is very ugly (at least for me) and should be changed.

4) We can't say wich object (from research.xml) can be bought and wich have to be produced. Also there are no buy / product prices anywhere. I'm voitng to add this attributs to item.xml/.xsd


Beetle
Posted Image

#3 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 23 November 2005 - 01:29 AM

Additional comments
We have the following human facilities:

Base Access Facility
Landing Pad
Barracks Facility
Research Facility
Engineering Facility
Plasma Defense Array
Laser Defense Array
GAIA Defense Array
Missile Defense Array
Storage Facility
Xenomorph Holding Facility
Short Range Neudar
Long Range Neudar
Tachyon Emissions Detector
Gravity Shield Facility
Neural Shielding Facility
Psionic Training Facility

And we form humanfacilitytype.cpp,
have the following HumanFacilityType classes - which the following facilities belong to:


HumanFacilityType
- Base Access
- Landing Pad

StorageFacilityType
- Storage

ScanningFacilityType
- Short Range Neudar

ResearchFacilityType
- Research

PersonelFacilityType
- Barracks

WorkshopFacilityType
- Engineering


Looking at this list, it would apper that Long Range Neudar & Tachyon Emissions Detector would go under ScanningFacilityType

And if we add a DefenseArrayType, then the 4 defense arrays go there.

That leaves Gravity Shield, Neural Shield & Psionic Training.
Which I don't know where they go, although I suspect Psionic training goes under PersonelFacilityType.

Also, as I said before, I suspect the Research & Workshop types can be replaced with a single class.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#4 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3,310 posts

Posted 24 November 2005 - 12:16 PM

Using the Project Wise framework, those can be unified into a single class.

Greetings
Red Knight
Sourceforge Nick: flois - Federico Andres Lois
Visit my blog at: flois.blogspot.com

Posted Image

Pookie cover me, I am going in.

#5 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 24 November 2005 - 12:31 PM

Using the Project Wise framework, those can be unified into a single class.

Greetings
Red Knight

<{POST_SNAPBACK}>

Please confirm, you're saying that Research & Workshop could become "Project" class?

I'm thinking, Gravity & neural shield can go under HumanFacility, at least for the moment.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#6 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3,310 posts

Posted 24 November 2005 - 12:41 PM

Nope that both research and workshop facilities can be instances of the same class. Because Projects can be research or construction based.

Greetings
Red Knight
Sourceforge Nick: flois - Federico Andres Lois
Visit my blog at: flois.blogspot.com

Posted Image

Pookie cover me, I am going in.

#7 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 24 November 2005 - 04:39 PM

but we have to know wich facility is which. Both research and engineering have projects, but if we put them into one we have to add a attribute (in xml) of some sort.
Posted Image

#8 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 27 November 2005 - 01:16 PM

but we have to know wich facility is which. Both research and engineering have projects, but if we put them into one we have to add a attribute (in xml) of some sort.

<{POST_SNAPBACK}>

Yes, something like "Supported Project Type"

Incidentally, unless someone tells me different within the next 48 hours, I'm going to add the missing items to facilities.xml, facilities.xsd and update HumanFacilityType.cpp and HumanFacilityType.h to load them as well.

Looking at the XNET description for the Grav shield and Neural shield, I think they become 2 new types.
Grav Shield gets attribute: Speed reduction. Float range 0.0 to 1.0 indicating how badly UFO's speed is reduced. 0 = stopped, 1.0 = uneffected.
Neural shield gets: dampening. Float range 0.0 to 1.0 indicating how much it reduce's bases detectability. 0 = no reduction, 1.0 = undetectable.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#9 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 27 November 2005 - 01:55 PM

Go for it :)
Posted Image

#10 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3,310 posts

Posted 27 November 2005 - 10:53 PM

Yeap, dont wait ;)

Greetings
Red Knight
Sourceforge Nick: flois - Federico Andres Lois
Visit my blog at: flois.blogspot.com

Posted Image

Pookie cover me, I am going in.

#11 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 28 November 2005 - 01:01 PM

Yeap, dont wait ;)

Greetings
Red Knight

<{POST_SNAPBACK}>

Done. Sort of. (Updated files sent to Beetle for check-in.)
The HumanFacilityTypesFactory should now return a valid object for each facility type. Note, I suspect many of the Facilities don't have a complete set of attributes.

While doing this work I discovered that facility.xsd already had entries for defense and shield, so I keep them. And for the other types, I've also kept their existing attributes from the .xsd. (With the exception of Research & Workshop, which I've consolidated.)

I've added entries to facilities.xml so that it has a complete set. However the values for many of the attributes I just made up off the top of my head, so someone will need to go through and put in the correct values. (Hint, the SIZE attributes should be fixed ASAP.)

At any rate, now when we figure out what static attributes the various facility types have it should be simple to add them.

A couple of final notes.
1) I was unable to find an entry in research.xml for the GAIA defense array, so I've assumed it is called FAC_GAIA_DEFENSE_ARRAY

2) I had to patch HumanFacility.cpp to match the changes, and found code like this:
void HumanFacility::scrapFacility()
{
    if (facilityType->getTypeName() == "FAC_HANGAR_FACILITY")
	{
  ownerBase->changeLaunchAreas(-1);
	}
	if (facilityType->getTypeName() == "FAC_GENERAL_STORAGE_FACILITY")
	{
  ownerBase->changeGeneralCapacity(-1 * ((StorageFacilityType*)facilityType)->getCapacity());
	}
	if (facilityType->getTypeName() == "FAC_ALIEN_CONTAINMENT_FACILITY")
	{
  ownerBase->changeAlienCapacity(-1 * ((StorageFacilityType*)facilityType)->getCapacity());
	}
	if (facilityType->getTypeName() == "FAC_BARRACKS_FACILITY")
	{
  ownerBase->changePersonelCapacity(-1 * ((PersonelFacilityType*)facilityType)->getCapacity());
	}
	if (facilityType->getTypeName() == "FAC_RESEARCH_FACILITY")
	{
  ownerBase->changeResearchCapacity(-1 * ((ProjectFacilityType*)facilityType)->getCapacity());
	}

    Player::get().modifyMoney(facilityType->getScrapRevenue());

}

Which suggests the need for some additional virtual functions in the HumanFacilityType class. e.g. OnScrap(), OnConstructed()
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#12 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 28 November 2005 - 01:04 PM

A couple of final notes.
1) I was unable to find an entry in research.xml for the GAIA defense array, so I've assumed it is called FAC_GAIA_DEFENSE_ARRAY

<{POST_SNAPBACK}>

I'll look into it :)

#13 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3,310 posts

Posted 28 November 2005 - 05:52 PM

Go for the virtual version, it is more scalable to new types. I dont know how such code slipped in there.

Greetings
Red Knight
Sourceforge Nick: flois - Federico Andres Lois
Visit my blog at: flois.blogspot.com

Posted Image

Pookie cover me, I am going in.

#14 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 28 November 2005 - 06:22 PM

Yes virtual methods will be nice :)

You can also think a little on canBeDestroyed() since i don't really like how i done it :) Maybe You will manage to make something more intuitive :) (i don't mean only this funciton but a "communication" between HumanBase and HumanFacility about this topic)

There is also needed a method wich can GUI use for assigning a callback function wich will be called insted of facilityConstructedInfo.

:)
Posted Image

#15 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 29 November 2005 - 07:51 PM

A couple of final notes.
1) I was unable to find an entry in research.xml for the GAIA defense array, so I've assumed it is called FAC_GAIA_DEFENSE_ARRAY

<{POST_SNAPBACK}>

I'll look into it :)

<{POST_SNAPBACK}>

Just so you know, I will update and fix research.xml once someone fixes the schema and allows "free" research, otherwise I can see myself going through it all again once it's eventually done :) is anyone working on it?

#16 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 29 November 2005 - 10:46 PM

A couple of final notes.
1) I was unable to find an entry in research.xml for the GAIA defense array, so I've assumed it is called FAC_GAIA_DEFENSE_ARRAY

<{POST_SNAPBACK}>

I'll look into it :)

<{POST_SNAPBACK}>

Just so you know, I will update and fix research.xml once someone fixes the schema and allows "free" research, otherwise I can see myself going through it all again once it's eventually done :) is anyone working on it?

<{POST_SNAPBACK}>

Just to fill in, this is what Azrael is talking about. If there are no objections, I'll fix up the .xsd to allow 0 time tomorrow. I have RL plans for tonight.

Azrael,

Noticed in reseach.xml the topic topic RES_PSIONIC_AMPLIFIER
has a prerequisite of XNET_PSIONIC_LAB which doesn't appear to exist anywhere else.


I will take a thorough look tonight and try to fix as many errors as possible, there are some things I would like to ask you too about it, maybe you can answer my doubts. For now my most important question is: how do you do to make a topic be obtained "for free" after it meets different requirements?
For example, the XCAP, GAIA should be available for manufacture after researching XC-2 Starfire and GAIA Missile (not sure if these are the actual requirements, but doesn't matter, it's an example :)), now you should obtain the Xnet entry "XCAP, GAIA" and the ability to manufacture the XCAP after researching these two entries (XC2 and Missile) with no additional research time (i.e. you don't need to select "XCAP, GAIA" in the research dialog, you just get it after meeting the requirements). So how am I to put that it needs these two requirements but doesn't need to be researched (not even selected from the research screen) ? So far my best option was to put Research Time 0, but the schema won't allow me to do that, and if I understand it correctly, it'd still need to be researched if I did that, though it'd be completed instantly.
Did I make any sense there? do you have any idea how to make this?

The answer is I don't know. All I know about research.xml is what I see in the file. From the sounds of it, we need to update the research schema, either to allow a duration of 0 (which the "reseach engine" will need to understand means a research project isn't needed) or a new explicit attribute (e.g. automatic) to indicate same. Either way, changing the schema exceeds my authority.


Same thing as with the other issue. Post it in the forums. That way, the process is documented and everybody gets to give their opinion.

Rincewind

P.S: The duration of 0 seems to me the appropriate way to do it but let's get some feedback from the others.


Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#17 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 30 November 2005 - 04:18 AM

Azreal,

Attached is updated research.xsd, that will let you set time to 0.

Also, I've discovered that the latest build of Xenocide crashes in base view if you try to create a facility other than
baracks,
short range neudar,
or Research.

This is because the Facility Type names differ between the files:
research.xml
graphics.xml
facility.xml and HumanFacilityType.cpp

When you've confirmed the names in research.xml are up to date, please drop me a note and I'll update the other files to match.

Thanks,
David

Attached Files


Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#18 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 30 November 2005 - 06:45 AM

I have fixed it yesterday, are there still problems with facility names??
Maybe we should switch HumanFacilityType.cpp from searching thru names into searching thru xsi:type?

About reasearch.xml, i already PM Azrael about that, but there is strange (for me) attribute in there
<xsd:attribute name="persists" type="xsd:boolean" default="false"/>

maybe it's supposed to be used for that kind of research ??
edit: At this point this attribute isn't used anywhere (it's false everywhere).

Edited by Beetle, 30 November 2005 - 06:46 AM.

Posted Image

#19 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 30 November 2005 - 09:07 AM

Ok, so what do I use? Research time 0 or Persists?
Also, will Research Time 0 allow it to be obtained [i]without even having to click on the research window[i]? remember that for example the Fusion Tank once the requisites are met, it's supposed to pop up and simply say "Research Completed: GAIA XCAP" without me having to ever select it for research :)
I promise I'll look into Research.xml tonight, haven't had time cause I had to swap drives and for unfortunate events I had to reinstall it two more times <_<

About reasearch.xml, i already PM Azrael about that, but there is strange (for me) attribute in there
CODE

<xsd:attribute name="persists" type="xsd:boolean" default="false"/>


maybe it's supposed to be used for that kind of research ??
edit: At this point this attribute isn't used anywhere (it's false everywhere).

I think I remember something like this from one of the first tech trees, made by Cpt. Boxershorts, isn't that attribute mean that you can still research it? so, if it's false it means that you cannot research it again once research is completed, if it's true you can, that'd mean that for example "Grey Medic" would be True since you can obtain more than one Live Alien Study from it. Makes sense to me, and we also need such an attribute, in case that's not the one.

Edited by Azrael, 30 November 2005 - 09:11 AM.


#20 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 30 November 2005 - 01:10 PM

I have fixed it yesterday, are there still problems with facility names??

My error, I haven't updated my code since Tuesday, so the code I have didn't have your updates.

Maybe we should switch HumanFacilityType.cpp from searching thru names into searching thru xsi:type?

Possible, but I'm not sure we'd gain much. We still need to do a mapping from element in XML file to C++ class we're going to create.

In addition, the "element names" e.g. FAC_GAIA_DEFENSE_ARRAY are essentially identifiers, that are used in multiple files, e.g. xnet, research, graphics etc. So, if it's changed in one file, it must be changed in all of them.

And I believe I know how to enforce this.
In basic.xsd, the facilityID has a simple pattern restriction of:
<xsd:pattern value="FAC_[^\s]*"/>
If I change this to an enumeration restriction (putting in the "official" names) then the XML files will only validate if the names are correct. :-)

So,
1. Does this plan look feasible, or am I overlooking something? (I'm still learning XML)
2. I'm assuming the master source for the IDs is research.xml. Is this correct?
3. If this works, as well as doing the facilities, all of these element names should be coded in basic.xsd as enumerations. However, as that's a big job I'd like to stage it over a period of time. Any objections?

Cheers
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#21 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 30 November 2005 - 01:16 PM

Maybe we should switch HumanFacilityType.cpp from searching thru names into searching thru xsi:type?

Possible, but I'm not sure we'd gain much. We still need to do a mapping from element in XML file to C++ class we're going to create.

<{POST_SNAPBACK}>

In addtion, changing an identifier name will break code instances like this
void HumanFacility::facilityConstructed()
{
    if (facilityType->getTypeName() == "FAC_HANGAR_FACILITY")
	{
  ownerBase->changeLaunchAreas(1);
	}
	if (facilityType->getTypeName() == "FAC_GENERAL_STORAGE_FACILITY")
	{
  ownerBase->changeGeneralCapacity(((StorageFacilityType*)facilityType)->getCapacity());
	}
	if (facilityType->getTypeName() == "FAC_ALIEN_CONTAINMENT_FACILITY")
	{
  ownerBase->changeAlienCapacity(((StorageFacilityType*)facilityType)->getCapacity());
	}
	if (facilityType->getTypeName() == "FAC_BARRACKS_FACILITY")
	{
  ownerBase->changePersonelCapacity(((PersonelFacilityType*)facilityType)->getCapacity());
	}
	if (facilityType->getTypeName() == "FAC_RESEARCH_FACILITY")
	{
  ownerBase->changeResearchCapacity(((ProjectFacilityType*)facilityType)->getCapacity());
	}
    isConstructing = false;
}

Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#22 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 30 November 2005 - 05:15 PM

Yes You have right, but (the is always but) doing like that isn't very flexible. Maybe we will just leave this as it is :)

Beetle

P.S. About research.xml you have also right :)
Posted Image

#23 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 30 November 2005 - 05:19 PM

Yes You have right, but (the is always but) doing like that isn't very flexible. Maybe we will just leave this as it is :)

Beetle

P.S. About research.xml you have also right :)

<{POST_SNAPBACK}>

So, is the persistency thing as I think it is?
And what the research time 0? how will it work? (or whatever you guys did to fix the "free research")

edit: I'll update research.xml tomorrow, hopefully, my windows is having another crisis and needs to be reinstalled for the third time in two days <_<

Edited by Azrael, 30 November 2005 - 05:25 PM.


#24 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 30 November 2005 - 05:39 PM

Currently "persits" is not used.
So lets use it :)
From code part we will made it as you want it :)
Posted Image

#25 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 30 November 2005 - 05:56 PM

Yes You have right, but (the is always but) doing like that isn't very flexible. Maybe we will just leave this as it is :)

Beetle

P.S. About research.xml you have also right :)

<{POST_SNAPBACK}>

So, is the persistency thing as I think it is?
And what the research time 0? how will it work? (or whatever you guys did to fix the "free research")

edit: I'll update research.xml tomorrow, hopefully, my windows is having another crisis and needs to be reinstalled for the third time in two days <_<

<{POST_SNAPBACK}>

I'm sorry, I don't know anything more about the "persists" attribute at this time than you do.

At the moment, I'd say ignore the persists attribute, use time = 0. If this proves to be wrong, I can always write a script to fixup the file.

The change I made to the .xsd schema now permits the minimum "time" value to be zero. Previously it was 1. My thought is that when a new "knowledge" is gained by research, the engine would run through the list of all "knowledges" and if you now meet the critera for a time = 0 knowledge it would automatically give you that as well.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#26 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 30 November 2005 - 06:00 PM

Yes You have right, but (the is always but) doing like that isn't very flexible. Maybe we will just leave this as it is :)

Beetle

P.S. About research.xml you have also right :)

<{POST_SNAPBACK}>

Beetle,
Can you confirm what you're saying is:
1. We use research.xml as the master reference for element names.
2. We could enforce correct element naming by defining the enumerations in base.xsd, but you'd rather we didn't, as it's not flexible.

Assuming my understaning is correct, why do we need the flexibility? As I see it, the flexibility just causes problems, as it allows the element names in the various files to get out of sync.

Thanks,
David
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#27 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 30 November 2005 - 06:04 PM

Currently "persits" is not used.
So lets use it :)
From code part we will made it as you want it :)

<{POST_SNAPBACK}>

I'd argue against using persists. What Azrael wants is to show that given prerequisits X and Y, you automatically get research item Z. Which suggests to me that the best way of indicating this is by the time attribute. The "persists" attribute would appear to indicate something else. (Possibly that it doesn't destroy the items required for researching an item.)
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#28 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 30 November 2005 - 06:37 PM

Hmm when i was writing my previos post i didn't noticed azrael post :Brickwall:
but he had right :) :) ok so i'm conviced now :) we will use 0 time for that.
Azrael and dteviot i own you a beer :) :beer:

Yes, we use research.xml as major reference for names.

Flexibilty, yes it always means complexity :) we are trying here to make everything as much flexible as it can be ( i didn't develop that i was forced :P ), or at least we are trying to make a future possibilty to easy add new things. Or at least other programmers are trying to do it, becouse in my case, i almost always fail at this point :)

2. Go on with that enumeration (in future i will try to add testings from program part (test names from research.xml :) ) )
Posted Image

#29 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 30 November 2005 - 08:32 PM

The change I made to the .xsd schema now permits the minimum "time" value to be zero.  Previously it was 1.  My thought is that when a new "knowledge" is gained by research, the engine would run through the list of all "knowledges" and if you now meet the critera for a time = 0 knowledge it would automatically give you that as well.

<{POST_SNAPBACK}>

My concern is that even with time 0 it will still require the player to go to the Research screen and select the topic.
But I'll set the appropiate topics with 0 and I guess you guys will take it from there :)
About the persist attribute, is that what I think? should I use it? I assumed it was to allow the player to research something more than once, i.e. Grey Medic. I dunno, you people tell me :)

#30 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 30 November 2005 - 08:41 PM

The change I made to the .xsd schema now permits the minimum "time" value to be zero.  Previously it was 1.  My thought is that when a new "knowledge" is gained by research, the engine would run through the list of all "knowledges" and if you now meet the critera for a time = 0 knowledge it would automatically give you that as well.

<{POST_SNAPBACK}>

My concern is that even with time 0 it will still require the player to go to the Research screen and select the topic.
But I'll set the appropiate topics with 0 and I guess you guys will take it from there :)

So far as I am aware, the research engine hasn't been written yet. But I'm very eager to get started on it. (More on this in a few days.) Dealing with a time 0 topic should be simple enough. Just means that when the project manager does it's daily progress update it needs to check for any zero time topics with a full set of prerequisites. If any are found, they're marked as available and player is informed. No biggie.

About the persist attribute, is that what I think? should I use it? I assumed it was to allow the player to research something more than once, i.e. Grey Medic. I dunno, you people tell me :)

<{POST_SNAPBACK}>

I'd ignore it for the time being, until we figure out what it's for.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#31 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 01 December 2005 - 03:36 PM

The change I made to the .xsd schema now permits the minimum "time" value to be zero.  Previously it was 1.  My thought is that when a new "knowledge" is gained by research, the engine would run through the list of all "knowledges" and if you now meet the critera for a time = 0 knowledge it would automatically give you that as well.

<{POST_SNAPBACK}>

My concern is that even with time 0 it will still require the player to go to the Research screen and select the topic.
But I'll set the appropiate topics with 0 and I guess you guys will take it from there :)

So far as I am aware, the research engine hasn't been written yet. But I'm very eager to get started on it. (More on this in a few days.) Dealing with a time 0 topic should be simple enough. Just means that when the project manager does it's daily progress update it needs to check for any zero time topics with a full set of prerequisites. If any are found, they're marked as available and player is informed. No biggie.

About the persist attribute, is that what I think? should I use it? I assumed it was to allow the player to research something more than once, i.e. Grey Medic. I dunno, you people tell me :)

<{POST_SNAPBACK}>

I'd ignore it for the time being, until we figure out what it's for.

<{POST_SNAPBACK}>

The xml validator does not allow me to set time 0.

#32 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 01 December 2005 - 04:13 PM

The xml validator does not allow me to set time 0.

<{POST_SNAPBACK}>

Which validator are you using?
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#33 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 01 December 2005 - 04:15 PM

The xml validator does not allow me to set time 0.

<{POST_SNAPBACK}>

Which validator are you using?

<{POST_SNAPBACK}>

XMLSpy Home Edition 2006

#34 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 01 December 2005 - 05:42 PM

The xml validator does not allow me to set time 0.

<{POST_SNAPBACK}>

Which validator are you using?

<{POST_SNAPBACK}>

XMLSpy Home Edition 2006

<{POST_SNAPBACK}>

OK, I'm not familar with that tool.
The change I made to research.xsd was very simple. The line
<xsd:element name="time" type="xsd:positiveInteger" />
was changed to
<xsd:element name="time" type="xsd:nonNegativeInteger" />

The difference being xsd:positiveInteger doesn't include zero, but xsd:nonNegativeInteger does.

ref:
http://books.xmlsche...ch19-77247.html

Suggestions.
1. Check the .xsd file itself, possibly I sent you the wrong one.
2. Is it possible you have multiple copies of the .xsd file on your PC, and you're validating against an older one?
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#35 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 01 December 2005 - 05:52 PM

The xml validator does not allow me to set time 0.

<{POST_SNAPBACK}>

Which validator are you using?

<{POST_SNAPBACK}>

XMLSpy Home Edition 2006

<{POST_SNAPBACK}>

OK, I'm not familar with that tool.
The change I made to research.xsd was very simple. The line
<xsd:element name="time" type="xsd:positiveInteger" />
was changed to
<xsd:element name="time" type="xsd:nonNegativeInteger" />

The difference being xsd:positiveInteger doesn't include zero, but xsd:nonNegativeInteger does.

ref:
http://books.xmlsche...ch19-77247.html

Suggestions.
1. Check the .xsd file itself, possibly I sent you the wrong one.
2. Is it possible you have multiple copies of the .xsd file on your PC, and you're validating against an older one?

<{POST_SNAPBACK}>

I am using the xml file from the repository, so they are all the latest ones (unless you haven't commited it yet?)

#36 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 01 December 2005 - 05:56 PM

The xml validator does not allow me to set time 0.

<{POST_SNAPBACK}>

Which validator are you using?

<{POST_SNAPBACK}>

XMLSpy Home Edition 2006

<{POST_SNAPBACK}>

OK, I'm not familar with that tool.
The change I made to research.xsd was very simple. The line
<xsd:element name="time" type="xsd:positiveInteger" />
was changed to
<xsd:element name="time" type="xsd:nonNegativeInteger" />

The difference being xsd:positiveInteger doesn't include zero, but xsd:nonNegativeInteger does.

ref:
http://books.xmlsche...ch19-77247.html

Suggestions.
1. Check the .xsd file itself, possibly I sent you the wrong one.
2. Is it possible you have multiple copies of the .xsd file on your PC, and you're validating against an older one?

<{POST_SNAPBACK}>

I am using the xml file from the repository, so they are all the latest ones (unless you haven't commited it yet?)

<{POST_SNAPBACK}>

No, I had not committed it. I was expecting you to do that, along with the updated results.xml file.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#37 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 01 December 2005 - 05:57 PM

No, I had not committed it.  I was expecting you to do that, along with the updated results.xml file.

<{POST_SNAPBACK}>

Sorry, meant research.xml file.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#38 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 01 December 2005 - 07:11 PM

No, I had not committed it.  I was expecting you to do that, along with the updated results.xml file.

<{POST_SNAPBACK}>

Sorry, meant research.xml file.

<{POST_SNAPBACK}>

I don't know how to change an xsd file, don't even know what it is or what to do with it, I only play with xmls.

#39 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 01 December 2005 - 07:19 PM

No, I had not committed it.  I was expecting you to do that, along with the updated results.xml file.

<{POST_SNAPBACK}>

Sorry, meant research.xml file.

<{POST_SNAPBACK}>

I don't know how to change an xsd file, don't even know what it is or what to do with it, I only play with xmls.

<{POST_SNAPBACK}>

You shouldn't need to change the research.xsd file I sent you, just overwrite the research.xsd only your system with it, and check it in with your updated research.xml (they both live in the same directory in the xenocide repository.)

FYI. xsd files are just xml files that specify the restrictions on a xml file. If you want to edit a .xsd file, easiest way I find is add .xml to end of the .xsd, then open it with your favourite .xml editor.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#40 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 01 December 2005 - 07:32 PM

No, I had not committed it.  I was expecting you to do that, along with the updated results.xml file.

<{POST_SNAPBACK}>

Sorry, meant research.xml file.

<{POST_SNAPBACK}>

I don't know how to change an xsd file, don't even know what it is or what to do with it, I only play with xmls.

<{POST_SNAPBACK}>

You shouldn't need to change the research.xsd file I sent you, just overwrite the research.xsd only your system with it, and check it in with your updated research.xml (they both live in the same directory in the xenocide repository.)

FYI. xsd files are just xml files that specify the restrictions on a xml file. If you want to edit a .xsd file, easiest way I find is add .xml to end of the .xsd, then open it with your favourite .xml editor.

<{POST_SNAPBACK}>

You didn't send me anything.

edit: Nevermind, I edited research.xsd the way you told me, now accepting 0 as research time, and updated research.xml fixing a few inconsistencies, unfortunately I don't have the time to give it a proper look, will try to do it tomorrow, should you find any more errors, please let me know.

Edited by Azrael, 01 December 2005 - 08:45 PM.


#41 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 01 December 2005 - 09:56 PM

You didn't send me anything.

edit: Nevermind, I edited research.xsd the way you told me, now accepting 0 as research time, and updated research.xml fixing a few inconsistencies, unfortunately I don't have the time to give it a proper look, will try to do it tomorrow, should you find any more errors, please let me know.

<{POST_SNAPBACK}>

You are quite correct. It's an attachment to post #17 on this thread.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#42 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 20 December 2005 - 04:10 AM

Just had a thought, many of the base facilities primary function is to increase a capacity of one type or another.
e.g. alien containment, barracks, landing pad, storeroom, lab, workshop, etc.
Therefore, idea is have them inherit from a common base class “Capacity facility”, and they specify the type of capacity they increase.

We then change the Capacity Info so that it tracks the type of a capacity, as well as the quantity.

E.g.
Class CapacityInfo
{
public:
	enum CapacityTypes
{
	aliens,
  personnel,
	equipment,
	craft
};

void changeCapacity(CapacityType type, int quantity)
{
    capacities.find(type)->second += quantity;
}

int getCapacity(CapacityType)
{
	return capacities.find(type)->second;
}

private:
	::std::map<CapacityType, int> capacities
}
This should allow simplification of Facilities code.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#43 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 20 December 2005 - 10:56 AM

Yeap, fine for me :)
(i know that current facility handling code is quite strange :) )
Posted Image

#44 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1,479 posts

Posted 29 December 2006 - 07:28 PM

Facility Class(es) design.

OK, here’s my plan for how we do facilities. Your input is requested. Once this is agreed, then I think these notes should be put into the design document, because they’re a work of genius.

In the current design, there are 17 unique facilities, which can be grouped into 4 classes, which I have named:

  • Storage
  • Scan
  • Defence
  • Unique
Storage Facilities
In simple terms, these increase the quantity of some “material” that can be “stored” in a base. The “storage” facilities are:
  • Landing Pad
  • Barracks Facility
  • Xenomorph Holding Facility
  • Storage Facility
  • Psionic Training Facility
  • Research Facility
  • Engineering Facility
Notes on storage type
  • Some people might wonder why the Psionic Training, Research and Engineering facilities are on this list. Well, the Research Facility increases the number of “working scientists” that a base can hold.
  • The easiest way to model these facilities is to give the base a “capacity” for each types of “material”. Then when a facility is constructed the relevant base’s “capacity” is increased. (And decreased when the facility is destroyed.)
  • A facility can’t be destroyed if it’s in use. As the “material” is owned by the base, not a facility, test is checking if destruction of the facility would reduce the base’s “capacity” below the level currently present in the base.
  • Beyond needing to know when a facility finishes being built, the facility does not change over time. It doesn’t need to implement update(gametime).
  • What about start/end of month Psi training? Answer, that’s not the responsibility of the Facility. That’s done in the “start of month” processing. (Aside, it’s probably easier to work with “start of month”, because “end of month” varies depending on the month.)
  • What about research projects? Answer, the research manager is responsible for tracking them, not the facility.
Scan Facilities
These detect UFOs. The “scan” facilities are:
  • Short Range Neudar
  • Long Range Neudar
  • Tachyon Emissions Detector
Notes on scan type
  • These facilities do need to implement an update(gametime) function, because they need to check each “time period” to see if they’ve detected any UFOs.
  • In X-COM, despite what Ufopedia says, having more than one of each type of Neudar in a base doesn’t help. So, we will not allow a base to have more than one of each type of scan facility.
Defence Facilities
These facilities shoot at UFOs when UFOs try to attack a base. The defence facilities are:
  • Missile Defence Array
  • Laser Defence Array
  • Plasma Defence Array
  • GAIA Defence Array
Notes on defence type
  • These facilities only come into play when a UFO is attacking the base and gets into range.
  • When the attacking UFO gets into range, then each facility gets to take one shot at the UFO. (Or 2 shots if a Gravity Shield is present in the base.)
  • So, defence facilities don’t need to update their state with an update(gametime). They’re just called as part of the sequence for an “Alien Attack on X-Corp” base.
Unique Facilities
These are facilities that don’t belong to a class. That is, each one is unique, with no other facility like it. The unique facilities are:
  • Base Access Facility
  • Gravity Shield Facility
  • Neural Shielding Facility
Notes on these types
  • Base Access Facility: Every base must have one, and only one, of these. It must be the first facility that is built when a base is constructed, and is the core around which all other facilities are constructed. Beyond this, it adds nothing.
  • Gravity Shield Facility : A base can have no more than one of these. If one is present, then each defence facility gets to twice at attacking UFOs. So no update() function is needed, we just check to see if base has one of these as part of an “Alien Attack on X-Corp”.
  • Neural Shielding Facility : <todo>check: A base can have no more than one of these.</todo> Reduces the “visibility” of a base. So needs to be called when we calculate a base’s “visibility”. Again, no update() function is needed.
Common Facility Behaviour
  • Build cost
  • Build time
  • Size
  • canBuild(Base& base)
  • canDestroy(Base& base)
  • onfinishedBuilding(Base& base)
  • onDestroy(Base& base)
I’d propose the following set of classes for hooking facilities to bases.
(UML diagram attached, note that it doesn’t show member functions nor all attributes for classes.)
The basic idea is that the FacilityInfo classes are flyweights, holding the “class properties” (build cost, size, etc.) and functionality, but not the instance data. Actual instances of facilities are represented by the FacilityHandle class. Which holds build state.
The Base class owns a FloorPlan and a Capacities.
The FloorPlan is responsible for managing the FacilityHandles. Really, it just keeps track of the position of the facilities in the base (probably in an array) and their build state. (As you can guess, I haven’t quite figured out the exact division of responsibility between FacilityHandle and FloorPlan classes.) For performance reasons, the FloorPlan will probably also hold a list of “updateable” facilities. That is, facilities that need to get called on an update(game time). Currently it’s only the scan facilities, but it might be others later.
The Capacities is responsible for tracking the “storage capacities” granted by the facilities. As discussed above in Storage Facilities.

Attached Files


Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#45 reist

reist

    Programming Department

  • Xenocide Programming Department
  • 130 posts

Posted 31 December 2006 - 11:22 AM

Facility Class(es) design.

OK, here’s my plan for how we do facilities. Your input is requested. Once this is agreed, then I think these notes should be put into the design document, because they’re a work of genius.

Looks like a solid, thought through design.
I vote for the genius notes =b

#46 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3,310 posts

Posted 03 January 2007 - 09:53 AM

Indeed, go for it. Add your facility notes to the design document, they are solid too.

Greetings
Red Knight
Sourceforge Nick: flois - Federico Andres Lois
Visit my blog at: flois.blogspot.com

Posted Image

Pookie cover me, I am going in.

#47 Pi Masta

Pi Masta

    Sergeant

  • Xenocide Recruit
  • 68 posts

Posted 04 January 2007 - 12:34 PM

This looks really great.

I have one tiny suggestion for this issue:

For performance reasons, the FloorPlan will probably also hold a list of “updateable” facilities. That is, facilities that need to get called on an update(game time). Currently it’s only the scan facilities, but it might be others later.

What about making an 'UpdatableFacility' that has to implement an update function? Then have scan facilities use them as the base class. Then when we need a list of facilities to be updated we just check if they are children of this 'UpdatableFacility' class. If we need more facility types to be updated, we just use this class.

Here's a rough sketch of what I'm talking about to hopefully clarify.
-[FacilityInfo]
  -[UpdatableFacility]
	-[ScanFacilityInfo]
	-...Other facilities if needed...
  -[StorageFacilityInfo]
  -[DefenseFacilityInfo]
  -[UniqueFacilityInfo]

I think we need to come up with shorter name than 'UpdateableFacility', maybe 'UpdatedFacility'?

Just throwing an idea out.

#48 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3,310 posts

Posted 05 January 2007 - 05:00 PM

My take is: "Dont worry about performance in this".

Greetings
Red Knight
Sourceforge Nick: flois - Federico Andres Lois
Visit my blog at: flois.blogspot.com

Posted Image

Pookie cover me, I am going in.