tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Enable custom grid sizes or guidelines

Open ohthesetrees opened this issue 12 years ago • 21 comments

I'm building a game where a map contains one or more screens. Each screen in my game is 16x10 and the game scrolls screens (Zelda style) as you move around.

My main world map is going to be along the lines of 10x10 screens (give or take) and it would be extremely helpful if I could easily customize the grid or turn on an additional set of grid lines every 16 tiles horizontally and 10 tiles vertically.

ohthesetrees avatar Feb 20 '13 01:02 ohthesetrees

Yeah, that would be nice.

The sad thing is that somebody did a patch for this once, but it bitrotted for whatever reason (usually it's a time thing) and now I don't even know where it may be located.

bjorn avatar Feb 22 '13 20:02 bjorn

So I started working on this today because it's one of the two big missing features from Tiled that's really hindering my productivity (the other is reloading maps after running commands, something that I'm also going to be looking at). I'm very new to Qt so the UI aspect will be pretty rough but I've already got it more or less working for ortho maps. Still need to test iso and staggered.

When I do get done I'll submit a pull request with all of it. I'll need someone to help with all the UI and localization support, but otherwise it should be working.

ghost avatar May 24 '13 18:05 ghost

Ok staggered and isometric grids are much harder than orthographic. :) While I wish I could have gotten them, I need to work on my game. I can do a pull request if you want, even though guide lines don't render on anything but orthographic maps (but the support is in there to implement them). You can see the changes I've made here: https://github.com/nickgravelyn/tiled/commit/cbd041cbdaea5a6cbd7e107b5f77627c0c27bd26

ghost avatar May 24 '13 19:05 ghost

Opening a pull request would make discussing the change a little easier.

I think isometric should not be much of an issue, but staggered isometric is indeed a little trickier.

bjorn avatar May 25 '13 18:05 bjorn

Not sure if there was a way to nicely link this bug to the pull request, but I've got one. Still quite new to a lot of how git and github work. :) https://github.com/bjorn/tiled/pull/441

ghost avatar May 25 '13 21:05 ghost

It is an old issue but it seems that the pull request has not yet been accepted. This feature would be very helpfull in my case and for all game with subdivised level into shape of same size. Is there any chance to see this feature out someday?

alwex avatar Mar 08 '15 14:03 alwex

@alwex Sure, it all depends on how much time I'll be able to spend on Tiled.

bjorn avatar Mar 08 '15 16:03 bjorn

I too would love this feature. It is fundamental when editing levels where the features are usually 16x16 but the tileset is 8x8 as happens with retro development and elsewhere.

kdrnic avatar Jun 15 '15 03:06 kdrnic

Lactamid suggested this on the forum and provided a mockup of what it could look like:

y3ea7m9

I'll try to get around to this in coming months. Implementation wise, I would consider introducing this as a "major grid line" feature where every Nth line is drawn either at higher opacity. I'm not sure yet how I would handle staggered maps (including hexagonal), but I could leave this feature unsupported for those maps for now if it turns out to be complicated.

bjorn avatar Jul 04 '16 21:07 bjorn

I believe that would be satisfactory, yes. On the mockup, it seems the major lines are not sufficiently distinguishable enough (but that is just a matter of adjusting the colour).

kdrnic avatar Jul 04 '16 21:07 kdrnic

It is exactly what I need, looks great

alwex avatar Sep 25 '16 00:09 alwex

I implemented something similar (but probably more basic) years ago because we wanted to use a standard tile size for most things (16x16), but allow smaller variations (8x8) to be mixed and matched within each tile. If this is still a good way to implement this feature I can work on a new PR for it.

firas-assaad avatar Dec 29 '16 11:12 firas-assaad

Still interested in this, some of the previous suggestions look perfect.

HariEdwin avatar Dec 31 '16 05:12 HariEdwin

I was looking into adding a Grid Layer layer type, as then one would be able to have as many custom girds as desired, but the code to add a new layer type is strewn throughout so many files all over the project it has rather turned me off the idea.

not-surt avatar Dec 31 '16 09:12 not-surt

I implemented something similar (but probably more basic) years ago because we wanted to use a standard tile size for most things (16x16), but allow smaller variations (8x8) to be mixed and matched within each tile. If this is still a good way to implement this feature I can work on a new PR for it.

While your secondary grid implementation would be one way to solve this issue, I don't see how it would help to use 8x8 tiles for details on a map using 16x16 tiles, which is rather covered by issue #149.

I was looking into adding a Grid Layer layer type, as then one would be able to have as many custom girds as desired, but the code to add a new layer type is strewn throughout so many files all over the project it has rather turned me off the idea.

It's an interesting idea, but I'm not sure if it makes sense to add the grid settings into the map file and to place them in between other layers, as opposed to always rendering grids on top of the rest. I think more likely you'll want to configure various grids on a project level.

Design-wise I never had a reason to support a very large amount of layer types, so I'm sure you're right that adding a new type would touch quite a bit of files. Though mostly in a trivial way I think.

bjorn avatar Jan 02 '17 11:01 bjorn

I don't see how it would help to use 8x8 tiles for details on a map using 16x16 tiles, which is rather covered by issue #149.

We were actually using 8x8 tiles on the map, but the artist would design most tiles in 16x16 blocks. Most of the time you'd paint with a group of 4 tiles, but it was still possible to add details at 8x8 level. The 16x16 grid was just there as a visual guide.

The issue you mentioned is indeed a more natural fit, but adding a second grid to Tiled was a simpler approach that worked very well.

firas-assaad avatar Jan 02 '17 17:01 firas-assaad

The new multi-map world functionality in tiled 1.2 is nice, but there are some use cases that really require one single map split in "screens", so this would be really good.

I know few people using tiled that have this same use case and the usual workaround is basically adding one top layer with rectangles to provide a visual cue of the screen boundaries.

reidrac avatar Nov 27 '18 09:11 reidrac

What's the current status on this issue? If it's still open, I could try implementing it for at least orthogonal maps, since it's something that's currently relevant to me.

My idea would be to add an "enable extra grid" setting with an "extra grid properties" dialog (or something similar), where you could change the width and height of the grid (potentially also set an X and Y offset, which I assume could be useful to have in some cases).

RPGHacker avatar May 17 '19 21:05 RPGHacker

As a stopgap, I've been using a big .png file with a grid in an image layer for this, and it's sort-of OK. It'd be much easier if the image layer could repeat the image, so I could use a small file and not worry about map size.

zocky avatar Apr 10 '21 16:04 zocky

Any progress on this? My map is also divided into screens and I'd like grid to reflect this.

EDIT: Sorry, I've just found the setting in Preferences. I guess this issue can be closed then?

anrikun avatar Apr 25 '22 16:04 anrikun

EDIT: Sorry, I've just found the setting in Preferences. I guess this issue can be closed then?

I've kept this issue open because that feature only addressed a specific use case, while it would still be nice to provide something more flexible.

bjorn avatar Apr 25 '22 17:04 bjorn