|
From: Ralph T. <ra...@em...> - 2003-12-04 11:39:54
|
Hello all!
If you dont know me then I will first introduce myself as this is my first mail to the mailing list!
My name is Wolfman, 22 yrs old, from the United Kingdom.
Disclaimers in first (hehe), this is the first time I have worked on a project such as this, and also the first time I have had my programming peer reviewed! I expect I have got a lot wrong, dont go easy on me, let me know what I did wrong and how I can do it better in the future!
By the way, I had a look at the doc containing the coding style pointers, but it didnt have anything regarding naming enumerations or structs. What is the correct way to do this?
Ok back on topic. Attached is a zip file containing 4 headers. These headers are all part of what I have called "StaticGeoData". If you think of a better name let me know!
The aim of the "StaticGeoData" class is to give the simulation engine any *static* data about the geosphere. By static I mean static in the sense of unchanging, not in the C++ sense of static. :)
Thus with the headers as I have given, the SE has to simply (Psuedoish code):
// When initialising
StaticGeoData *sgd = new StaticGeoData();
if(sgd->loadData("./data/earth.blah") != 0)
anERROR();
// When using
StaticGeoDataStruct *data = sgd->getData(x, y);
if(data->terrainType == OCEAN)
....
else
....
// end
Simple eh? The tricky bit is the StaticGeoData class itself. When loading the data it has to convert it all from whatever format and coordinate system into the coordinate system and format that the SE can handle.
Here is what I propose to do for each type of data that the SE will need:
1) Terrain
I suggest that the terrain (like RK said) should be loaded up in the form of a Quad Tree, based upon a texture map. This has several advantages. Once loaded it is quick and easy to find the terrain for a given x,y. It is also possible to tailer the amount of memory used by the quad tree by adjusting how it tests to see if a region is homogeneous. For example, if you want it to use lots of memory, simply only say a region is homogeneous if all pixels in the region are the same type. However, if you want to use less memory say that only 2/3 of the pixels have to be the same type.
2) Countries & Cities.
I thought quite a lot on this, and the system I came up with was this. There is an XML file that describes a list of countries. This is simply the name of the country, a unique colour (You will see in a moment), a list of cities within that country, and any other information that will be needed for further versions. The cities have an X,Y coord (or whatever other coord type we will use for the cities - ie spherical?). Perhaps whoever is doing the code for drawing the geoscape should decide if countries & cities are going to be drawn, if so they might want to adjust the XML format accordingly??
When loading the countries, the XML file is parsed, and a list of GeoCountrys and GeoCitys are constructed. Then what I propose happens is that another quad tree is constructed, this time from a seperate special texture that has each country individualy coloured. As the quad tree is constructed it looks up in the list of countries to see which country corresponds to which colour.
The reason I think a quad tree would be good for this as well as the terrain is that it has all the advantages of the quad trees, plus the fact that no vector data, or any other format is needed. Of course there are other solutions, if you have one feel free to suggest and we can discuss!
There we go, a bit longer than I meant, but if you still have any questions feel free to drop me a line!
-wolfman
P.S Sorry RedKnight, it was a bit longer than a day to do this because I have just got broadband after being on a 56k for so long I went on a bit of a download and online gaming frenzy. :)
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
|