Tilemap feature, seam fix

Discussion and feedback on Construct 2

Post » Tue May 06, 2014 10:13 am

@Captain - oh, I was talking about rendering at a fixed smaller size then stretching up (which is what low quality fullscreen mode does). Rendering an entire layout would be incredibly slow and wasteful, and downscaling can look ugly.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,228

Post » Tue May 06, 2014 10:36 am

Ok, I think I'm missing something here, because this is an issue with raster images generally (scaling that is).
B
12
S
3
G
4
Posts: 57
Reputation: 3,186

Post » Fri May 09, 2014 8:43 pm

One last suggestion: Using double-buffering, where the tilemap is rendered unscaled and then render the buffered image scaled onto the canvas? Of course only the relevant region of the tilemap needs to be rendered. Perhaps this is really inefficient, just a thought.

Just trying to help, and I do have years of experience as a CAD developer (not that I know much about javascript or game development).
B
12
S
3
G
4
Posts: 57
Reputation: 3,186

Post » Sat May 10, 2014 3:57 am

Thanks everyone for the input so far!

@Ashley True, it would cause edge glitches in some cases, but the artist could keep those to a minimum if they know the limitations. Right now, I use a method I haven't seen discussed on the forum yet. I replace all tiles in a tilemap with a single sprite and set its animation frame to that of the tile ID. The frame in the sprite is the same as the tile map except that it overlaps adjacent tiles by one pixel. because I want to use pixel graphics I enlarge them by a scale of 4 that way linear as opposed to point doesn't mess them up. The result is ultra clean pixel art that I can rotate and scale arbitrarily. It takes a lot of time at the moment, cutting up a tile map, enlarging the border so it has an overlap of 1px plus a 1px transparent border. But I can make some code to do that via .net It is not without its limitations of course. You have to know exactly what tiles can go together or you get some weird seaming still. It, unfortunately, is necessary in my game. I need scaling and rotation of the entire screen. I want to use tilemaps because they are a quick way of making a scene for the game, though, at this point I only use block 0 and another script auto-maps the correct tiles.

At this point, I am okay with this workaround, but I figured the workaround could be made more efficient if construct helped out with the process. I know it is less efficient, but I figured its no different than a game that doesn't even use a grid (like aquaria). Can I get away with something of that nature and scale?

------------------------------------------------------------------------------------------------------------------------------------------

TLDR: @Ashley, is it too inefficient to not use the tile map but have a series of objects instead? Or will this be bad on lower end machines. I am targeting pc and so could care less about mobile. I already have to many things I need to make mobile not an option. Also, Thanks for the great work on construct! I have thought along time about the time map and can't think of a solution that is perfect either. It is a very complex problem.

-----------------------------------------------------------------------------------------------------------------

@Joannesalfa - you can get full screen quite easily with the tile map object like this (this does have some limitations/weaknesses depending on what you want:

1. Set the project to use crop
2. at the start of the game check the window size
3. Depending on how you want the game to scale (inner or outer) and what the minimum playing field is you do some math and arrive at a zoom level or scale factor (0-n) rounded to the nearest whole number (whether you go up or down depends on what you want and how you calculate it)
4. Set the layout scale to this number and viola.

The weakness of course is when you end up with a scale of near n.5 - you either have to cut a lot off or add a lot to the game giving a very wide range of potential screen sizes to work with.
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141

Post » Sat May 10, 2014 12:52 pm

As I already mentioned, breaking it up to individual tiles can be hundreds of times less efficient than the way the current tilemap object does it. It's very well optimised.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,228

Post » Sat May 10, 2014 7:02 pm

@Ashley

can this method i use for fixing seams in individual sprite tiles, not be used for tilemap?
example 16*16 tiles / resizing-scale canvas and zooming works
https://dl.dropboxusercontent.com/u/616 ... index.html

to convert this method to tilemap, i think something like this needs to happen.
so it would need a new generated/adjusted texture and tiles should be created with keeping the generated size in mind. (if you want to keep to size2 rule)

split image in array, tiles need to stay in displayorder of the sourcetexture, add 1px transparent border to each tile and fill this surrounding border with the vertical and horizontal adjacent pixelcolor of the tile (what essentialy is the fix for spritetiles) (actually if this works perfectly the displayorder shouldn't matter, but i cant test this because i only have 1 pixel padding per 2 tiles on exported map, so displayorder (grouped tiles) is essential in this case, and is also reason why i couldn't get it to work the first times)

the tiles in the end, use the correct size but use the coordinates of the padded tiles.

this will remove bleeding, will not show the transparent seam, plus if color value's mix on border of tile, it will mix same color of the padded border, so not visible.

the tilemap could use the generated texture to pick from, the array should be thesame, but could display it without the padding.

any reason why this should not work?
ImageImage
B
69
S
21
G
7
Posts: 827
Reputation: 10,017

Post » Sat May 10, 2014 9:16 pm

@ashley
my biggest problem with tilemaps right now is not with seams but with these artifacts.
as you can see for some reason when the system crops the tilemap in the import process the tiles take one pixel of the above(and left ,right ,bottom) tile although they are perfectly aligned.
please notice how in your tilemap it has taken the top line from the above tile and just a bit on the left because the left tile has only this much to take.
on the right it takes none because it has no other tile there.
if i add 1px of transparency and instead of 128x128 i make them 129x129 then the artifacts disappear but then the tiles have 1 px seam between them.
why is this happening?
if i cut them in Photoshop and import them as sprites they do not have this 1px artifact.
the are perfect.
this happens with your stock c2 platformer tilemap as well.
it is driving me crazy! :cry:

EDIT:because the pictures do not show here properly i attached them in their original resolution here:
https://www.dropbox.com/s/dq1auj4faoz73 ... .55.35.png
https://www.dropbox.com/s/m35nkclgmviea ... .51.32.png
https://www.dropbox.com/s/pvybifts7d3l0 ... .56.09.png
You do not have the required permissions to view the files attached to this post.
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Sun May 11, 2014 11:43 am

@Roccinio

if you will succedd, pls make tutorial about Tilemaps & seams etc.
B
18
S
6
G
1
Posts: 783
Reputation: 4,187

Post » Sun May 11, 2014 12:32 pm

@Roccinio - it's exactly the same issue, nothing new: you either need to use letterbox integer scale, pixel rounding and point sampling, or low-quality fullscreen mode with pixel rounding.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,228

Post » Sun May 11, 2014 1:05 pm

@ashley or anyone that knows the answer.
sorry for asking again but i want to understand this once and for all.
i totally understand during runtime to have these artifacts and seams because of the way the gpu renders.
but why they appear in the editor?
why sprites don't have artifacts in the editor and the tilemap has?
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, blackhornet, Giggle Software, R0J0hound and 3 guests