Skip to content
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 configurable layer height offset #4

Closed
bjorn opened this issue Apr 18, 2011 · 18 comments
Closed

Add configurable layer height offset #4

bjorn opened this issue Apr 18, 2011 · 18 comments
Assignees
Labels
feature It's a feature, not a bug.
Milestone

Comments

@bjorn
Copy link
Member

bjorn commented Apr 18, 2011

Some tilesets allow layers to be stacked to create varying heights. An example of such a tileset can be seen on Lost Garden:

http://www.lostgarden.com/2007/05/dancs-miraculously-flexible-game.html

Or for example this isometric outside tileset:

http://opengameart.org/content/isometric-64x64-outside-tileset

It would be nice if Tiled supported these kind of tilesets, by allowing maps to define a height offset between (tile) layers.

This issue replaces the following issue from the old issue tracker:
http://sourceforge.net/apps/mantisbt/tiled/view.php?id=88

@stefanbeller
Copy link
Contributor

I'd do it more flexibly, by having a layer offset for both vertical and horizontal (positive as well as negative).

@nobody-special666
Copy link

In addition to the heightmap offset,
also consider that some tiles are oriented differently (eg: top vs. bottom)
Usually tiles are drawn on top of the floor-level, but if you have a cliff/pit then
the tile should be drawn below the floor-level.

@bjorn
Copy link
Member Author

bjorn commented Jul 11, 2011

@nobody-special666, that sounds like an offset option for the tileset rather than the layers. See also issue #16.

@bjorn
Copy link
Member Author

bjorn commented Sep 12, 2011

#75 has been closed as a duplicate of this one.

@eropple
Copy link

eropple commented Dec 31, 2011

I've begun work on this on eropple/tiled, branch layeroffset. I may need some help finding my way around the Qt bits; I'll be hanging around #tiled while I work.

@noam-c
Copy link

noam-c commented Jul 21, 2012

Is there any update on this?

For now, I'm working around this by adding a "heightOffset" layer property and then correctly handling it in my engine (offsetting their location in the grid while keeping them drawn in the same place). It would be really nice if Tiled supported it directly, though.

@eropple
Copy link

eropple commented Jul 21, 2012

No update, sorry--got frustrated by the poor communication on the
Tiled team and wrote an in-engine editor instead.

-Ed (mobile)

On Jul 21, 2012, at 3:03 PM, Noam Chitayat
[email protected]
wrote:

Is there any update on this?

For now, I'm working around this by adding a "heightOffset" layer property and then correctly handling it in my engine (offsetting their location in the grid while keeping them drawn in the same place). It would be really nice if Tiled supported it directly, though.


Reply to this email directly or view it on GitHub:
#4 (comment)

@bjorn
Copy link
Member Author

bjorn commented Jul 22, 2012

Sorry to hear that @eropple. I generally try answering questions as fast as possible on both mailing list and IRC, but I'm also busy with my job, family and other projects, which can cause more time-consuming issues to lay around for a long time.

In any case if it was easier for you to write an in-engine editor than to add this feature to Tiled, then this was probably the right approach for you.

@eropple
Copy link

eropple commented Jul 22, 2012

Hey, it's no big deal - everyone gets busy. =) Dogfooding in the
engine was probably smarter for this project.

-Ed (mobile)

On Jul 22, 2012, at 3:16 AM, "Thorbjørn Lindeijer"
[email protected]
wrote:

Sorry to hear that @eropple. I generally try answering questions as fast as possible on both mailing list and IRC, but I'm also busy with my job, family and other projects, which can cause more time-consuming issues to lay around for a long time.

In any case if it was easier for you to write an in-engine editor than to add this feature to Tiled, then this was probably the right approach for you.


Reply to this email directly or view it on GitHub:
#4 (comment)

@prettymuchbryce
Copy link

Go easy on bjorn. He has worked hard to bring us a really great editor. :)

@therahedwig
Copy link

Any news on this? I would be really happy if there were a feature like this, if only it'd make isometric maps less esoteric and would also really help me as I use tiled to preview isometric tiles for this one weird project where the layers alternate between 20x20 tiles and 32x32 tiles.

@stawii
Copy link

stawii commented Jan 6, 2014

Any news on this? :)
I think it will be really nice feature in map editor. Ofcourse one need to do the same in game engine, but map editing will be easier / nicer looking.
Layer offset should be offset to previous layer not to ground! So you can easly change layer order and/or just type ie: 20px offset for ALL layers.
In other words: you dont need to calculate: 0 for bottom, 20 - first, 40 - second, 60 - third layer.. and when you change order.. WOOPS!?

Im also thinking about second way of doing this: global layer height offset - configurable when creating/editing map - so you have enter: tile width, tile height and layer height offset (tile depth?). Default layer offset = tile height. Then it can be changed in layer creation in same way as tile size can be changed in new tileset.

PS: Maybe just add one global layer offset without per-layer offsets as a quick-fix? It should be easy to implement. And if one need layers of "full-height" and "half-height" one can type "half-height" as offset, and use one empty layer over half-height to reserve space for full-height tiles.

PPS: I love this editor!

@bjorn
Copy link
Member Author

bjorn commented Jan 7, 2014

@stawii Please be careful with statements like "It should be easy to implement." unless you're willing to have a go at it yourself. While I have an idea of how it could be done, I can see numerous tricky things to solve like grid, selection and brush preview rendering becoming dependent on the currently selected layer and the map view needing extra space.

Also, my spare time is severely limited so I have to make priorities. Implementing features that I don't personally need is not something I can afford to spend time on, unless somebody offers to sponsor it for example.

Still, it's great to hear you love Tiled!

@asermax
Copy link

asermax commented Mar 5, 2014

I'm interested in this feature too, so I will give it a go.
I have started reading up the code and tried implementing the easy part: adding the properties to the layers and allowing them to be modified from the GUI. Also reading and writing the properties from TMX files.
Now I'm starting to work on the visual part, and as @bjorn said, it obviously has its quirks here and there; even more difficult if you're not familiar with the code :P
So that probably gonna take a while.

Anyway, I would apreciate if someone could give a look to the fork where I'm working at; this is my first time using C++ and Qt (I'm learning as I go) so I'm afraid I may be doing something unnecesary or wrong.
Any ideas or help into how to improve or where to continue will be welcomed.

Lastly, thanks for the great editor 😄

@asermax
Copy link

asermax commented Mar 22, 2014

Hi again. I think I was able to reach an usable state of this feature on isometric maps.
Neverthless, the changes I made touch some "core" (files like the renderer base renderer and the isometric renderer classes) and given that I'm new both to the codebase and the language, I may have changed something I shouldn't, either because it breaks something else or because it distorts the original intent of the design.
For now I will keep testing and trying to implement the feature for the other types of maps.
Plese do check the changes to see if they are good to go!

@bjorn
Copy link
Member Author

bjorn commented Mar 24, 2014

@asermax If you feel you would benefit from a code review, please open a pull request. I don't have much time and a pull request makes it much easier to see and discuss changes than digging through the commits in another repository. I see you've done a lot of work so please be patient with me!

@asermax
Copy link

asermax commented Mar 24, 2014

Allright, will do 👍

@bjorn bjorn self-assigned this Aug 17, 2015
bjorn added a commit that referenced this issue Aug 17, 2015
* Can be changed in Properties view (with undo)
* Is written to/from TMX and JSON map formats
* Is not used for anything yet

Issue #4
bjorn added a commit that referenced this issue Aug 24, 2015
This affected the following:

* Applying the layer offset to the TileLayerItem
* Translating pixel positions to tile positions in AbstractTileTool
* Determining the bounding rect of the map in MapScene
* Determining the area to repaint when map regions are changed
* Adjusting the position of brush previews and tile selection rendering
* Applying the layer offset in mini-map control
* Applying the layer offset when exporting a map as image
* Updating tmxviewer to support the layer offset
* Updating tmxrasterizer to support the layer offset

Issue #4
bjorn added a commit that referenced this issue Aug 24, 2015
The most complicated bit was to adjust the object selection tool to take
into account the layer offset during rotation and resize.

The other part that needed some adjustment was the create object tool.

Issue #4
@bjorn bjorn closed this as completed in 7f1adb4 Aug 24, 2015
@bjorn bjorn added this to the Tiled 0.14 milestone Aug 24, 2015
@therahedwig
Copy link

Awesome! Next version is gonna be exciting!

bjorn added a commit that referenced this issue Jan 11, 2016
Placing it between the main content and the footer seems suitable to me.

Closes #4
azagaya pushed a commit to EdenIndustries/tiled that referenced this issue Nov 6, 2023
updated qbs file for libtiled to solve naming conflict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

9 participants