Author Topic: openxcom mapblock new xml format for usage in tiled (modified for openxcom)  (Read 11845 times)

Offline werty

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Okay, let's start to discuss new map format integration.
Link to tiled  - https://mapeditor.org/
My verison with height levels will be provided soon.
Here's exported tileset from tiled:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<tileset name="04" tilewidth="30" tileheight="24">
 <image source="../Pictures/04.png" width="400" height="220"/>
 <tile id="0">
  <properties>
   <property name="testprop" value="222"/>
  </properties>
 </tile>
</tileset>
Each tile assigned an id based on tile position in tileset image. This position is calculated based on tilewidth and tileheight attributes.
the properties value can be used to store unlimited number of properties. Usage obvious - tile params can be stored here.
Xml looks good at all, but i'm not enough familiar with openxcom code so  please comment this.
The remaining questions is:
  • how to store animated tiles
  • how to store tile LOFTs
So for the first item idea is:
Code: [Select]
<animation>
<tile id="0" />
<tile id="1" />
<tile id="1" />
<tile id="1" />
...
</animation>
- put this inside <tile> tag
The tiled have to be expanded with animation creation tool. I see this like a window with editable list of tiles. (just like in mcedit)
As for the item 2:
We need additional window for editing LOFTs. The LOFT painter can look just like pixelart tool, provided in this topic https://openxcom.org/forum/index.php?topic=1436.0
The xml can look like this:
Code: [Select]
<LOFTs>
<LOFT id=0>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>

</LOFT>
...
</LOFTs>
For the item 2 - storing lofts.
So the tileset file can looks like:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<tileset name="04" tilewidth="30" tileheight="24">
 <image source="../Pictures/04.png" width="400" height="220"/>
 <tile id="0">
  <properties>
   <property name="testprop" value="222"/>
  </properties>
  <animation>
  <tile id="0" />
  <tile id="1" />
  <tile id="1" />
  <tile id="1" />
  ...
  </animation>
<LOFTs>
<LOFT id=0>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>
<data>0011111100111111</data>

</LOFT>
...
</LOFTs>
 </tile>
</tileset>
To save space LOFTs can be defined in document head, than referenced by ids
Please comment this proposal.

Offline Yankes

  • Commander
  • *****
  • Posts: 3207
    • View Profile
I would suggest use yaml instead of xml, using xml will require another dependency for OXC.

Offline LCSand

  • Captain
  • ***
  • Posts: 73
    • View Profile
It seems tiled already supports json and lua based formats. yaml could be added, but its native format uses xml.
That said once a structure is agreed upon conversion between yaml and xml should be fairly simple.

Offline alienfood

  • Captain
  • ***
  • Posts: 79
  • It's people!
    • View Profile
I do like the general idea of an integration with a third party map tool that has its own editors and whatnot. Seems like this would be most helpful for the modding community.

Offline Angelus_EV

  • Colonel
  • ****
  • Posts: 181
  • Trust no one
    • View Profile
i like the idea of having an map editor to add to missions or new battles, it can come whit the installer, i know a system to catch maps can be complicated but can be a goal for "2.0"

I imagine something like:

1.0 perfect vanilla conversion
1.5 perfect tftd support
2.0 new map systems and editor
2.5 maybe ability to play an hybrid game....
3.0 multiplayer, no those awful types available now, something where you don't  realize the difference between ai and human.

Offline werty

  • Sergeant
  • **
  • Posts: 16
    • View Profile
That said once a structure is agreed upon conversion between yaml and xml should be fairly simple.
True, after xml format would be finished, it can be reworked to yaml

Offline LCSand

  • Captain
  • ***
  • Posts: 73
    • View Profile
mmhh I would put animation under propertys like:
<properties>
   <property name="animation">
       <frames>2,3,4,5,6,7,8</frames>
   </property>
</properties>
or similar.

So you want to retain LOF templates?
Would they be part of one specific tileset?
What about the already existing LOFTs?

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
first: i have no idea about xcom maps and the mentioned mapeditor

what is the point of animations in map files?
how does tiled handle the 4 heightlayer
does tiles (walls, terrain) and object (elerium thingy under the powersource) needs extralayers
each map has rmpfiles are these used with the editor too?
can you generate a screen with loftemps enabled so you can have a "more or less" 3d look to search for holes in walls

Offline werty

  • Sergeant
  • **
  • Posts: 16
    • View Profile
what is the point of animations in map files?
We start with tiled native xml map format. Animation is stored in tileset. Tiled native xml map format supports inline tileset definition. Also it can be exported/imported to separate tileset files.
how does tiled handle the 4 heightlayer
Let's say here that tiled which we would use to code openxcom maps would be a branch of original tiled, neither plugin nor component. I already made necessary changes to original tiled to support height for layer.
does tiles (walls, terrain) and object (elerium thingy under the powersource) needs extralayers
Tiled supports object layers.
each map has rmpfiles are these used with the editor too?
Tiled supports polygons / primitives. I think I can add specific items here, like waypoints.
can you generate a screen with loftemps enabled so you can have a "more or less" 3d look to search for holes in walls
This can be a problem for me, but if someone with 3d coding experince can help me - it's not a problem.

Offline werty

  • Sergeant
  • **
  • Posts: 16
    • View Profile
So you want to retain LOF templates?
Not sure if it is a good idea, to make a decision here we need comments from core developers.
Would they be part of one specific tileset?
I think this is a best option.
What about the already existing LOFTs?
Converter, mentioned in https://openxcom.org/forum/index.php?topic=2178.msg21738#msg21738 will export them to new format

Offline werty

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Need some help.
Here's my simple LOFTs editor.
I want to build 3d model out of bool[16][16][16] array, like it displayed in MCDEdit. Don't have any 3d geometry experience.
Can you please provide some general help?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
[16][16][24]*

lofts are an array of 12 slices, with each layer represented twice.

Offline LCSand

  • Captain
  • ***
  • Posts: 73
    • View Profile
plz correct me if I am wrong.

But is a LOFT not a slice of 16*16 that are stacked on top of each other to form a 3D shape within a tile-cell?
And to create a shape you select the 24 slices you want from the templates?
So for a wall the LOFT could look like this in hex:
Code: [Select]
FFFF 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000And to form the 3D shape for the wall you just say 24 of those.
What do you mean my each layer represented twice? Wouldnt that just be for symetric shapes?

Offline werty

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Looks like Warboy meant that for calculations Z axis uses 12 LOFT templates, but each layer used twice so height is 24 units.

Offline werty

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Can someone export real xcom tiles to png image? At least some for demo purposes