-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for hexagonal maps #1
Comments
I've made a very basic impl. of a hexagonal renderer. Basic stuff works. Please have a look at it: https://github.com/maq777/tiled and tell me what issues/fixes have the highest priority for an possible inclusion on upstream. |
Hex maps have my vote. If I remember correctly hex maps were working some time back (around Tiled 0.5/0.6), at least there was an option for creating them. |
@LearnCocos2D Hex maps have never worked in Tiled Qt, but there was experimental support for them in the Java version of Tiled. The reason I've never merged @maq777 patch is mostly because I didn't like the implementation of the rendering, which I think is too inefficient. Of course, I expected to get around to doing a faster renderer sooner rather than later, but this hasn't been the case so far. |
As long as it works editing hex maps would be great, even if it may be slow or inefficient. You can always optimize or rewrite it at a later time if it's not fundamentally broken or incomplete (ie no select, no tilesets - I have no idea what the hex renderer does and doesn't do). |
@LearnCocos2D @bjorn F.Y.I. The impementation I provide is broken. Yes, it needs optimizations. But most of all it needs bug fixes. And the only feasible way to fix the selection problems is a completely new algorithm. I studied and found a new algorithm - unfortunately I didn't have the time to implement it (and now the theory is long forgotten). |
@maq777 No worries, we're all looking for more time. Yet, maybe @LearnCocos2D is right that it would be better to have an implementation that is not fundamentally broken rather than no implementation at all. On the other hand I've added an incomplete staggered renderer which, even though it's optimized, does not support object layers because I hadn't figured out a good way of handling those yet, and that confuses people... :-/ In any case, my approach would be to tweak the current staggered renderer to also work for hexagonal, since the rendering method is very similar. However, a solution will still need to be found for the object layers. I think the objects should use pixel coordinates for these types of maps and just ignore the projection (since the projection is irregular anyway). |
I would love to have Tiled support hexes. Many other applications I've looked into that support them are old and/or terrible. Please make this feature a priority. Thanks for your work so far. |
I love that this is the first issue ! In case some of you don't know about this yet, here's the new reference for hexagonal tiling : http://www.redblobgames.com/grids/hexagons/ The barycentric coordinates system is the way to go ! |
@Goutte Thanks a lot for linking that article, it's very useful! However, the article does not mention a "barycentric coordinates sytem". Is it mentioned under a different name? The article actually recommends its "axial coordinates", which seem to make sense to me. However, if any such alternative coordinate systems are to be supported it needs to be done in addition to supporting the "offset" coordinates, since that is the system supported by the old Tiled Java and is what cocos2d-iphone supports. |
Axial coordinates is just another name for barycentric coordinates, AFAIK. |
Well, I know offset coordinates and am familiar with the issues it causes with the editing tools in Tiled. However, as I said this mode needs to be supported for backwards compatibility. Of course it would be nice to support axial coordinates as well, and it looks like this system will work better with the existing tools. Though, I'm sure it will also need changes to things like line and circle drawing and of course the terrain tool, in order to work perfectly. |
For reference here are the forks I'm aware of that merged @maq777 hexagonal renderer with more recent versions of Tiled: @evant took that version and merged Tiled 0.6, 0.7, 0.8 and 0.9 into it: https://github.com/evant/tiled/branches/hex And here's another version by @chedburgh that rebased the commits on top of a more recent version of Tiled: https://github.com/chedburgh/tiled/commits/master |
I find a alternative way to build a hexagonal map using tiled map editor without any changes, my own practice is:
I create a test repo, hextiletest |
@go3k Ah, that's creative! |
@go3k looks cool, but this is hack. i think users needs real support for hextiles |
@Goutte - Thats a fantastic link! I originally wanted to use tiled for my map but i just decided to roll my own in 3d and that link provides a great amount of detail! Definitely helped me figure out some aspects of hex tiling =-D |
Any update on this issue? |
@anissen Nope, sorry. I've been trying to focus on getting a Tiled 0.10 release out for the past weeks. It has such a huge amount of new features that I don't really want to delay it further... on the other hand this is one of the main features still missing to make Tiled more complete. :-/ |
Thanks for your reply. It's perfectly understandable that you want to focus on finishing 0.10. I'm looking forward to it 👍 |
@bjorn Great to hear you are about to finish 0.10. I hope, you find the time to add hexagonal tiles later on. I guess, implementing hexagonal tiles is quite complicated, because those tiles can be asymmetric of width and hight. Beginning with evenly sized hexagonal tiles would be a great start. |
@tr37ion Actually 0.10 is out since a week now! As for hexagonal, I don't think the tile sizes will be problematic, it's more that hex needs additional rendering parameters. But maybe I will just support one variation at first. |
+1 about priority of that feature. |
+2 about priority of that feature. One from me and another from a friend of mine :) |
+1 priority. Also I might have some time to help out . ping me if you'd like the help |
@BenjaminFarris Thanks for the offer but I'm currently unsure what to ask help with. For me it's currently mainly a problem of getting around to it. In fact somebody has offered to sponsor this feature a few days ago, making it the first thing on my list. I will try to get this done in the next week. Once in there will be hex-specific improvements that could be made to the tools. Things like line drawing, copying regions or the fill tool do not work correctly on staggered maps currently. |
I've recently pushed my work on hexagonal map support to master so the daily builds include support for this now, at least two variations of "pointy top" hexagonal. Give it a try! One caveat is that currently a new hexagonal map will start out looking pretty much the same as staggered isometric. It is only after you increase the "Tile Side Length" in the map properties that it will start to appear hexagonal (since by default the length of the side is 0). I hope to get around to adding support "flat top" hexagonal later this week, and I'm also considering to add support for "hexagonal isometric", which would be a variation of the isometric renderer but with a hexagonal grid. |
Adding support for "flat top" hexagonal took way longer than I had anticipated. The main issue with it was that it meant staggering the X axis, which required a rather different way of rendering to keep the tiles in the correct order. I also did not find a nice way to share code like grid drawing, layer bounding boxes and converting screen position to tile position. But, it's now finally done and pushed as 915fd32. So, there is no support for "hexagonal isometric" yet, which I still hope to add later, but I consider this issue closed. The one problem with having to discover the "tile side length" property in the Map properties also remains, but I'll try to solve that later as well. Finally I'll also have to update the documentation about the new properties and how they affect the rendering. |
Modify workflows for our needs
Hopefully using a generic tile-shifting map renderer that could also be used for that kind of isometric maps.
This issue replaces the following issue from the old issue tracker:
http://sourceforge.net/apps/mantisbt/tiled/view.php?id=32
The text was updated successfully, but these errors were encountered: