OpenXcom Forum

Contributions => Programming => Topic started by: werty on May 24, 2014, 02:36:42 am

Title: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: werty on May 24, 2014, 02:36:42 am
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:
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.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: Yankes on May 24, 2014, 03:30:36 am
I would suggest use yaml instead of xml, using xml will require another dependency for OXC.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: LCSand on May 24, 2014, 06:56:47 am
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.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: alienfood on May 24, 2014, 03:30:04 pm
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.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: Angelus_EV on May 24, 2014, 04:54:15 pm
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.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: werty on May 24, 2014, 10:52:10 pm
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
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: LCSand on May 24, 2014, 11:12:34 pm
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?
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: Falko on May 24, 2014, 11:23:43 pm
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
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: werty on May 24, 2014, 11:48:56 pm
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.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: werty on May 24, 2014, 11:52:50 pm
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 (https://openxcom.org/forum/index.php?topic=2178.msg21738#msg21738) will export them to new format
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: werty on May 26, 2014, 03:03:33 pm
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?
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: Warboy1982 on May 26, 2014, 09:08:49 pm
[16][16][24]*

lofts are an array of 12 slices, with each layer represented twice.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: LCSand on May 27, 2014, 10:06:17 pm
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?
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: werty on May 28, 2014, 02:05:03 am
Looks like Warboy meant that for calculations Z axis uses 12 LOFT templates, but each layer used twice so height is 24 units.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: werty on May 28, 2014, 07:56:04 am
Can someone export real xcom tiles to png image? At least some for demo purposes
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: Warboy1982 on May 28, 2014, 12:51:25 pm
https://www.ufopaedia.org/index.php?title=LOFTEMPS.DAT (https://www.ufopaedia.org/index.php?title=LOFTEMPS.DAT)

there's a lot of info here, as well as links to BB's tools (which can convert your terrain data to "visual" form)
you can also hit F10 in-game to get a POV shot of the 3d voxels, or if you have debug enabled, F11 will output the entire map as a series of vertical "slices"
the slices themselves are all pre-defined in loftemps.dat, the mcds contain an array of 12 references to this.
Title: Re: openxcom mapblock new xml format for usage in tiled (modified for openxcom)
Post by: Hobbes on June 17, 2014, 06:32:05 pm
Can someone export real xcom tiles to png image? At least some for demo purposes

This are some of Dawn City's tiles in png format