thebonejarmer / tiledcs Goto Github PK
View Code? Open in Web Editor NEWTiledCS is a dotnet library for loading Tiled tilesets and maps
License: MIT License
TiledCS is a dotnet library for loading Tiled tilesets and maps
License: MIT License
Thank you for adding support for object geometry in the last release.
Could you please add support for tile collision geometry? Attached is an example tileset.
Here is what the data looks like:
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.5" tiledversion="1.7.2" name="Basic" tilewidth="32" tileheight="32" tilecount="1024" columns="32">
<image source="Tileset.png" width="1024" height="1024"/>
<tile id="0" type="Collapsable"/>
<tile id="1">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="32" height="32"/>
<object id="2" x="0" y="0" width="32" height="32"/>
</objectgroup>
</tile>
<tile id="2" type="Spike"/>
<tile id="3" type="Collapsable"/>
<tile id="4">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="32" height="32"/>
</objectgroup>
</tile>
<tile id="7">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0">
<polygon points="0,0 0,32 32,32 32,16"/>
</object>
</objectgroup>
</tile>
<tile id="8">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="16">
<polygon points="0,0 0,16 32,16"/>
</object>
</objectgroup>
</tile>
</tileset>
Like the title says really. Currently only external tilesets are supported but I should add logic to support internal or embedded tilesets as well.
Tiled supports tilesets that consist of one image per tile instead of one large tileset image. These are encoded through a image attribute (see here).
STOP POLLUTING THE INTERNET WITH THIS SHIT SOFTWARE
Tiled offers the ability to encode tile data as base64 to reduce file size, and even has options for compression to reduce it further. In the past I've often found myself decoding and using these formats in game engine code so large maps could be stored in a much smaller size, and I'd love to see support for it come to this library. I have a fork ready that allows reading most of these base64 formats, this is just a check to see if there's interest in implementing it.
I'm not sure if I'm missing something because I'm pretty new to this, but since I don't know where else to ask or contact you I thought I'd open this issue. When I've got an object of type TiledObject there seems to be no way to access the points of the polygon (if it's a polygon). Is that currently not possible or am I missing something?
Right now only the TMX format is supported. I prefer to extend the support for JSON maps as well. I already have plans to start with this but I git an issue. The structure of the map in JSON is different than the one in XML. And I am not talking about syntax.
Let's take objects for example. In the TMX format they are listed in a XML node called ObjectGroups, which is a direct child node of the root node. Logically you'd expect the JSON format to have a similar node in the root node with the same name. However, that's not the case. In JSON the objects are part of a layer. See the example map contents below:
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.4" tiledversion="1.4.3" orientation="staggered" renderorder="right-down" width="40" height="20" tilewidth="16" tileheight="16" infinite="0" staggeraxis="y" staggerindex="odd" nextlayerid="3" nextobjectid="2">
<editorsettings>
<export target="."/>
</editorsettings>
<properties>
<property name="mybool" type="bool" value="true"/>
<property name="mycolor" type="color" value="#ff6391bc"/>
<property name="myfile" type="file" value="autotiles.png"/>
<property name="myfloat" type="float" value="3.141"/>
<property name="myint" type="int" value="24"/>
<property name="myobj" type="object" value="1"/>
<property name="name" value="Test 3"/>
</properties>
<layer id="1" name="Tile Layer 1" width="40" height="20">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<object id="1" x="200" y="56" width="32" height="32"/>
</objectgroup>
</map>
{ "compressionlevel":-1,
"height":20,
"infinite":false,
"layers":[
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":20,
"id":1,
"name":"Tile Layer 1",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":40,
"x":0,
"y":0
},
{
"draworder":"topdown",
"id":2,
"name":"Object Layer 1",
"objects":[
{
"height":32,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":32,
"x":200,
"y":56
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}],
"nextlayerid":3,
"nextobjectid":2,
"orientation":"staggered",
"properties":[
{
"name":"mybool",
"type":"bool",
"value":true
},
{
"name":"mycolor",
"type":"color",
"value":"#ff6391bc"
},
{
"name":"myfile",
"type":"file",
"value":"autotiles.png"
},
{
"name":"myfloat",
"type":"float",
"value":3.141
},
{
"name":"myint",
"type":"int",
"value":24
},
{
"name":"myobj",
"type":"object",
"value":1
},
{
"name":"name",
"type":"string",
"value":"Test 3"
}],
"renderorder":"right-down",
"staggeraxis":"y",
"staggerindex":"odd",
"tiledversion":"1.4.3",
"tileheight":16,
"tilesets":[],
"tilewidth":16,
"type":"map",
"version":1.4,
"width":40
}
As you can see in the JSON version, there are 2 layers from which one now is an object layer. And this layer contains an array with all the objects. I get why this was done since the Tiled interface also uses layers for objects. Sadly, this is a problem for me because I cannot use the same class structure for both formats. So I think the only solution is to a class per format.
Hi
Could you maybe add a monogame pipeline?
Not esy to find a library for monogame that has a Tiled pipeline
Up till now it is possible to deserialize the map from and to JSON, which is good. But this won't work with stuff like tile rotations. As the gid value of a rotated tile is bigger than the max of an int, the serialization would fail.
Got a parse error in ParseLayer because the offset for an image layer was not a whole number.
Change it to this:
if (attrOffsetX != null) tiledLayer.offsetX = double.Parse(attrOffsetX.Value); if (attrOffsetY != null) tiledLayer.offsetY = double.Parse(attrOffsetY.Value);
According to several issues on the repo of TiledSharp, many users of MonoGame like to have a library like this to parse TiledMaps for their game. MonoGame however has its own way of loading assets using the content pipeline. And in order to make TiledCS work with MonoGame, some changes need to be made.
Hi
I'm looking for code examples especially to read all layers from a Tiled map.
Maybe you can make an 'examples' folder with code to do the most common things?
Is it also possible with this library to read the type of each Tile?
In my game I try to find out on which kind of tile (grass or road ..) the player is standing.
It seems Groups aren't supported, when I read a (v1.5) TMX file, which has layers in groups, those layers aren't available using map.Layers
, nor is there a map.Groups
property.
As the amount of contributors for this project seems to be growing, I would suggest adding a .editorconfig
file to the project. This file is a standard that helps keeping things like line endings, charsets, indents and whitespaces consistent.
It prevents and fixes problems with development across different operating systems and text editor configurations. For more information, check the .editorconfig home page.
Most popular text editors and IDEs support the .editorconfig
file. For instance, here's the VS Code extension that I'm using that updates my file with the specifications set in the file as soon as I save it.
I have an example of such file in my dotfiles repository which I'm pretty much copy-pasting into new projects I create.
As part of Tiled 1.5, they added support for Parallaxing object layers, would be handy for devs to have access to the "Parallax Origin" property they've added under the object layer (see here: https://www.mapeditor.org/2021/03/23/tiled-1-5-0-released.html)
Hello again!
As the title states, the TiledMap property "backgroundcolor" (as it is written in the .tmx file) is not available through TiledCS.
I'm not sure how this data should be represented in the class, but at least for my purposes it doesn't matter how it is stored as long as I can access it.
Bjorn himself made a good point in our Discord discussion that the helper method, GetSourceVector, is going to be a problem when new features are being introduced. Right now it can work based on the current requirements but in near features it may not be sufficient anymore. And that all have to do with the fact that the GetSourceVector method is not returning absolute pixel values, more like the horizontal and vertical position on the tileset grid.
So I am considering to introduce a new method called GetSourceRect which basically returns a basic struct of absolute pixel values.
STOP POLLUTING THE INTERNET WITH THIS SHIT SOFTWARE
A while ago a pull request got opened for the support of infinite layers. I had to reject the pull request but the need for it is valid and therefore I should look into adding support for it.
It would be useful if the default Type property was included in the loaded TiledTileset class members after being loaded. If you look in the .tsx file the type is defined alongside the ID within the tags. E.g .
I assume these types are usually included in Object definitions instead?
You can define custom properties for Object Layers/ Tile Layers themselves, similar to how you can define custom properties on Maps:
<objectgroup id="38" name="ForegroundShader">
<properties>
<property name="EffectName" value="Fog"/>
</properties>
</objectgroup>
My previous TiledSharp implementation relied on this for certain layer wide parameters, would be handy to have in TiledCS
One of the attributes in the resulting XML for a layer is opacity, I noticed TiledLayer
doesn't have this property. Are you accepting PRs?
While I was busy at work, a couple of new Tiled versions were released. With 1.7 being the current one. I support Tiled 1.5. so far but clearly need to put some effort into supporting Tiled 1.7.
Up till now the idea was to have the tiled maps being (de)serialized from JSON string input.. However, it has become clear to me that this approach may have been enough for earlier versions but I started realizing more and more differences between the XML format and the JSON format. Hence, simply (de)serializing won't cut it anymore. Therefore I would like to use a different approach.
With NewtonSoft.Json there is also the possibility to parse a JSON file just the way I am doing now with XML. This does require however that I have to rewrite both the TiledMap and TiledTileset classes entirely as parsing now have to happen in two directions.
I got some build warnings indicating there are some missing xml comments on some fields
I'm using TiledCS as an easy way to get data from Tiled maps, since I'm building my world out of 3D object tiles and wanted an easy way to edit maps, and it's been very helpful so far (thank you!), but, as the title states, I ran into a problem.
I'm guessing this is due to the tile flipping being stored in bits 32, 31, and 30, as specified here. However the tiles are read as signed ints, which can't hold values that large.
Here is an example of the error I get. Using Unity 2019.4.17f1 if it's relevant. I can supply the entire project if needed.
OverflowException: Value was either too large or too small for an Int32.
System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Int32.Parse (System.String s) (at <9577ac7a62ef43179789031239ba8798>:0)
TiledCS.Extensions+<>c.b__1_0 (System.String x) (at Assets/Scripts/TiledCS/Extensions.cs:26)
System.Linq.Enumerable+SelectArrayIterator`2[TSource,TResult].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
TiledCS.Extensions.AsIntArray (System.String[] src) (at Assets/Scripts/TiledCS/Extensions.cs:26)
TiledCS.TiledMap.ParseLayers (System.Xml.XmlNodeList nodeListLayers, System.Xml.XmlNodeList nodeListObjGroups) (at Assets/Scripts/TiledCS/TiledMap.cs:182)
TiledCS.TiledMap.Parse (System.String xml) (at Assets/Scripts/TiledCS/TiledMap.cs:116)
Rethrow as TiledException: Unable to parse xml data, make sure the xml data represents a valid Tiled map
TiledCS.TiledMap.Parse (System.String xml) (at Assets/Scripts/TiledCS/TiledMap.cs:120)
TiledCS.TiledMap..ctor (System.String path) (at Assets/Scripts/TiledCS/TiledMap.cs:83)
Game.Start () (at Assets/Scripts/Game.cs:29)
Hi! Thank you for this library.
Your example of use case is good, but not really clear in the context of Monogame.
It took a while to figure out how to use it with Monogame until I found this repo:
https://github.com/Temeez/TiledCS-MonoGame-Example
I think it will be very helpful for other people if you add this link to Readme.md.
The state of the visible flag for layers doesn't appear to match the state of the visible flag in the Tiled Editor or XML.
Currently this library only supports loading maps and tilesets directly from disk. In my project however I store multiple files in an archive and can't access them directly through a path. The Tiled objects already contain a private Parse
method which could be exposed to support loading from e.g. a string
object.
I haven't started using TiledCS yet but plan on trying it out instead of Monogame.extended. I've run into a few issues with trying to get extended to work with Monogame 3.8 related to content pipeline.
Thought Setup: In your example, and tameez example, both are showing different ways to iterate over the tiles in a map so they can be drawn. These are great, and a user of TiledCS can just take those and toss them in their project/game/etc.
Thought: What if TiledCS had it's own map.draw method that took (as input) functions that it would use to draw the tiles. Then your library could house the mechanisms to do all the heavy lifting, leaving the users with just creating a method that would be passed in for drawing the individual tile. Things like the camera position (world offset), zoom, could all be passed in along with the function.
Just a thought, I didn't see a discord or other option for discussions.
Hi, I've been tinkering with the library, and I felt like doing some additions I need.
I've forked the library here: https://github.com/vpenades/TiledCS
And I've did these changes:
I'm going to keep moving with my fork, but if you wish, I could open a PR now with all those changes.
Also, how's the status of #26 ? I've seen there's PRs in the works, but not merged yet?
One of my scenes relies on extracting the gid similar to how Tile Layers do it. However I noticed Tile Objects do not have the gid.
In the tmx file, here is an example on how a Tile Object looks inside an object layer:
<object id="1661" gid="496" x="864" y="160" width="32" height="32">
<properties>
<property name="ShadowOffset" value="-7"/>
<property name="Z" type="float" value="11"/>
</properties>
</object>
You can find the gid value inside the
(apologies for the issue spam, I'm converting my game from TiledSharp to TiledCS and its a bit of a hastle haha)
Hi
In the past I used TiledSharp and looped through a tiled map to draw it like this (below is TiledSharp code).
I changed the code to TiledCS and try to get all layers of a map using:
map.Layers[i]
then I can't get the list of Tiles by doing map.Layers[i].Tiles
There doesn't exist a way to get all Tiles from a layer. How to loop through all tiles then in a for-loop?
How to do this please?
Please give small code example for the 2nd for-loop to loop through all tiles of a layer.
`public void Draw(Matrix matrix)
{
spriteBatch.Begin(
SpriteSortMode.Deferred,
samplerState:SamplerState.PointClamp,
effect:null,
blendState:null,
rasterizerState:null,
depthStencilState:null,
transformMatrix:matrix);
for (var j = 0; j < map.TileLayers.Count; j++)
{
for (var i = 0; i < map.TileLayers[j].Tiles.Count; i++)
{
int gid = map.TileLayers[j].Tiles[i].Gid;
if (gid == 0)
{
//If empty tile then do nothing
}
else
{
int tileFrame = gid - 1;
int column = tileFrame % tilesetTilesWide;
int row = (int)Math.Floor((double)tileFrame / (double)tilesetTilesWide);
float x = (i % map.Width) * map.TileWidth;
float y = (float)Math.Floor(i / (double)map.Width) * map.TileHeight;
Rectangle tilesetRec = new Rectangle((tileWidth) * column, (tileHeight) * row, tileWidth, tileHeight);
spriteBatch.Draw(tileset, new Rectangle((int)x, (int)y, tileWidth, tileHeight), tilesetRec, Color.White);
}
}
}
spriteBatch.End();
}`
I can't find a good resource to write my own Tiled Map to load the MonoGame Pipeline Tool. Any suggestions?
Change ParseObjects as well.
if (node.Attributes["rotation"] != null) { obj.rotation = float.Parse(node.Attributes["rotation"].Value); }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.