aliens

Author Topic: change the world  (Read 10751 times)

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: change the world
« Reply #15 on: March 30, 2021, 09:58:48 pm »
It works with Firefox (just had a small problem with copy and paste that's why I switched to Vivaldi) and it should work for Chrome. Vivaldi is a Chromium, so it's nearly identical for this purpose.

What's possible is that when you copy from the spoiler that you will end up with 3 lines instead of 2.

This is the first command
Code: [Select]
var myImage = new OpenLayers.Layer.Image('myImage', 'https://openxcom.org/forum/index.php?action=dlattach;topic=9554.0;attach=53436;image', new OpenLayers.Bounds(-180, -88.759, 180, 88.759), new OpenLayers.Size(288, 144),);
The link to the openxcom forum is the link to the image.

and this is the second
Code: [Select]
map.addLayer(myImage);

Note: I have changed the name from marsterra to myImage.

Looks working, thanks! And how do you get those values, i imagine they meant to adjust the map. I am looking to add this one as background to edit biomes
https://u-stena.ru/upload/iblock/28b/28b861daa37da95f4740d1f0599ea8e2.jpg

I'm not sure I understand the question?
For editing the landmass, I'm probably going to use volutar's word dat editor, because it seems more practical; this tool has a button to add a background image.
Although I still a haven't figured out how to add/replace a texture with a custom texture... I need to understand that before doing anything.

Well, the question is that because all maps I am loading are placed wrong, but I guess I need to adjust values in script.
Yes, I also can see the problem with Falko's tool that I can't add textures to it. But on another hand, I can't add a background picture to Volutar's tool - it always throws an exception. And I need both =)

Offline Buscher

  • Colonel
  • ****
  • Posts: 168
    • View Profile
Re: change the world
« Reply #16 on: March 30, 2021, 10:17:14 pm »
Like in the attachment?

You don't have to mess with the parameters. You just have to make sure your picture has the correct map projection. Frankly I don't know what the numbers do either. But you can look up the used API and its parameters.

In your case it's quite simple as you only have to resize your picture to the size of robin's map (1280x714). That's exactly what I did to your map. Perhaps using this size you can also put it into Volutar's.

The arctic and antarctic are messed up because of the not correct map projection for this application.
No idea about how to add new terrain layers though.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: change the world
« Reply #17 on: March 30, 2021, 10:27:25 pm »
Omg, I manage to load it to Volutar's tool! I thought it's broken!
Tho the map needs the same correction now it looks like I am trapped, as i did a lot of work with Falko's tool, that export rulesets, and Volutar's  use only .dat file. Darn  :-X



There should be the way to convert from one to another, I believe, as the essential data there is the very same. Halp!  :'(

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: change the world
« Reply #18 on: March 30, 2021, 10:59:09 pm »
Looks like that if you manage to edit texture on the polygon directly, Falko's tool can load and edit it, but you can't create new of those. My guess is that it can't load new textures. But on its forum page it shows it can. So I am confused. Also, guys, can you load some Earth backgrounds other than WMS? And is there a way to load, say, Google Maps with it?

Offline robin

  • Commander
  • *****
  • Posts: 1225
  • ULTIMATE ROOKIE
    • View Profile
Re: change the world
« Reply #19 on: March 31, 2021, 11:27:37 pm »
Yeah, I don't understand how textures work either.

A conversion tool would be nice.. I once made a python script to mess with RMP files... maybe I can mess with world.dat file too, to make a yaml out of it.
Nor sure if I can do it, I never fully understood the bytes thingy.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: change the world
« Reply #20 on: April 01, 2021, 01:41:01 am »
Yeah, I don't understand how textures work either.

A conversion tool would be nice.. I once made a python script to mess with RMP files... maybe I can mess with world.dat file too, to make a yaml out of it.
Nor sure if I can do it, I never fully understood the bytes thingy.

Well, can be an easier way - Volutar's tool can export to .xyz file. I really can't understand that choice, as IMO it is the worst format to represent GIS data. I worked a little with cartography once I was geologist, and there are a lot of nice formats, like shape files. XYZ file is text file with coordinates in 3d, but the shape is flat, z is always 0.
Anyway, as Volutar's too can export and import to it, I would say it is better than dealing with binary file.

Offline robin

  • Commander
  • *****
  • Posts: 1225
  • ULTIMATE ROOKIE
    • View Profile
Re: change the world
« Reply #21 on: April 01, 2021, 10:41:31 pm »
Well, can be an easier way - Volutar's tool can export to .xyz file. I really can't understand that choice, as IMO it is the worst format to represent GIS data. I worked a little with cartography once I was geologist, and there are a lot of nice formats, like shape files. XYZ file is text file with coordinates in 3d, but the shape is flat, z is always 0.
Anyway, as Volutar's too can export and import to it, I would say it is better than dealing with binary file.
AFAIK the geoscape is actually flat, so it makes sense.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: change the world
« Reply #22 on: April 01, 2021, 11:05:04 pm »
AFAIK the geoscape is actually flat, so it makes sense.
No fully accurate, you define shape on flat surface but game project it on surface of globe that is not flat (but still 2d surface).
This have consequence that near poles projection break because on globe you have connected triangles but on 2d flat surface you have disconnected ones.
Simply upper edge is converted to single point.

I do not check this code recently but there is possibility that you could find "holes" in map when you are close to pole.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: change the world
« Reply #23 on: April 01, 2021, 11:29:36 pm »
Well, yes, very standard projection is used to represent a globe on a flat surface.
I assume converting xyz to rul and back is an easy task for python scripting, but I literally know nothing about python =(

Offline robin

  • Commander
  • *****
  • Posts: 1225
  • ULTIMATE ROOKIE
    • View Profile
Re: change the world
« Reply #24 on: April 02, 2021, 12:44:31 am »
I wrote a python scritp to extract the coordinates from world.dat and put them into a rul file.
I don't understand why, all the X coordinates are wrong while all the Ys are correct.

Example, First polygon -
my script:
Code: [Select]
[2799, -416, 2804, -411, 2828, -418, 2818, -425]world.dat:
Code: [Select]
0: 1279,-416
1: 1284,-411
2: 1308,-418
3: 1298,-425

Both coordinates should be short integers made up by 2 bytes, according to https://www.ufopaedia.org/index.php/WORLD.DAT


« Last Edit: April 02, 2021, 01:46:41 am by robin »

Offline robin

  • Commander
  • *****
  • Posts: 1225
  • ULTIMATE ROOKIE
    • View Profile
Re: change the world
« Reply #25 on: April 02, 2021, 12:47:24 am »
I assume converting xyz to rul and back is an easy task for python scripting, but I literally know nothing about python =(
I don't understand. I checked volutar's tool and I can only export to .obj format.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: change the world
« Reply #26 on: April 02, 2021, 01:29:47 am »
I don't understand. I checked volutar's tool and I can only export to .obj format.

Right, my bad, .xyz is a format I was messing around to convert from. Well, .obj is pretty much the same. Its the text file, first part contains coordinates, the second, I assume, holds texture data (how to construct polygon and set texture ID) with links to vertices numbers.

Offline Buscher

  • Colonel
  • ****
  • Posts: 168
    • View Profile
Re: change the world
« Reply #27 on: April 02, 2021, 10:01:57 am »
Aren't the coordinates for the globe in Polar coordinate system? So essentially longitude, latitude and fixed radius? Longitude has a range of 360 with an accuracy of 1/8 (0-2879) and Latitude has a range of -90° to 90° with an accuracy of 1/8 (0-719 and 0x10000-0x2D0). No idea how it is projected on a 2D map though.


I wrote a python scritp to extract the coordinates from world.dat and put them into a rul file.
I don't understand why, all the X coordinates are wrong while all the Ys are correct.

Example, First polygon -
my script:
Code: [Select]
[2799, -416, 2804, -411, 2828, -418, 2818, -425]world.dat:
Code: [Select]
0: 1279,-416
1: 1284,-411
2: 1308,-418
3: 1298,-425

Both coordinates should be short integers made up by 2 bytes, according to https://www.ufopaedia.org/index.php/WORLD.DAT

I am confused by your X numbers of the world.dat. The first polygon of UFO/GEODATA/WORLD.DAT for me is
2796, -418
2804, -411
2828, -418
2806, -426

Spoiler:
UFO/GEODATA $ cat WORLD.DAT | hexdump -C | head
00000000  ec 0a 5e fe f4 0a 65 fe  0c 0b 5e fe f6 0a 56 fe  |..^...e...^...V.|
00000010  01 00 00 00 0c 0b 5e fe  0e 0b 51 fe fa 0a 4e fe  |......^...Q...N.|

(Little Endian)

ec 0a           2796                349,5°
5e fe           65118 (-418)    - 52,25°
f4 0a            2804                350,5°
65 fe           -411                  - 51,375°
0c 0b           2828                 353,5°
5e fe           -418                  - 52,25°
f6 0a            2806                 350,75°
56 fe           -426                  - 53,25°
01 00 00 00


Offline robin

  • Commander
  • *****
  • Posts: 1225
  • ULTIMATE ROOKIE
    • View Profile
Re: change the world
« Reply #28 on: April 02, 2021, 10:09:43 am »
Aren't the coordinates for the globe in Polar coordinate system? So essentially longitude, latitude and fixed radius? Longitude has a range of 360 with an accuracy of 1/8 (0-2879) and Latitude has a range of -90° to 90° with an accuracy of 1/8 (0-719 and 0x10000-0x2D0). No idea how it is projected on a 2D map though.


I am confused by your X numbers of the world.dat. The first polygon of UFO/GEODATA/WORLD.DAT for me is
2796, -418
2804, -411
2828, -418
2806, -426

Spoiler:
UFO/GEODATA $ cat WORLD.DAT | hexdump -C | head
00000000  ec 0a 5e fe f4 0a 65 fe  0c 0b 5e fe f6 0a 56 fe  |..^...e...^...V.|
00000010  01 00 00 00 0c 0b 5e fe  0e 0b 51 fe fa 0a 4e fe  |......^...Q...N.|

(Little Endian)

ec 0a           2796                349,5°
5e fe           65118 (-418)    - 52,25°
f4 0a            2804                350,5°
65 fe           -411                  - 51,375°
0c 0b           2828                 353,5°
5e fe           -418                  - 52,25°
f6 0a            2806                 350,75°
56 fe           -426                  - 53,25°
01 00 00 00

I don't know why my worlddat editor shows incorrect X values (see screenshot).
Anyway I managed to complete the script, it produces a working "polygons" list to copy-paste into globe.rul. I just need to test that it imports correctly on Falko's tool.
« Last Edit: April 02, 2021, 10:12:03 am by robin »

Offline Buscher

  • Colonel
  • ****
  • Posts: 168
    • View Profile
Re: change the world
« Reply #29 on: April 02, 2021, 10:57:55 am »
For some reason there seems to be an offset of 1520.