Jump to content

The current project


daishiva

Recommended Posts

world.dat file format:

 

each entry is 20 bytes long

 

the first 16 bytes are lat/long coordinates. each lat/long pair is 2 bytes each

(4 pairs of 2 bytes = 16 bytes). Divide these by 8 to get degrees. i multiply them by matrixes of rotation to get x,y,z coordinates that i can then draw in perspective.

 

ie: Point3 p1 = (Matrix.GetDRotationY(x1/8)*Matrix.GetDRotationZ(y1/8))*pt

 

where

x1 is the first 2-byte value in a pair

y1 is the second 2-byte value

pt is a point in 3-space of (-1,0,0)

 

the point3 returned is the latitude translated into x,y,z coordinates

 

if the last (4th) 'x' value is -1 (not rotated by matrixes), only 3 points are used to create the triangle. Most of the entries use all four points. I split the 4 points into two triangles as such:

triangle 1: p1,p2,p3

triangle 2: p1,p3,p4

 

The game might just draw a quad, i dont know, it looks great in my viewer.

 

Finally the last 4 bytes are an index into a texture array. textures are located in the /geograph/texture.dat file. Each texture is 32x32 pixels in size, each byte is an index into the geo palette. (the latest version of pckview.net extracts these) There are 13 different textures, the first 13 are 'low res' (zoomed in ) the second 13 are 'medium res' (half zoom) and the last 13 are 'high res' (no zoom)

 

i believe thats it, if any changes need to be made, pm me and ill update this post

Link to comment
Share on other sites

that is the ufo defense map, the oceans are solid blue, in tftd, the land is solid brown.

 

Yeah i can spin it =)

https://daishiva.hypermart.net/image.gif

 

the current plan is to devise some way of editing the world so that someone could make their own planet and play on that (change of scenery)

Link to comment
Share on other sites

Daishiva... You may be my saviour... I need an edited geoscape. But it needs to be more impressive than the XCom geoscape and more like the Xenocide one. All lumpy and stuff :( If I give you the topographical picture of the planet's surface could you make my planet? Or is there anyone else who could? Micah, you're actually part of Xenocide aren't you? Could you or someone you know make my map for me?
Link to comment
Share on other sites

2daishiva:

Thanks for x-com geoscape data format description.

 

2The Veteran:

You are probably right, geoscape from the original x-com does not look quite well nowadays.

 

I have just encountered a very good resource with Earth texture https://earthobservatory.nasa.gov/Newsroom/BlueMarble/

I could not resist and have written a simple demo which shows geoscape similar to that from x-com using this texture just for fun. The program is only about 80 lines of code, it is extremely simple and not optimized at all but I like how it works :(

I'll work on it a bit more and probably will make rotating Earth a background for the main menu of ufo2000. Maybe it will even be a start of single player version of ufo2000, who knows. And maybe it will encourage some volunteers to join the project and start making strategic part of the game...

 

Well, for those who are interested, here is a link (with win32-version of demo and also C++ sources of it): https://ufo2000.lxnt.info/files/geoscape.zip (440Kb)

Link to comment
Share on other sites

Go here Serge... https://www.gotdotnet.com/Community/Workspa...8c-3e5e2bf6792e We have the tactical part of the game... One of the bits we still need is the geoscape...

 

Hey I just took a look at that Serge. I'm impressed. I think we could really use you to do the work on the geoscape for us if you're interested. What do you say? Give me your e-mail address and I'll give you the background, the topo map I have and all the files you need to download to run the game.

That ONLY goes for Serge! Noone else!

Link to comment
Share on other sites

2The Veteran

 

Thanks for your proposal but:

1. I'm already working on another x-com remake project (ufo2000).

2. I'm not familiar with .Net and other Micro$oft technologies, and prefer traditional C++ development of portable programs.

3. Geoscape seems too simple for me :( It is not very challenging.

 

Looks like it is daishiva who can be very useful for you (he also is programming for .Net). I think that after changing only a few lines of code, his program can be used to display any topographical picture for your project.

 

Edit: that's me, serge, I just accidentally logged in using my old account :(

Link to comment
Share on other sites

.Net is rather nice (in some aspects), but the one thing that bothers me the most is its reliance on such a huge framework when using .Net projects on older windows OS's. Sort of like how the Cygnus C/C++ complier needed a 4 meg library of sorts installed in order to run any of the projects built by it. Only .Net's framework is much larger.

 

---

 

My only complaint with regards to the Geoscape viewer is its proper use of textures. If it's going to end up as a geoscape editor, it's not going to look the same in the game. :(

 

I just mean the game displays its Geoscape textures in a rather flat manner.

 

- NKF

Link to comment
Share on other sites

Looks good, I'd love to be able to edit the Geoscape map. How in depth are you planning to go? I would imagine that messing with the geoscape map would mean messing with the funding issues, things like detection between land and sea...I for one would use it tho, could make things very interesting indeed...
Link to comment
Share on other sites

We're using C++ as well as the framework if my memory serves. What I really need for the geoscape is a 2D artist more than a programmer... The map I have is currently in a horizontal figure of eight shape and it needs to be in a stretched rectangle before it can be used on a geoscape. If someone could do that then I can just give the bmp to you to stick on the globe Serge/daishiva :( If there are any 3D artists about tell me! Also we're always after 3D modellers, and programmers... Let me know if you want something to do!
Link to comment
Share on other sites

I'm a little late, but....

 

@Veteran: We got our textures from Blue Marble, the same site Serge listed above, and we use the same one as Serge uses for his geoscape:

https://earthobservatory.nasa.gov/Newsroom/BlueMarble/

 

If you would like a copy of the version we use for Xenocide, download a copy of Xenocide Alpha 3, install it, and look in the /images folder for the file called:

xenocide_geoscape_texture.png

 

Good luck with the project.

Link to comment
Share on other sites

I'll try to return the thread topic back to modding :P

 

2daishiva:

Will the original x-com accept a completely reworked geoscape? I mean replace everything: change all the quads in world.dat, use more than 13 textures (maybe even have a texture for each quad). In this case we can take textures from Blue Marble and enjoy a new Xenocide-like geoscape in the good old x-com :( The game will eat much more memory and work slower, but it is not a problem for modern computers.

 

The only problems I see here are:

1. Country borders - do they depend on the quads that are currently in world.dat, will they mess up when we change the quads?

2. Texture indexes - if I get it right, texture indexes select a terrain type for a tactical battle. If we add more textures, the game may work weird. Probably we will be able to catch the texture index and replace it on the fly with the old value when switching from geoscape to tactical (XcomUtil way), but I'm not sure.

 

What do you think, is it worth trying?

Link to comment
Share on other sites

Not everything can be as good as Xenocide :P Seriously tho, isn't this a mod for X-Com1? And this would like edit the land/sea structure inside the game right? Or ave I got the wrong end of the stick? If it is what I think it is then it would be more trouble than it is worth to try to make it fully 3D, keeping the current game system would be fine I think. Unless I misunderstood something ( quite likely )
Link to comment
Share on other sites

2serge:

 

its worth trying, but if the geoscape is like anything else the programmers have done with xcom, its made to use as little memory as possible. ufo uses almost all triangles while tftd uses almost all quads (less memory taken). I do not know what the upper limit is on the world size (yet)

Link to comment
Share on other sites

Why not use both? That would appease the masses of DirectX acolytes, and the OpenGL fanatics (oh, and crummy software rendering for us mere mortals)!

 

'But that would be too much work!' I hear the masses cry. True, it would. But I imagine with the magic of classes, inheritence, polymorphism, and all that other rot they teach in computer science classes, a way can be devised!

 

Or not, but it's still something to ponder on.

 

- NKF

Link to comment
Share on other sites

opengl has documentation while directx does not =) it took me about 2 hours to figure out what the c# opengl code was doing, and then another half hour of reading opengl tutorials to figure out how to draw polygons, everything was cake from there on

 

i havent the foggiest idea of how to setup direct3d to do anything, all the tutorials are in c++ which doesnt translate well into c#

 

one day tho =) dont worry

Link to comment
Share on other sites

Ok, here it is:

 

For setting DirectX9:

// DirectX setup

PresentParameters presentParams = new PresentParameters();

presentParams.DeviceWindow = this;

presentParams.Windowed = true;

presentParams.SwapEffect = SwapEffect.Discard;

presentParams.EnableAutoDepthStencil = true;

presentParams.AutoDepthStencilFormat = DepthFormat.D16;

 

Device mDevice = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing|CreateFlags.MultiThreaded, presentParams);

 

For drawing poligons:

1. Create vertex buffer (only once)

VertexBuffer gridVBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), numOfGridLines*2, mDevice, Usage.Dynamic|Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.SystemMemory);

 

// lock buffer

CustomVertex.PositionColored[] verts = (CustomVertex.PositionColored[])gridVBuffer.Lock(0,LockFlags.Discard);

 

// fill buffer

for(int i = 0; i != numOfVerts; i++)

{

verts.X = i; verts.Y = -i; verts.Z=0.0f; verts.Color = System.Drawing.Color.Black.ToArgb();

}

 

// unlock buffer

gridVBuffer.Unlock();

 

2. Set matrices

mDevice.Transform.World = Matrix.RotationX(0.4f);

mDevice.Transform.View = Matrix.LookAtLH( camPos, cameraPosition, new Vector3( 0.0f, 0.0f, 1.0f ));

mDevice.Transform.Projection = Matrix.PerspectiveFovRH( (float)Math.PI / 4, 1.0f, 100, 10000 );

 

3. Draw poligons

mDevice.SetStreamSource(0, gridVBuffer, 0);

mDevice.VertexFormat = CustomVertex.PositionColored.Format;

mDevice.DrawPrimitives(PrimitiveType.LineList, 0, numOfGridLines);

 

 

As you see, it`s quite simple really... :angel:

 

BTW: There are lots of basic samples for MDX on web... And there are few books out...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...