Jump to content


Photo

Microsoft Xna


  • Please log in to reply
212 replies to this topic

#51 Guest_Azrael_*

Guest_Azrael_*
  • Guests

Posted 19 February 2007 - 02:11 PM

So, all the work in Python was wasted effort?

#52 Zombie

Zombie

    Colonel

  • Xenocide Creative-Text Departmen
  • 2947 posts

Posted 19 February 2007 - 02:16 PM

Lookin' good deviot! :)

Since I have some time now, I contacted Mad and he agreed to let me work on the lat/long issue for you. I started on it this morning by using mapquest to get a city near a border, then looking up the lat/long coordinates of the city on an online database. The particular database I used doesn't get down into the seconds (as do almost all databases: cities are just too wide to narrow down to a single point on the globe). Accuracy is thus limited to +/- 1 minute of latitude (1852 meters) while the longitude accuracy is variable (nearly correct at arctic latitudes while worse at equatorial latitudes). This gave four points on a country. However, you asked for a single line of latitude/longitude for the borders.

Problem is that all countries have irregular borders. To me, it would be almost better to go with 4 points as this setup is now trapezodial instead of rectangular. You would get better accuracy with this method, but you would also need to use some algebra to determine where to place a crash/landing site within the country. Suppose 4 lines are the best we can do for now. For most countries, I'm going to take the average of the two lines to approximate a border. So for the north border, I'll take the NW corner and NE corner latitude lines and average them. For a west border I'll take the NW and SW longitude lines and average them together.

I guess that in the case of Canada, the 66th parallel (Arctic Circle) is fine for a northern border as there isn't much land above this. In the case of the US, the 49th parallel will work fine as a northern border. How are we going to handle Alaska and Hawaii? Leave them out?

- Zombie
The Mr. Grognard of X-COM

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!


#53 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 19 February 2007 - 10:34 PM

So, all the work in Python was wasted effort?

I don't believe it was a waste.
At the very least, we did figure out how to solve some problems.
And at the time the decision was made, it did look like a good idea. It's just there were additional complications we didn't anticipate.


Lookin' good deviot! :)

Since I have some time now, I contacted Mad and he agreed to let me work on the lat/long issue for you. I started on it this morning by using mapquest to get a city near a border, then looking up the lat/long coordinates of the city on an online database. The particular database I used doesn't get down into the seconds (as do almost all databases: cities are just too wide to narrow down to a single point on the globe). Accuracy is thus limited to +/- 1 minute of latitude (1852 meters) while the longitude accuracy is variable (nearly correct at arctic latitudes while worse at equatorial latitudes). This gave four points on a country. However, you asked for a single line of latitude/longitude for the borders.

Problem is that all countries have irregular borders. To me, it would be almost better to go with 4 points as this setup is now trapezodial instead of rectangular. You would get better accuracy with this method, but you would also need to use some algebra to determine where to place a crash/landing site within the country. Suppose 4 lines are the best we can do for now. For most countries, I'm going to take the average of the two lines to approximate a border. So for the north border, I'll take the NW corner and NE corner latitude lines and average them. For a west border I'll take the NW and SW longitude lines and average them together.

I guess that in the case of Canada, the 66th parallel (Arctic Circle) is fine for a northern border as there isn't much land above this. In the case of the US, the 49th parallel will work fine as a northern border.

If a single rect doesn’t work very well for describing the country, then you can use up to 4.
I realise this makes your skin crawl, but high precision isn't needed for this task. All I need is that when the AI chooses a country as a target, I can get random coordinates that are _IN_ the country.

However, if you want to figure out an alternate data structure (and associated code) that given the name of a country returns a random location inside the country, feel free to implement.

As I said before, I'm just looking for a minimum effort, "good enough" solution. That we may replace later, if the effort is justified.

How are we going to handle Alaska and Hawaii? Leave them out?

Personally, I'd leave Hawaii out, based on it's relative size.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#54 Zombie

Zombie

    Colonel

  • Xenocide Creative-Text Departmen
  • 2947 posts

Posted 20 February 2007 - 12:18 AM

If a single rect doesn’t work very well for describing the country, then you can use up to 4.
I realise this makes your skin crawl, but high precision isn't needed for this task. All I need is that when the AI chooses a country as a target, I can get random coordinates that are _IN_ the country.

However, if you want to figure out an alternate data structure (and associated code) that given the name of a country returns a random location inside the country, feel free to implement.

As I said before, I'm just looking for a minimum effort, "good enough" solution. That we may replace later, if the effort is justified.

Ah, I get it now. Yeah, 4 rectangles are certainly better for determining irregular borders. That will help.

No, the precision thing doesn't make my skin crawl. But I'm just trying to envision that with questionable accuracy, a UFO could theoretically be sent to a place inside a country, but not on land. I can see the water issue becoming a real hassle unless it's clearly defined somewhere. Any ideas how we should handle this? A pixilated map of some sorts? I mean, a pixilated map would define water, land and terrain type all in one package. It also guarantees complete accuracy. The problem is that it would be a huge project to create it. That certainly doesn't fit your "minimum effort, good enough solution". :)

- Zombie
The Mr. Grognard of X-COM

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!


#55 Pi Masta

Pi Masta

    Sergeant

  • Xenocide Recruit
  • 68 posts

Posted 20 February 2007 - 12:47 AM

Any ideas how we should handle this? A pixilated map of some sorts? I mean, a pixilated map would define water, land and terrain type all in one package. It also guarantees complete accuracy. The problem is that it would be a huge project to create it.


*Cough* I do have a map file that has all the countries in polygon form. And I do mean ALL countries. If you want/need me to format it I'm sure I could whip something up. *Cough*

It's a no hassle solution when you make the computer do the heavy work for ya! :D

*Cough*

Hrmm... somehow my cold has spread onto the forums.... sorry guys... :D

#56 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 20 February 2007 - 01:07 PM

a UFO could theoretically be sent to a place inside a country, but not on land. I can see the water issue becoming a real hassle unless it's clearly defined somewhere. Any ideas how we should handle this?

The simplest method would be setting up the rectangles to not include any ocean. (Although it could be argued if it's close to the shore, then the UFO has landed on a small offshore island.)

I do have a map file that has all the countries in polygon form. And I do mean ALL countries. If you want/need me to format it I'm sure I could whip something up.
It's a no hassle solution when you make the computer do the heavy work for ya! :D

Having all 130 odd countries, while nice in theory, would require re-designing the "alien activity statistics" screen. Probably need some sort of agragate/drill down capability. I also suspect it would require Alien AI enhancements as well.
So, in order to keep things as simple as possible at this stage, I'd prefer to stay with the list of countries I've already given.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#57 Pi Masta

Pi Masta

    Sergeant

  • Xenocide Recruit
  • 68 posts

Posted 20 February 2007 - 01:48 PM

Having all 130 odd countries, while nice in theory, would require re-designing the "alien activity statistics" screen. Probably need some sort of agragate/drill down capability. I also suspect it would require Alien AI enhancements as well.
So, in order to keep things as simple as possible at this stage, I'd prefer to stay with the list of countries I've already given.


Shouldn't be too difficult to merge the other countries with the ones we want. I'll see what I can do, I have an idea to reduce the number of points for each polygon as well.

#58 Mad

Mad

    Creative Text Department

  • [Xenocide Senior Members]
  • 1958 posts

Posted 20 February 2007 - 01:50 PM

Having all 130 odd countries, while nice in theory, would require re-designing the "alien activity statistics" screen. Probably need some sort of agragate/drill down capability. I also suspect it would require Alien AI enhancements as well.
So, in order to keep things as simple as possible at this stage, I'd prefer to stay with the list of countries I've already given.

I'm not sure, but couldn't you just ignore the other countries for the time being?
Keep smiling while dying

Of course I have gone mad with power! It would be completely ridiculous to go mad without power!
And no, this is not a quote from the Simpson's movie, I want it on paper, that I actually wrote that quite some time before the movie came out.

Posted Image

#59 SupSuper

SupSuper

    Programming Department

  • Xenocide Programming Department
  • 2418 posts

Posted 20 February 2007 - 05:38 PM

And smithe us foreigners? :P

too bad, now you will never know the ancient secrets of supsupers long gone avatar ;)

Posted Image

Posted Image

#60 Darkhomb

Darkhomb

    Captain

  • Xenocide Artwork Department
  • 628 posts

Posted 20 February 2007 - 06:19 PM

this mean your back programing?

#61 Zombie

Zombie

    Colonel

  • Xenocide Creative-Text Departmen
  • 2947 posts

Posted 20 February 2007 - 08:26 PM

I'm not sure, but couldn't you just ignore the other countries for the time being?

Couldn't we just flag the countries which are contributors to the project? In post V1.0 we might decide to add more countries and this way we could just turn the flag on and the country would contribute. ;)

- Zombie
The Mr. Grognard of X-COM

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!


#62 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 20 February 2007 - 08:57 PM

I'm not sure, but couldn't you just ignore the other countries for the time being?

Couldn't we just flag the countries which are contributors to the project? In post V1.0 we might decide to add more countries and this way we could just turn the flag on and the country would contribute. ;)

- Zombie

Certainly doable.
The idea is that each country has an entry in the planet.xml file.
So, we could add as many countries as we like to that file, and just comment out the ones we don't want for v1.0
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#63 Pi Masta

Pi Masta

    Sergeant

  • Xenocide Recruit
  • 68 posts

Posted 20 February 2007 - 10:20 PM

What's wrong with polygons?

If you need to get a random point inside of the polygon it's not too difficult. I've posted in the other thread how to determine if a point is in a polygon. Simply we determine the bounding box which is just finding the max and min of all x and y coords. Grab a random point in that box and check if it's in the polygon. A bit brute force but works good with the polygons we'll be using.

I'm going to try and get some examples of the 16 countries with low point counts. Main problem is Canada with all the islands near the pole (so yes.. blame Canada! :devillaugh:)

#64 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 22 February 2007 - 03:11 AM

Well, here’s my first draft at explaining how the AI and craft classes work.
Comments, questions or other feedback (so I can improve the docs) would be greatly appreciated.

I’ll also point out that the Overmind and InvasionTasks are currently just stubs.
The Overmind just spawns a ResearchTask, and the research task just spawns a UFO at a random geopositon, with a randomly targeted ResearchMission. When the UFO finishes its mission, the ResearchTask just repeats the exercise.

So if anyone wants to improve the ResearchTask, or implement the other major Tasks/UFO missions feel free.

To be fair, I’d suggest implementing the “search for X-Corp base” is the only other major UFO mission at the moment. (Supply Base & Attack X-Corp Bases) are really just variants of the UFO ResearchMission.

Likewise, for “Human” Missions, I’ve only (partially) implemented the intercept mission. I believe the others are:
  • Patrol
  • Go to Alien Activity Site (UFO landing/crash/Terror Mission/Alien Base)
  • Return to Base

Overview of how the AI and craft classes work.
Refer to attached diagram (AIandCraftClasses.png)

The GeoData class is the root node. Every frame it’s Update() function is called, with the amount of time the game’s state is to be advanced by. The GeoData delegates the the Update() to the items it contains. Currently these are a list of HumanBases, and the Alien “Overmind”. (And these subsequently delegate to their contained items, and so on.)

Conceptually, the Alien AI is made up of 3 layers.

  • Overmind
  • InvasionTask
  • Craft
Overmind
This layer will be responsible for the big picture planning. That is deciding on the sorts of missions to undertake. E.g. deciding to try and harvest a country, Undertake offensive missions against X-Corp because the humans are getting annoying, Creating Bases, etc.
The Overmind owns a number of InvasionTasks

InvasionTask
Is responsible for a mission, or set of missions, that may involve one or more UFOs.
It’s job is synchronization of behaviour between multiple UFOs.
E.g. In X-COM, a “retaliation task”, is made up of a number of UFO missions, a number of scouting missions to find the base. Followed by a series of attacks on the base which attempt to destroy it. (If the scouting missions fail, the attack missions won’t be launched.)
Likewise, a “research task” in X-COM is made up of a number of separate UFO research missions, with days or weeks separating each of the missions.
The InvasionTask will have a number of derived classes, one for each different type of mission.
The InvasionTask owns the UFOs that are currently “live” on the Geoscape

Craft
Each craft has its own “autonomous” AI. The AI is implemented as a 2 level Hierachial Finite State Machine (HFSM). The HFSM is built by the classes Mission MissionState, and their derived classes.

How this works is a bit hard to explain. It’s probably easier to give an example.
Consider the case of an intercept mission. In the simplest form, the mission can be thought of as:
  • Aircraft waits in a hanger (being refuelled, repaired, reloaded etc.)
  • Aircraft is launched, and tries to intercept a UFO.
  • When the aircraft reaches the UFO, the UFO is shot down
  • The aircraft flies back to its base.
  • Aircraft waits in a hanger (being refuelled, repaired, reloaded etc.)
From this, you can see that the aircraft has 3 “states” during the mission:
  • InBase
  • Intercepting
  • ReturningToBase
In each of these states, the craft’s behaviour is different, and the craft transitions from state to state when an “event” occurs. Also note, other events can occur and cause other state transitions. For example, if the aircraft runs short on fuel while in the “Intercepting” state, it must return to base. However, if the craft is in the “ReturningToBase” state when fuel is low, then the event can be ignored.

Thus, the update() method of the “MissionState” classes implements the behaviour of each state. The MissionState also implements the ICraftEvents interface, which provides a virtual function that is called for each “event” that may generate a state transition. Thus, if a state needs to implement behaviour in response to an event, the derived class just needs to override the appropriate virtual function.

Thus, we could build the missions by deriving a class from MissionState for each state of each mission type. (Which might result in a lot of very similar mission states and replicated code if some mission states had very similar behaviour.)

To reduce this, the “Mission” class exists:
  • It allows us to reuse a mission state in multiple missions (e.g. MoveToPostionState can be used in a Research mission, where a UFO needs to move between random locations on the globe, and in intercept missions, when the craft is returning to base.)
  • It allows us to put code that may be common to all states in one place. E.g. If OnCraftDestroyed() does the same thing for every state in a mission, then we can put it’s behaviour in OnCraftDestroyed() in the Mission, rather than each MissionState.

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.

#65 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 03 March 2007 - 11:24 PM

progress update:

1. MessageBox implemented.
You can see a messagebox if you let the aircraft run low on fuel, or the UFO escapes.

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

#66 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 10 March 2007 - 11:55 PM

progress update:

Geoscape behaviour.
1. UFO is repeatedly spawned (with 6 hour intervals) on research like mission.
2. If right click mouse, Geosceen will pan with mouse movement. (Stops when right click again.)
3. Intercept button - launches interceptor at UFO.
4. If reaches UFO, UFO "crashes"
5. If Intercept crashed UFO, "battlescape mission"
6. If don't intercept a second time, after 12 hours UFO "repairs" itself and flys away.
7. If UFO escapes, get "Patrol/Return to Base/Go to UFOs last known position" dialog
8. If craft runs low on fuel, returns to base.
9. Interceptor refuels when in base.
10. Left clicking on the geoscape sends interceptor to "patrol" the indicated position.

Geoscape Stuff that hasn't been implemented yet.
1. Radar detection/visibility
2. Click on position on Geoscape to select craft/UFO/Base etc.
3. Waypoints are not shown on Geoscape.
4. Create Base.
5. Multiple bases. (Although in principle, not difficult)
6. Multiple simultateous UFOs (Although in principle, not difficult)
7. Multiple Interceptors(Although in principle, not difficult)
8. Intercept dialog
9. Multiple UFO mission types. (Not much point, at moment, current mission is ideal for testing)
10. Multiple craft/ufo types.
11. UFO target selection (for UFO missions) doesn't know about countries.

Question: after an aeroscape battle what is criteria for selecting "crash landing" as opposed to "vapourised"

Observation:
In X-Com human craft have only two missions:
1) Patrol
2) Intercept

And four "states"
1) Patrolling
2) Intercepting
3) Returning to base
4) In Base


At any rate, I believe the current Geoscape works sufficiently well that I can claim I've at least replicated the X-COM craft AI.
And so I'm going to claim Iteration 2 of roadmap (post 19 of this thread) done.

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

#67 Mad

Mad

    Creative Text Department

  • [Xenocide Senior Members]
  • 1958 posts

Posted 11 March 2007 - 03:56 AM

Very nicely done! However, some observations:

- Dialoges seem to appear twice (read: clicking "OK" on the first "aeroscape dialoge" spawns a second, same for "Battlescape dialoge")
- Game reproductively crashes when loading a game and then left-clicking on globe. Errormessage: "'System.ArgumentOutOfRangeException' in Xenocide.exe"

As for the vaporized/downed issue: I don't know, but I would suggest X-COM is using a hitpoint system. If remaining UFO hitpoints are lower than those the fired shot would take, UFO is destroyed, if remaining hitpoints are higher than the amount which would be taken away, the UFO either continues flying or downs, depending on the crossing of another craft-type specific hitpoint threshold (which of course for most UFOs is substantialy higher than the "destroyed threshold". The "downed" threshold presumably is splitted in multiple thresholds relatively close together, determining if the reactor blows up or not.

Edited by Mad, 11 March 2007 - 04:04 AM.

Keep smiling while dying

Of course I have gone mad with power! It would be completely ridiculous to go mad without power!
And no, this is not a quote from the Simpson's movie, I want it on paper, that I actually wrote that quite some time before the movie came out.

Posted Image

#68 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 11 March 2007 - 11:26 PM

- Dialogs seem to appear twice (read: clicking "OK" on the first "aeroscape dialog" spawns a second, same for "Battlescape dialog")

Fixed. Sorry about that. I should add, if UFO is on ground when craft reaches it, aeroscape is skipped, and we go straight to battlescape.

- Game reproductively crashes when loading a game and then left-clicking on globe. Errormessage: "'System.ArgumentOutOfRangeException' in Xenocide.exe"

That's probably because the Load/Save screen didn't do anything. (Its was pure GUI, with no actual load/save of game state.)
I've now updated the screen so that it:
1. Will create "save game" files when you hit save.
2. The save game files have header information (game time and real time.)
3. When dialog is opened will reads the saved game files and populates the grid with with header information.
However, it doesn't yet save or load the actual game state.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#69 Darkhomb

Darkhomb

    Captain

  • Xenocide Artwork Department
  • 628 posts

Posted 12 March 2007 - 06:06 PM

I believe in the orig when you came to a grounded ship it did not go straight to batlescape but asked if you wanted to land or return to base (or something similar).

#70 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 12 March 2007 - 06:29 PM

I believe in the orig when you came to a grounded ship it did not go straight to batlescape but asked if you wanted to land or return to base (or something similar).

At this point in time, I see no significant difference between a dialog that asks
"Do you want to land or return to base"
and one that says
"This is UFO crash recovery screen, where you get the chance to begin a battlescape mission. However, as that's not implemented yet, click OK and code will pretend the battlescape was successful"
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#71 Darkhomb

Darkhomb

    Captain

  • Xenocide Artwork Department
  • 628 posts

Posted 13 March 2007 - 05:42 AM


I believe in the orig when you came to a grounded ship it did not go straight to batlescape but asked if you wanted to land or return to base (or something similar).

At this point in time, I see no significant difference between a dialog that asks
"Do you want to land or return to base"
and one that says
"This is UFO crash recovery screen, where you get the chance to begin a battlescape mission. However, as that's not implemented yet, click OK and code will pretend the battlescape was successful"



No I just meant for actual gameplay, just wanted to throw that in there

#72 reist

reist

    Programming Department

  • Xenocide Programming Department
  • 130 posts

Posted 16 March 2007 - 02:59 PM

Well, here’s my first draft at explaining how the AI and craft classes work.
Comments, questions or other feedback (so I can improve the docs) would be greatly appreciated.

Looks pretty good.
If implementing it in C++/python, can the data be stored on the C++ side and AI on the python side?
I don't see much data, except for AI-related in the class model.

#73 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 19 March 2007 - 01:44 PM


Well, here’s my first draft at explaining how the AI and craft classes work.
Comments, questions or other feedback (so I can improve the docs) would be greatly appreciated.

Looks pretty good.
If implementing it in C++/python, can the data be stored on the C++ side and AI on the python side?
I don't see much data, except for AI-related in the class model.

Correct, most of the classes don't have much data. If you look at the implemented objects, the data for most of them is their "child" objects. And the state object generally have a "target" and "current speed" as their only data members.
The most "data heavy" class is craft, for some reason. :)

As regards implementing in C++/Python. Yes it could be done that way, but I suspect it would be a lot of work.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#74 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 19 March 2007 - 01:50 PM

Progress:
I got load/save game working over the weekend, but have been unable to check in the code. There's some problem with subversion.
And Red Knight has been working on research.

Review:
I've been working on this for 2 months now, and have completed the first two iterations on the plan. (Well, I'm going to claim them as done anyway.) So progress looks to be about 1 month per iteration. Thats the good news. The bad news: I've just aquired copies of "Supreme Commander" and "UFO:Afterlight", so there's probably going to be a slow down in my output for a couple of months.

Edited by dteviot, 19 March 2007 - 01:50 PM.

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

#75 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 19 March 2007 - 05:14 PM

What can I say, it looks promising...

Keep the good work.

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.

#76 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 20 March 2007 - 01:51 PM

Red Knight.

Firstly, thanks for your work on Research. However, I'd like to make a couple of suggestions.
  • Please document your work. (I've taken the liberty of writing up some notes, which follow but free to add your own. They're at post #81 of the research thread. http://www.xcomufo.c...h...4476&st=81#
  • Random number generator. OneOfGrant.Grant() has its own random number generator. This can make getting repeatable tests difficult. In order to minimize these sort of issue, I've put a single RNG into the GameState class, that everything should use. (I'm planning on moving it into the Xenocide class, but we should probably discuss this further.)
  • Location of research files. As mentioned before, Xenocide/Source/Research isn't the correct place for these files. At minimum they should be in Xenocide/Source/Model/Research. Yes, I know you said I could move them, but they're your files. Also, I'm not quite sure where to put them. I think the issue is research is made up of at least 3 parts.
  • The research tree itself. (That is, the contents of the XML file.)
  • Research projects manager. (That is projects currently being researched.)
  • Technology manager – the technologies that have been researched.
So, the Tree could be placed under Xenocide/Source/Model/StaticData/Research (along with things like items, facilities, combatants, etc.) While the projects and technology managers would be in model/geoscape/research.
However, there's also the possibility of putting it all under model/geoscape/research. While the tech manager is used in battlescape to say if an X-Corp soldier is able to use a recovered weapon/item, that's about it. Almost all the other uses are in the geoscape.
Again, this is something I'd like to discuss.
edit - fixed hyperlink

Edited by dteviot, 20 March 2007 - 02:03 PM.

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

#77 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 20 March 2007 - 04:17 PM

[*]Please document your work. (I've taken the liberty of writing up some notes, which follow but free to add your own. They're at post #81 of the research thread.

I know, consider that still work in progress I am still trying to grasp how the Research Tree would behave Interface wide; that is why I went ahead and wrote the NUnit tests, it help me to design from a user/developer perspective. Currently the ResearchTree is just the "static" representation of the state with minimal interaction with the game (call it an extended description with the ability to interact with the model with Grants and Prerequisites only). Projects are not even planned yet. I am thinking that the Research Tree may be able to expose Available Projects but have still to see if that works out. However, I have to load a Research Tree structure first.

[*]Random number generator. OneOfGrant.Grant() has its own random number generator. This can make getting repeatable tests difficult. In order to minimize these sort of issue, I've put a single RNG into the GameState class, that everything should use. (I'm planning on moving it into the Xenocide class, but we should probably discuss this further.)

Noted, and furthermore using a Random object from every object is not the right thing in simulation code, but I wanted to keep it isolated for now so I do not mix code as the research tree wasnt in a inmediate iteration.

Location of research files. As mentioned before, Xenocide/Source/Research isn't the correct place for these files. At minimum they should be in Xenocide/Source/Model/Research. Yes, I know you said I could move them, but they're your files. Also, I'm not quite sure where to put them. I think the issue is research is made up of at least 3 parts.

Those arent my files, those are project files. Do what you have to do with them :), dont be afraid to enforce model rules. On the place, I am not quite sure where to put them either though. Lets do the following let it there I can move them arround and refactor in a couple of minutes in the companies Visual Studio ;) so when things get bigger we move them arround having a better picture of what we want.

[*]The research tree itself. (That is, the contents of the XML file.)

The research tree and their technology links will be generated in a preprocessing step in the Content Pipeline so you will eventually do:
ContentManager manager = new ContentManager ( this );
ResearchTree researchTree = manager.Load<ResearchTree> ( "ResearchTree" );
And we will add all the required tests there so they are not done at runtime, but on building itself.

So, the Tree could be placed under Xenocide/Source/Model/StaticData/Research (along with things like items, facilities, combatants, etc.) While the projects and technology managers would be in model/geoscape/research.
However, there's also the possibility of putting it all under model/geoscape/research. While the tech manager is used in battlescape to say if an X-Corp soldier is able to use a recovered weapon/item, that's about it. Almost all the other uses are in the geoscape.
Again, this is something I'd like to discuss.

Still do not have a clue how that could be implemented given that there are a lot of things to define in previous iterations yet, but I am in the process of prototyping a solution to see if it works out. So when I have some idea on how that would tie in the whole I will write about it. We can start to flesh out the requirements for that in the meanwhile.

BTW, the notes were amazingly detailed; thanks for it.

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.

#78 UnFleshed One

UnFleshed One

    Programming Department

  • Xenocide Inactive
  • 304 posts

Posted 20 March 2007 - 09:02 PM

I glanced over the code a bit and noticed that aircraft are refueling/repairing/etc themselves.

I think the base or one of its facilities should handle that, since it will own all the information (amount of fuel, ammo and the like), not craft.

So InBaseState.updateState should call
this.humanBase.ServiceCraft(Mission.Craft, milliseconds)
instead of
this.Mission.Craft.Refuel/Reload/Repair/Rearm(milliseconds).

And craft should still have Refuel method, but take in amount of fuel, not time.

(Unless I got things/missions/states relations backwards :)).
(Otherwise looks pretty promising, I'm still yet to look into XNA itself though :)).
(No I'm not back, I'm visiting :))

Edited by UnFleshed One, 20 March 2007 - 09:16 PM.

Darkness is under the candle.

#79 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 20 March 2007 - 09:50 PM

[*]Please document your work. (I've taken the liberty of writing up some notes, which follow but free to add your own. They're at post #81 of the research thread.

I know, consider that still work in progress I am still trying to grasp how the Research Tree would behave Interface wide; that is why I went ahead and wrote the NUnit tests, it help me to design from a user/developer perspective. Currently the ResearchTree is just the "static" representation of the state with minimal interaction with the game (call it an extended description with the ability to interact with the model with Grants and Prerequisites only). Projects are not even planned yet. I am thinking that the Research Tree may be able to expose Available Projects but have still to see if that works out. However, I have to load a Research Tree structure first.

I'd point out that even if you're still working on the design it's good to have the requirements written down. As they say what the design needs to achieve, if not how it will do it.


Those arent my files, those are project files. Do what you have to do with them :), dont be afraid to enforce model rules. On the place, I am not quite sure where to put them either though. Lets do the following let it there I can move them arround and refactor in a couple of minutes in the companies Visual Studio ;) so when things get bigger we move them arround having a better picture of what we want.

Sorry, I'm not sure what you're saying. However, I'm happy if we leave the files where they are for the moment, and we move them to the approriate places when we figure out where that is.

Edited by dteviot, 20 March 2007 - 09:52 PM.

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

#80 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 20 March 2007 - 10:01 PM

I glanced over the code a bit and noticed that aircraft are refueling/repairing/etc themselves.

I think the base or one of its facilities should handle that, since it will own all the information (amount of fuel, ammo and the like), not craft.

So InBaseState.updateState should call
this.humanBase.ServiceCraft(Mission.Craft, milliseconds)
instead of
this.Mission.Craft.Refuel/Reload/Repair/Rearm(milliseconds).

And craft should still have Refuel method, but take in amount of fuel, not time.

(Unless I got things/missions/states relations backwards :)).
(Otherwise looks pretty promising, I'm still yet to look into XNA itself though :)).
(No I'm not back, I'm visiting :))

It's really just a point of view. Does the craft get resouces from the base, and put them into itself, or does the base put resources from itself into the craft?
From the base, it would need to interogate the craft for type of fuel, type of ammo, etc.
From the craft, it needs to check if the base has the fuel and ammo in stock that the craft uses.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#81 UnFleshed One

UnFleshed One

    Programming Department

  • Xenocide Inactive
  • 304 posts

Posted 20 March 2007 - 10:17 PM

It's really just a point of view. Does the craft get resouces from the base, and put them into itself, or does the base put resources from itself into the craft?
From the base, it would need to interogate the craft for type of fuel, type of ammo, etc.
From the craft, it needs to check if the base has the fuel and ammo in stock that the craft uses.


Hm, true... So it all depends on which way there is less info to pass around? :) Will base have direct interface for accessing it's resources then?

Edited by UnFleshed One, 20 March 2007 - 10:17 PM.

Darkness is under the candle.

#82 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 20 March 2007 - 10:21 PM

I'd point out that even if you're still working on the design it's good to have the requirements written down. As they say what the design needs to achieve, if not how it will do it.

The research tree is just a map of the data design (I even used the same names) maybe that its why I it sounds like I didnt wrote it down, it was designed already in the data and its respective thread (just took the data and mapped it into classes). I may have been carried too much in it (sorry for that :D) but well you corrected it already in this thread: http://www.xcomufo.c...h...24476&st=50. My next step is doing the code to parse the data required to create the Research Tree's nodes, no projects, or active things (we have already specified it)... after that requirements for "research project manager", "manufacturing" and before that "items system" have to be finished before of that (there is where I hit a "skipped iteration just in case I wasnt able to commit much work in this" kind of block). I will revisit the old items system's requirements and design just in case is it of use, as it was language independent; but probably it is of no use.

Sorry, I'm not sure what you're saying. However, I'm happy if we leave the files where they are for the moment, and we move them to the approriate places when we figure out where that is.

Reading it now, it is difficult even for me to understand it, I was at work at the time of writting it :D. Point is, refactoring tools in my companies Visual Studio are far better than in express edition ;) moving arround things both in directories and namespaces is a thing of 10 minutes max work. So lets move them, when we know where to do so.

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.

#83 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 20 March 2007 - 11:36 PM


It's really just a point of view. Does the craft get resouces from the base, and put them into itself, or does the base put resources from itself into the craft?
From the base, it would need to interogate the craft for type of fuel, type of ammo, etc.
From the craft, it needs to check if the base has the fuel and ammo in stock that the craft uses.


Hm, true... So it all depends on which way there is less info to pass around? :) Will base have direct interface for accessing it's resources then?

Probably. It's needed for Research & Manufacturing; to tell if an item is in the base, to meet prerequisites and removing the items as they're consumed by the projects.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#84 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 21 March 2007 - 10:01 AM

Exactly, probably after that is done the crafts wont refill themselves but the Hangar do it in its update. But anyway given that code is not designed yet the solution is good enough.

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.

#85 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 23 March 2007 - 05:04 PM

SVN is working again (Thanks MindstormMaster). Latest check-in:
1. Game state is now saved/loaded to save game files.
2. Camera movments in geoscape scaled based on camera's distance from planet. (Thanks to UnFleshedOne)
3. Mousewheel zooms camera in geoscape. Again, thanks to UnFleshedOne.
4. Swapping screens deferred until start of update() cycles.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#86 SupSuper

SupSuper

    Programming Department

  • Xenocide Programming Department
  • 2418 posts

Posted 24 March 2007 - 08:07 PM

Random pickyness: I don't like the redundancy of a pathname like "My Documents\SavedGames\XeNAcide\saves". :P Something like "My Documents\Xenocide\saves" should be enough.

too bad, now you will never know the ancient secrets of supsupers long gone avatar ;)

Posted Image

Posted Image

#87 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 25 March 2007 - 05:18 AM

Progress update
Now reads the xnet.xml file, and uses it to populate the menu of available entries, and the entry text.

Additional install instructions.
1. After building Xenocide, go to Xenocide/Bin/x86/Debug/Content directory
2. Create a sub directory "Schema"
3. Copy the contents of the Schema directory from the existing C++ Xenocide directory "xenocidegame/data/schema" to the new Schema directory
Mad, would you care to update your instructions?

Issues.
1. CeGui# doesn't provide vertical scroll ability for static text, nor does it have a multiline edit box. So, I've had to fake the text box on X-Net with a list box
2. The RTF uses open and close quotes and a apostrophe that are not in the ASCII character sets. This means that CeGui# can't render them. So Rtf2Xml should change replace them with the ASCII equivelents.
3. I haven't hooked up a 3D scene to X-Net yet.

4. I'd like to change the xnet.xml file format. points.
  • Way translation is handled. It seems a bit wasteful to put the strings into xnet.xml, and then need to look them up in the english, etc to translate. It would be better to have them in native form in xnet.xml.
    This would require adding an ID element to xnet, because we do need a fixed name for crossmatching.
    e.g.
    This
    <entry type="UFO Components" name="XNET_ALIEN_MEDICAL_ROOM">	<category topic="Research Topic" />	<shortentry>	  <paragraph>ALIEN MEDICAL ROOM</paragraph>	  <paragraph>X-Net://Pegasus.net/Alien/UFO Components/Alien Medical Room</paragraph>	</shortentry>
    becomes
    <entry type="UFO Components" id="XNET_ALIEN_MEDICAL_ROOM" name="Alien Medical Room">	<category topic="Research Topic" />	<shortentry>	  <paragraph>ALIEN MEDICAL ROOM</paragraph>	  <paragraph>X-Net://Pegasus.net/Alien/UFO Components/Alien Medical Room</paragraph>	</shortentry>
  • As I've suggested before, the image to associate with each entry should be in the file, not in the separate graphics.xml and xnetcamera.xml files
  • Every entry has a category element, which always has a value of "Research Topic". I think this element should be deleted, and as we'd like the entries to form a tree structre, the XML should be updated to reflect that.
    i.e. We have the ability to nest category elements, with the leaf category elements holding xnet entry elements

Random pickyness: I don't like the redundancy of a pathname like "My Documents\SavedGames\XeNAcide\saves". :P Something like "My Documents\Xenocide\saves" should be enough.

If you want to write to the disk, XNA sets the root directory to "Documents\SavedGames".
Oh yes, and I'm considering renaming Xenocide.XNA to XeNAcide. :)
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#88 Mad

Mad

    Creative Text Department

  • [Xenocide Senior Members]
  • 1958 posts

Posted 25 March 2007 - 06:13 AM

Mad, would you care to update your instructions?


First thing in the evening!
Keep smiling while dying

Of course I have gone mad with power! It would be completely ridiculous to go mad without power!
And no, this is not a quote from the Simpson's movie, I want it on paper, that I actually wrote that quite some time before the movie came out.

Posted Image

#89 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 25 March 2007 - 10:47 AM

Every entry has a category element, which always has a value of "Research Topic". I think this element should be deleted, and as we'd like the entries to form a tree structre, the XML should be updated to reflect that.
i.e. We have the ability to nest category elements, with the leaf category elements holding xnet entry elements

Indeed, and to go even further, the Xnet can be the URL type of information required
xnet:\\pegasus.net\research\alien\ufocomponents\alienmedicalroom
changing the paragraph to a url type in the schema.

What do you think?

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.

#90 Mad

Mad

    Creative Text Department

  • [Xenocide Senior Members]
  • 1958 posts

Posted 25 March 2007 - 11:34 AM

Ok, Wiki and forums updated!
Keep smiling while dying

Of course I have gone mad with power! It would be completely ridiculous to go mad without power!
And no, this is not a quote from the Simpson's movie, I want it on paper, that I actually wrote that quite some time before the movie came out.

Posted Image

#91 Mad

Mad

    Creative Text Department

  • [Xenocide Senior Members]
  • 1958 posts

Posted 25 March 2007 - 12:02 PM

Have problems compiling. Maybe you forgot some steps?

Error	13	Source file 'E:\Downloads\PJxenocide\XNASource\trunk\Xenocide\Source\Model\StaticTables.cs' could not be opened 	Xenocide

Keep smiling while dying

Of course I have gone mad with power! It would be completely ridiculous to go mad without power!
And no, this is not a quote from the Simpson's movie, I want it on paper, that I actually wrote that quite some time before the movie came out.

Posted Image

#92 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 25 March 2007 - 12:19 PM

Already sent him a PM about it :). it is missing a file.

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.

#93 Mad

Mad

    Creative Text Department

  • [Xenocide Senior Members]
  • 1958 posts

Posted 25 March 2007 - 12:24 PM

it is missing a file.

No, really? That would explain why I couldn't find it... ;)
Keep smiling while dying

Of course I have gone mad with power! It would be completely ridiculous to go mad without power!
And no, this is not a quote from the Simpson's movie, I want it on paper, that I actually wrote that quite some time before the movie came out.

Posted Image

#94 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 25 March 2007 - 01:56 PM


it is missing a file.

No, really? That would explain why I couldn't find it... ;)

I've checked in the missing file.
Sorry about that.
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#95 Mad

Mad

    Creative Text Department

  • [Xenocide Senior Members]
  • 1958 posts

Posted 25 March 2007 - 02:02 PM

I've checked in the missing file.
Sorry about that.

np. Works like a charm now! :)

Edited by Mad, 25 March 2007 - 02:02 PM.

Keep smiling while dying

Of course I have gone mad with power! It would be completely ridiculous to go mad without power!
And no, this is not a quote from the Simpson's movie, I want it on paper, that I actually wrote that quite some time before the movie came out.

Posted Image

#96 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 25 March 2007 - 02:06 PM

Every entry has a category element, which always has a value of "Research Topic". I think this element should be deleted, and as we'd like the entries to form a tree structre, the XML should be updated to reflect that.
i.e. We have the ability to nest category elements, with the leaf category elements holding xnet entry elements

Indeed, and to go even further, the Xnet can be the URL type of information required
xnet:\\pegasus.net\research\alien\ufocomponents\alienmedicalroom
changing the paragraph to a url type in the schema.

What do you think?

Greetings
Red Knight

Not quite sure what you're saying.
I think you're suggesting that we remove the "url" in the shortentry element, and instead construct the url using the "path" in the XML.
e.g. If the entry "RaptorAutopsy" was a child of the Biology context, which was a child of the Aliens context, with entry then we'd generate the url line:
xnet://pegasus.net/research/aliens/biology/raptorautopsy
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#97 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 25 March 2007 - 02:29 PM

That could be another solution, the one I suggested was more on the line of having another element named:
<url>xnet:\\pegasus.net\research\alien\ufocomponents\alienmedicalroom</url>
where xnet is a correct constructed url; instead of reconstruct it.

As you mention, we can use that for generating the categories 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.

#98 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 25 March 2007 - 02:43 PM

That could be another solution, the one I suggested was more on the line of having another element named:

<url>xnet:\\pegasus.net\research\alien\ufocomponents\alienmedicalroom</url>
where xnet is a correct constructed url; instead of reconstruct it.

As you mention, we can use that for generating the categories too.

Greetings
Red Knight

1. At this point in time, I'd like to keep X-Net as simple as possible, so even though I've proposed a structure that should allow a multiple level tree, I have no desire to write code to implement it.
2. If the URL is used to provice the entries in the "tree", and each entry has it's own URL, then grouping items needs care. (Need to make sure the names match exactly.) Could also run into issues with duplicate names (or categories and entries having same name.)
3. There's also small issue with text in the URL also appearing in the menu tree. (Which might make it look a bit odd when it contains spaces.)
Saving the world from the scum of the universe is hard work. Especially when you have to create the scum to begin with.

#99 dteviot

dteviot

    Programming Department

  • [Xenocide Senior Members]
  • 1479 posts

Posted 29 March 2007 - 04:41 AM

OK, I've updated xnet.xml and xnet.xsd as I've previously discussed, and checked the changes into the main and XNA lines
That is, the updated xml and xsd files are in the main line, along with the necessary code changes.
And I've made matching code changes to XNA line.

Attached is updated Rft2Xml.exe and xnetCtFiles.xml files for checking into CTD repository. (Mad, I don't have access to it.)

I'll update the source for Rft2Xml tomorrow, once I find the tools repository.

Changes to xnet.xml and xnet.xsd
1. graphic element added, to allow specifying the 3D model to show.
2. category elements now contain entry elements
3. The text to show on the menu is in the entry.

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.

#100 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3310 posts

Posted 29 March 2007 - 07:53 AM

Tools SVN is on http://svn.projectxenocide.com/tools/

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.