Jump to content

Two stage missions and alive aliens


Thunder_Gr

Recommended Posts

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

Exact same OS as me, assuming you're still SP2. Hmm.

 

S didn't fix it...I have IE6 on that machine, but I am not sure if it relevant..

 

The next bit of research is working out how to determine if a given point in a grid falls in the area defined by any given three (or four) other points. :laugh:

 

OK, let me see, you need to test if a pixel is a member of a specific tile? Or I got it wrong?

Link to comment
Share on other sites

It is very easy to check if a point is within an area defined by three(level object) or 4(3-dimensional, unless all placed on the same z-axis or there is no z-axis(thus z=0) object) other points, using a simple if statement(well not-so simple, but one if with some && :D). The only thing you need is to know the x,y,z(if there is a z) coordinates of all the points.

 

Wait...now...you are not pulling my leg, are you? :laugh:

Link to comment
Share on other sites

S didn't fix it...I have IE6 on that machine, but I am not sure if it relevant..

Not relevant, no. What version of DirectX? Graphics card?

 

OK, let me see, you need to test if a pixel is a member of a specific tile? Or I got it wrong?

If a specific craft is within a specific area on the geoscape. Refer to this and this.

Link to comment
Share on other sites

Not relevant, no. What version of DirectX? Graphics card?

 

9.0c with a GForce 7600 graphics card. I should have the latest drivers. also. I have no problems running any games, so far.

 

If a specific craft is within a specific area on the geoscape. Refer to this and this.

 

As soon as the wiki is working again, I'll look at the references you posted. It would help if you could post a brief summary so that I can have some info to work on something, meanwhile...

Link to comment
Share on other sites

Wait, the UFOpedia STILL isn't loading for you?!

 

What error message are you getting on that one?

 

 

Interent Explorer is unable to display this webpage...

It was working yesterday morning, for a few hours, though...It seems it is difficult for me to have access to these pages.

Link to comment
Share on other sites

About the Battlescape Editor...I think I may have figured out the problem. Since you run in Java, and Java relies on directX to get information about the graphics adapter and monitor in order to get the list of valid resolutions, it could be that my driver does not report the requested resolution as a valid one. So, instead of trying to change into an invalid resolution, runs in window that is unmoveable and without borders.

My display settings allow me to set a resolution as low as 800x600x16bit colors. My monitor is a Widescreen 1440x900 TFT monitor.

Of course, using DOSBox, or a normal command prompt, I can run the games requiring low resolutions(i run Sid Meyer's colonization-original version-, without sound, normaly in a WinXP command prompt, either in a window or full screen).

Well, this is my best guess so far.

Link to comment
Share on other sites

I did actually try to resolve the IP, but met with failure. There's some sort of redirect in place messing with things so attempting to connect via the IP directly points you somewhere different.

 

You could try flushing your local DNS cache, might work. (ipconfig /flushdns)

 

My system also does not allow me to change the Windows desktop to anything less then 800x600, but that doesn't seem to stop me changing full screen apps to pretty much whatever I like. I think that desktop limit is just an XP thing, that is to say, "You're running this OS, aren't you? Then there's no way your monitor can't do AT LEAST 800x600". :D

 

If the driver didn't accept any of the resolutions the editor asks for as "valid", then the editor would probably just crash out.

 

It's a pain in the rear because the class file that handles the full screen mode is one of the few things in there I didn't write from scratch myself (it's certainly the largest example). I had to make a few edits to it to make it work the way I wanted, but otherwise I've left it alone.

 

I HAVE had it happen to me a few times (as in, like, three over the course of however many years I've been writing this thing), but restarting it always fixed the issue...

 

Googled around but could not find anyone with a similar problem. Instead I found some guy'd ported Quake II to Java, the freakin' thing runs full speed in my web browser... Puts me to shame... Makes me want to give in and get a native Windows compiler for the boost! :laugh:

Link to comment
Share on other sites

I've set up a proxy to my browser and I was able to finaly reach those links you provided. However, I still get no attempt from my DNS to resolve UfoPaedia.org, while it attempts to resolve any other address given, even if non-existant...weird, at least.

 

Anyway, the discussion in the second link is reserved only to members of your group, so, I am not allowed to see anything.

The discussion about WORLD.DAT has confused me, really. As I recall, there is an entry in GEODATA.DAT

86/56: Y location of X-Com craft on map. Usually a multiple of 10. 87/57: X location of X-Com craft on map. Usually a multiple of 10.

 

giving x,y location of X-Com craft. And since we have the WORLD.DAT to check against these locations, the problem should be easilly solved by getting the craft to any location on the map for a mission(well, I assume we can generate missions at will, but, in any case, just building a base in the area we cannot identify yet, can do the trick, since, as reported, Alien activity works its way around your base), and then compare the results with the entry in WORLD.DAT.

Anyway, not having any other background info or any idea about what you have done with it, as well as no way to experiment with it, I am afraid I can not help much here. It is like asking a blind man to help you solve a color-cube puzzle, if you know what I mean.

 

I wish I could help with that java issue, also, but, again, I do not have a source to look into, so, again, I am clueless in what could have caused it. Are you sure that you have the latest java version? Perhaps they changed something that requires a different command or an extra parameter, or something...

Link to comment
Share on other sites

I have the latest Java VM (Have the auto-updater bug me when I don't, and quickly install it as required. Security and all that).

 

The source for my programs is included with them, I'm somewhat confused when you say you can't find it, given that you previously mentioned finding the code instructing the resolution change...

 

I don't get the "members of your group" thing either, I'm not aware of any special permissions required to view the wiki. Can you elaborate on that?

 

GEODATA.DAT relates to tactical maps which are a lot smaller then the ones I wanna look at. WORLD.DAT relates to the world map you see in the geoscape display. LOC.DAT is the file that details where craft are on that world map. Need a way to determine if a given craft is sitting on a given polygon defined by WORLD.DAT. Working this out by making a bigass array for every possible location on the map is out of the question. For my purposes that'd require 8,294,400 values.

 

To try and put it more clearly, the reason I specifically need to be able to take the three or four points and work out if another is between them, is so I can tell if a given mission is over a specific part of the world globe.

 

Don't worry about it too much, I'll likely be able to pull the relevant theory off google quickly enough. It's likely one of the various things I forgot learning in college; I've got an annoying feeling I should already know the answer.

Link to comment
Share on other sites

I have the latest Java VM (Have the auto-updater bug me when I don't, and quickly install it as required. Security and all that).

 

Well, perhaps it is that you have also something else installed that makes it work fine, while I don't...

 

The source for my programs is included with them, I'm somewhat confused when you say you can't find it, given that you previously mentioned finding the code instructing the resolution change...

 

Yes, the *.java files. But I do not know how to compile a change to do some experiments. Any propositions?

I don't get the "members of your group" thing either, I'm not aware of any special permissions required to view the wiki. Can you elaborate on that?

 

Sure, when I click on "discussion" I get this text:

<H1 class=firstHeading>View source</H1><H3 id=siteSub>From UFOpaedia</H3>for Talk:TEXTURE.DATJump to: navigation, searchThe action you have requested is limited to users in the group user.

 

Return to Main Page.

 

Retrieved from "https://www.ufopaedia.org/index.php?title=Talk:TEXTURE.DAT"

My theory is that there is no discussion for this page and the wiki things I am trying to post something.

 

GEODATA.DAT relates to tactical maps which are a lot smaller then the ones I wanna look at. WORLD.DAT relates to the world map you see in the geoscape display. LOC.DAT is the file that details where craft are on that world map. Need a way to determine if a given craft is sitting on a given polygon defined by WORLD.DAT. Working this out by making a bigass array for every possible location on the map is out of the question. For my purposes that'd require 8,294,400 values.

 

To try and put it more clearly, I need to be able to take the three or four points that define any given polygon in WORLD.DAT, and determine if a given point related to a mission in LOC.DAT is sitting between them.

 

It seems to very simple, this is why I keep saying I am confused. Knowing the polygons and having the LOC.DAT position, the appropriate polygon(s) to look for(there should never be more than 2 and, even if overlaping, you only need 1 of them to get the job done), it would be those with x1<=xcraft, x2>=xcraft, y1<=Ycraft, y2>=ycraft. An example code(C++) could be

[b]long PolysFound[MAXPOLYS];[/b]//Defined the maximum amount of polys that may be found as a const, just in case
[b]RECT MapPoly;[/b]//This variable will be filled with the values of a WORLD.DAT polygon.
[b]do
{
[/b]//WorldMap is an object handling the WORLD.DAT file. ReadNextPoly is a method reading the
//next polygon data and returning the current file position for this entry.
<B>
[indent]

long CurrentPoly=WorldMap.ReadNextPoly(&MapPoly);
</B>//Assuming the ReadNextPoly returns -1 to the .x2 to indicate no more 
//polys exist.
[b]if(MapPoly.x2==-1) break;
int CurrentFound=0;[/b]//for the array. A char should also do the job, but an int gives a broader chance for future usage
//xcraft, ycraft the location of the craft assumed already taken by the LOC.DAT
[b]if((MapPoly.x1<=xcraft && MapPoly.x2>=xcraft) && (MapPoly.y1<=ycraft && MapPoly.y2>=ycraft))
{
[/b][indent]//keep the position found
[b]PolysFound[CurrentFound]=CurrentPoly;
CurrentFound++;[/b]//could have been placed within the index, but it is better this way, since the
//code is more readable
[b]

[/indent]
}
[/b][b]

[/indent]}
while(true);[/b]//For a finished version. During debuging this could be set to
//WorldMap.EOF, meaning the object would have an indicator for when it hits
//end of file, thus avoiding endless loops.

The last two } should have been placed an intent level to the left, but I cannot get the post editor to do it...whatever...

 

At most, 2 of the polygons should meet the criteria. If there are indeed 2, you then have 2 options:

1) pick one at random(quick but sloppy),

2) further check for relative position of xcraft,ycraft across the appropriate diagonal to determine which it is.

 

Don't worry about it too much, I'll likely be able to pull the relevant theory off google quickly enough. It's likely one of the various things I forgot learning in college; I've got an annoying feeling I should already know the answer.

 

I get the feeling that you do. Anyway, this is what I think about it.

 

So, if this is solved , what's next?

Anyway, if you think I am just putting pressure on you, just say so. I am trying to help, but I can imagine that you may find this annoying...

 

And, have you thought about programming this in C++? Of course I can imagine there could be many reasons for not having done so, and, at this point, I am sure such a port may be out of question. Just asking.

Link to comment
Share on other sites

Re: your trouble posting to the wiki: Have you registered an account on the wiki? Just as an anti-spam-bot measure we had to set it so that you had to register before you could start editing the wiki. The link was to a page that did not exist, so the wiki thought you were trying to edit a new page.

 

- NKF

Link to comment
Share on other sites

Re: your trouble posting to the wiki: Have you registered an account on the wiki? Just as an anti-spam-bot measure we had to set it so that you had to register before you could start editing the wiki. The link was to a page that did not exist, so the wiki thought you were trying to edit a new page.

 

- NKF

 

 

No, I haven't yet. I will do so.

 

Now, about the java issue. I have grapped the developer's Kit and I'll give it a try. I hope I can find out what is wrong, soon.

Link to comment
Share on other sites

Hmm. I guess your system must really not like those low display modes. Ah well, it was bound to happen sooner or later. Not sure what to do about that. Does 800x500 work for you?

 

Anyway, in wiki-land, red links = page does not exist. So why show them in the first place? Well, any user can create new pages, see. The "discussion" link is always present just in case someone wishes to start one.

 

Re that sample code... I'm afraid that simply won't work, at least, not if I'm reading it right. WORLD.DAT polygons aren't defined by four values. They have either three or four points, each of which has an x/y position on a 2880x1440 map, and I'm not even sure if the points are always listed in a clockwise (or anti-clockwise) order as of yet!

 

That is to say, trigonometry is required.

 

As to why I use Java, the answer is likely laziness. For example, I'd need to change much of the layout of the program to accommodate C's silly rules, most of which I have only a basic understanding of.

 

(Granted, if some of those silly rules were handled the way Java handles things, UFO would be more likely to crash then glitch in many cases. Though for the same reason, we'd have a lot less buffer overrun viruses floating around, too, so make of that what you will).

 

But more to the point, I once tried to write a "Hello World" program in C. Couldn't get it to compile so I gave up. I've since coded a GameBoy ROM and modified X-Box code in that language, but I never went back to trying it for my computer... And until C offers something I can't get any other way, I likely never will.

 

(Note that the code that comprises this particular mod won't be in Java. Couldn't run it in DOSBox if it was.

 

No, that'll be in... QBasic! :laugh:)

Link to comment
Share on other sites

Hmm. I guess your system must really not like those low display modes. Ah well, it was bound to happen sooner or later. Not sure what to do about that. Does 800x500 work for you?

 

Finished testing. I also used other tools to determine what is wrong. My adapter, simply, will not display anything less than 640x480x256..As simple as that...:\...

Of course, I could always set the driver to "vga compatible" lol.

 

Anyway, in wiki-land, red links = page does not exist. So why show them in the first place? Well, any user can create new pages, see. The "discussion" link is always present just in case someone wishes to start one.

 

Yeah, I created a user name, so I shouldn't have any more problems with that.

 

Re that sample code... I'm afraid that simply won't work, at least, not if I'm reading it right. WORLD.DAT polygons aren't defined by four values. They have either three or four points, each of which has an x/y position on a 2880x1440 map, and I'm not even sure if the points are always listed in a clockwise (or anti-clockwise) order as of yet!

 

That is to say, trigonometry is required.

 

OK.Let's see it. x,y is 1 point. x1,y1 is a second point. x2,y2 is a third point, and so on. I have programmed a class in C++ for using boxes with my programs(DirectX), and I have been messing with points all the time. With minor adjustments the sample code will work. And trigonometry is what is being avoided this way.

So, lets see the case of our craft. xcraft, ycraft is one point. We need to see if this point is anywhere within an area given by 3 or 4 other points. We compare the xcraft with the minx(the smallest x of the 4 points) and maxx(the largestx of the 4 points) of the given points, and do the same for the y coordinates. The polygon is, most likely, not a rectangle, but we check for the rectangle area first. This is what the code given does. The craft may be outside of the currently examined polygon, but reported in the area. This is why we check for multiple polygons. But, it will never be more than 2 polygons, unless polygons are overlaping, in which case, we do not realy care about the overlap.

So, if you find out that the craft in within the rectangle defined by xmin,xmax,ymin,ymax of the 4 points given, it is much easier to determine which of the 2 polygons found is the one really containing.

I have attached an image to show better what I mean: Image

 

As you can see, the craft is the dot. We check the polygons(black lines). In order to avoid complex arithmetics, we get the areas shown in RED and BLUE rectangles.

There should never be more than 2 polygons qualifying for the craft's position. But, in bizzare situations, it may be three, or if polygons are overlaping.

 

As to why I use Java, the answer is likely laziness. For example, I'd need to change much of the layout of the program to accommodate C's silly rules, most of which I have only a basic understanding of.

 

(Granted, if some of those silly rules were handled the way Java handles things, UFO would be more likely to crash then glitch in many cases. Though for the same reason, we'd have a lot less buffer overrun viruses floating around, too, so make of that what you will).

 

But more to the point, I once tried to write a "Hello World" program in C. Couldn't get it to compile so I gave up. I've since coded a GameBoy ROM and modified X-Box code in that language, but I never went back to trying it for my computer... And until C offers something I can't get any other way, I likely never will.

 

(Note that the code that comprises this particular mod won't be in Java. Couldn't run it in DOSBox if it was.

 

No, that'll be in... QBasic! :laugh: )

 

 

Hehe, I have to see that! It's been a long time since the last time I wrote something in QBasic(About 10-11 years) lol.

 

EDIT: And, of course, it is not required to run in DOSBox. Your engine could run on anything you like. Now, if you intend to make the mod platform-independent....That, is a challenge!!

Link to comment
Share on other sites

In the spirit of irrepressible 'personal improvement' :laugh: I occasionally check out some new programming languages. Reading your post C# in particular rang quite a few matching bells so - in the spirit of ol' QBasic - here's a GOTO if you wish:

 

M$ Intro:

"C# syntax is highly expressive, yet it is also simple and easy to learn. The curly-brace syntax of C# will be instantly recognizable to anyone familiar with C, C++ or Java. Developers who know any of these languages are typically able to begin to work productively in C# within a very short time."
But more to the point, I once tried to write a "Hello World" program in C. Couldn't get it to compile so I gave up.

Have a shot at it in C# :D

 

"And until C offers something I can't get any other way (...)"
"C# syntax simplifies many of the complexities of C++ and provides powerful features such as nullable value types, enumerations, delegates, lambda expressions and direct memory access, which are not found in Java."

Some tips for porting Java to C# and migration help...

 

::

 

It appears there's a free version around called C# Express 2008 if you wish to get your feet wet.

 

Anyway, good luck with your many ongoing X-Com endeavours, BB :D

Link to comment
Share on other sites

When rereading the wiki for the World.DAT I noticed this:

QuadData/8 = realworld latitude and longitude numbers.

 

if QuadData[3][1] = -1 then the shape is a triangle and that entery is not used. (for you non programers QuadData[0] is the first so [3] is the forth.)

 

This may not be usefull for the wiki but I once wrote a program to detect what world.dat entry a givin ship was located in and therefor what texture/terrain file used to create the battlescape map. I have the function if anyone is interested in the math.

 

--BladeFireLight 21:24, 20 January 2007 (PST)

 

So, BladeFire should already have the exact(somewhat complicated) math for the task, and my, simplier, shortcut can be avoided :laugh:

Link to comment
Share on other sites

But, it will never be more than 2 polygons, unless polygons are overlaping, in which case, we do not realy care about the overlap.

I kinda get the impression this doesn't matter too much, but I don't think there's an upper limit to how many polygons can be contrived to "fit the bill" without overlapping. Eg:

 

foursquare.gif

 

So, if you find out that the craft in within the rectangle defined by xmin,xmax,ymin,ymax of the 4 points given, it is much easier to determine which of the 2 polygons found is the one really containing.

Ok, I understand that this method can be used to quickly narrow down the choices, but how do you determine which of the "close match" polygons is the actual one you're looking for?

 

And, of course, it is not required to run in DOSBox.

Everything I've written so far is compatible with both versions of the game, so... consider it a trend. :D

 

It appears there's a free version around called C# Express 2008 if you wish to get your feet wet.

My old Visual Studio pack apparently contains the development kit for that dialect (How is it pronounced, "C sharp?!"). I may well take a look at it. Thankfully, that "translation" page thingy contains code samples to explain what it's on about.

 

(This is probably why I still love QB, you can get things done very quickly indeed when it's possible to get a code sample for ANY GIVEN COMMAND on your screen within about five seconds of the question forming in your mind...)

 

So, BladeFire should already have the exact(somewhat complicated) math for the task, and my, simplier, shortcut can be avoided :laugh:

Hmm, I should probably PM him or something...

Link to comment
Share on other sites

I kinda get the impression this doesn't matter too much, but I don't think there's an upper limit to how many polygons can be contrived to "fit the bill" without overlapping. Eg:

 

post-152-1237509751_thumb.png

 

It is a very impressive image you came up with, however, I consider it to be one of the "bizzare" situations... :laugh: ...Triangles can cause that. The code can be easily adjusted to deal with the situation of triangles covering twice their actual size for the purposes of the check, and, eventualy, making sure no more than 2 polys end up as candidates.

 

Ok, I understand that this method can be used to quickly narrow down the choices, but how do you determine which of the "close match" polygons is the actual one you're looking for?

 

After determining the "candidate" polygons, another check has to be made on the specific side of each polygon, to see if it is indeed within, or outside the diagonal. The way to do that is to check if the line between the two relevant points at this specific point results in the craft being inside or outside the polygon. If you wish I can work out the code for this and post a sample.

 

Everything I've written so far is compatible with both versions of the game, so... consider it a trend. :D

 

This is nice, but I can remember I could not run your BattleScape editor from within DOSBox(I did try!).

Which version of QBasic do you use?(I was actually thinking you were joking in your previous post :D )

Link to comment
Share on other sites

OK, this is a sample code of the final check.

 

POINT prox1,prox2;

bool GreaterThanX;

bool GreaterThanY;

//TestRect contains the rectangle taken for the specific polygon.

if(Craft.x-TestRect.x1>TestRect.x2-Craft.x)

{

 

 

prox1.x= (MapPoly.x3>-1) ? MapPoly.x3 : MapPoly.x2;
//cover triangles

prox1.y=(MapPoly.x3>-1) ? MapPoly.y3 : MapPoly.y2;

prox2.x=MapPoly.x1;

prox2.y=MapPoly.y1;

}

else

{

prox1.x=MapPoly.x;

prox1.y=MapPoly.y;

prox2.x=MapPoly.x2;

prox2.y=MapPoly.y2;

 

 

 

}

//This will tell us if we need to check for >= or <= in the following lines

GreaterThanX=(prox1.x<MapPoly.x)

GreaterThanY=(prox1.y<MapPoly.y)

//the above code makes the assumption points are taken from left to right, from top to bottom

//but it is easy to include all cases.

//Now we have determined a line to be checked against the craft's position. So:

float Stepx=prox2.x-prox1.x;//temporary

float Stepy=(prox2.y-prox1.y)/abs(Stepx);//abs is vital so that the divider does not affect sign

Stepx/=abs(Stepy);//Final

float checkpointx=prox1.x;

float checkpointy=prox1.y;

do

{

checkpointx+=Stepx;

checkpointy+=Stepy;

if(((Craft.x<int(checkpointx) && !GreaterThanX) || (Craft.x>int(checkpointx) && GreaterThanX) || (Craft.x==int(checkpointx)))

&& ((Craft.y<int(checkpointy) && !GreaterThanY) || (Craft.y>int(checkpointy) && GreaterThanY) || (Craft.Y==int(checkpointy)))) break;
//we found the poly. I have not included a variable to check for this, etc, but you get the picture
:laugh:

 

 

}while(checkpointx<=prox2.x);

This is sample code, written from the top of my head, so, it needs much polishing. Still, this is the idea.

Note that the step will usually be a decimal number so the "==" case should be very rare. A good idea could be to truncate(not round) the number so that the decimal in the checkpointx and checkpointy, would be effectively an int describing the pixel. I think, int() should do this, so this is why I used it.

Link to comment
Share on other sites

@BB:

 

How is it pronounced, "C sharp?!"

Right you are.

 

::

 

Now that you mention it, though, and should you end up being unsatisfied with C# here's a suggestion for the name of an alternate language of your own making: BB~

 

Reads 'BB smooth'. All rights reserved preferably, or M$ might nab it :laugh:

Link to comment
Share on other sites

I see something about working out all the points on a single line? Can't seem to wrap my head around how that works, but that's probably 'cause it's 1am. :laugh:

 

(That's my excuse, anyway). :)

 

This is nice, but I can remember I could not run your BattleScape editor from within DOSBox(I did try!).

Very clever, but you don't need to run the editor in DOSBox in order to use it with save games generated by the DOS version of the game. :)

 

Which version of QBasic do you use?(I was actually thinking you were joking in your previous post :D )

I use the final IDE, QuickBASIC Extended (7.1 to memory, better known as QBX. Technically there's quite a difference between this and QBasic, but I'm sure you can find the details yourself if you're interested).

 

Though it be madness, yet there be method to it. Back when I very first started programming Basic variants were "all the rage", so to speak, so when I moved on to more "modern" computers (you know, the sort with colour monitors and internal HDDs) switching to that language was the logical step.

 

These days I still rely on it for those times when I want to code something quickly. I can go from a blank page to a compiled program in very short time indeed due to the lack of filler code other languages demand (type declarations for eg) and thanks to the help system (which lets me refresh my memory on the syntax of a command on a whim).

 

That, and, well, it works in DOSBox. :)

 

Right you are.

Aw, and here I was hoping it to be a play on the term "hashcode".

 

Now that you mention it, though, and should you end up being unsatisfied with C# here's a suggestion for the name of an alternate language of your own making: BB~

While I realise I'm merely insulting myself, I really do think just "B~" rolls off the tongue that much better. :D

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...