[PLUGIN] Paster

Post your completed addons to share with the community

Post » Thu May 25, 2017 10:41 am

Prominent wrote:What I did was size the paster object to the layout dimensions, and then resize the viewport to the layout dimensions, paste the tilemaps in the order I want them, then resize the viewport back to the normal size. You have to resize the viewport because tilemaps won't draw tiles that are offscreen. If you have a lot of tilemaps it may take a second or two to paste them all, which means you'll need to use something to cover up your level while it is sized to the layout so that you can't see everything. I used a separate layer with black background and I make is visible during that pasting, and then invisible when the viewport goes back to normal. I also delete the tilemaps as they get pasted.


How exactly did you go about this? I couldn't find any actions for resizing the viewport. Only scaling for layer and layout. I'm curious to try a similar approach, to see if there's any performance benefits.
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320

Post » Thu May 25, 2017 4:28 pm

tunepunk wrote:
How exactly did you go about this? I couldn't find any actions for resizing the viewport. Only scaling for layer and layout. I'm curious to try a similar approach, to see if there's any performance benefits.


I believe it is Set Canvas Size, under the browser object. The first action in that object.
Another way you can do it, although it might be slower, is to pan across the layout and paste as you go- so you could find how many times the width of the viewport fits into the layoutwidth and reposition that many times pasting each time.. etc..
But I think it is quicker to resize the viewport since it requires less pasting.. The difficulty is hiding the view as you do that.
You might have to limit the resized viewport anyways if your layout is super huge, and reposition like a few times to cover everything (there is a max texture size of the paste/canvas?) idk.. I remember having some issue with super large layouts, and using a viewport of like 25% the size of the layout helped.

edit: btw, if you use multiple tilemaps that have reasonable complexity to them, you will get a huge speed increase by flattening it this way. Of course you lose the layering of all the tilemaps, but you could still have a few pasted layers and sort it all out. Definitely improves speed if you're using a lot of tiles.
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Thu May 25, 2017 9:29 pm

Tanks for the info @Prominent . I'm just curious, if there's anything else about this method using paster, that is better than just using a single large layout sized sprite? (if you create the whole map in one sprite, that is)? I guess the main reason behind this is to reduce draw calls?
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320

Post » Thu May 25, 2017 10:52 pm

@tunepunk , I guess it would depend on your workflow and how you're designing your maps, and the interactions with the map. In my case, I was designing a game that had the map procedural generated, so the terrain would always be different when the game was run. It would create the terrain in various tilemaps, and then I would paste those using the paster plugin, and remove the tilemaps afterwards.
For some reason the tilemap becomes very inefficient when you want to actually make an interesting map that has a lot of variation, and also use multiple tilemap layers. Actually the reason isn't a mystery- it actually is due to it having to change draw calls whenever the tile changes to a different type of tile.
So if you need a way to make adjustments to the map in the editor or maybe need to refer to the tiles or objects in order to setup other objects at the start, etc, then this becomes more useful.
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Sat Jun 10, 2017 7:58 pm

Hello, a question, is it possible to paste a tile of a tilemap object on the canvas ?.

For example, I have a 64x64 image and I want to use paster to paste an area of that image that occupies 16x16, I do not want to paste the complete 64x64 image.

Paster does not allow me to choose the area of origin that will be pasted in the canvas, paster simply paste objects or URI images but it does not allow to define the size of the source area (in this case it will be 16x16 of a 64x64 image) that will be pasted in the Canvas.

I would like to define:
X1 (x origin)
Y1 (y origin)
X2 (width)
Y2 (high)

So I would do, for example:
X1 = 16
Y1 = 16
X2 = 32
Y2 = 32

That is a 16x16 tile contained in the tileset of the tilemap object image, I select the area (which in this case would be a 16x16 tile) that I want to paste onto the canvas.

I hope you understand what I mean because English is not my mother tongue.
B
29
S
12
G
21
Posts: 783
Reputation: 14,417

Post » Mon Jun 12, 2017 5:36 am

@The Mnk
I'm not really making examples as of late, but two ways come to mind:

1.
you could make a second paster and set that to the size you want, then position that over the part of the tilemap you want, paste the tilemap, then paste that paster to the other one.

2.
another idea is to utilize the draw quad actions. You define the four corners, and the uv's of them of the texture of some object. More math to figure out beforehand is needed for this, and it would only work if you can grab the tilemap's texture, I don't think you can though.

Hopefully that can give some idea's. I haven't verified any of it so I may be off here and there.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Wed Jun 14, 2017 9:26 pm

R0J0hound wrote:@The Mnk
I'm not really making examples as of late, but two ways come to mind:

1.
you could make a second paster and set that to the size you want, then position that over the part of the tilemap you want, paste the tilemap, then paste that paster to the other one.

2.
another idea is to utilize the draw quad actions. You define the four corners, and the uv's of them of the texture of some object. More math to figure out beforehand is needed for this, and it would only work if you can grab the tilemap's texture, I don't think you can though.

Hopefully that can give some idea's. I haven't verified any of it so I may be off here and there.


Thanks R0J0 I will do the tests soon.
B
29
S
12
G
21
Posts: 783
Reputation: 14,417

Post » Sat Jun 24, 2017 1:38 am

Hi R0J0hound, can you add the following actions to the awesome Paster plugin?
1, appearance actions: mirror and flip
2, size & position action: scale
also, it would be great if new pasted in objects and new images loaded from URL could inherit the mirror, flip, scale properties
I think it would be handy for dress up games and house decoration games when you have hundreds of assets.
Thank you for the great plugins you had developed.
B
17
S
5
Posts: 31
Reputation: 1,150

Post » Sat Jun 24, 2017 3:47 am

Hi @tonypond
For mirror and flip you can set the width and height to negative. I find that more useful as the actions you refer to do that anyway and are redundant.
I didn't add scale as that's based on image size and I thought it made things unintuitive because you can change the texture size with the set resolution action. It can be done with the set size action if it's really needed.
So I think I purposely didn't add those two features.

Any pasted objects should draw exactly as they are overlapping the paster object. So that last bit should be true. I don't think you can load an image into the paster object but you can load it into a Sprite and paste it.

I'm glad you find it useful but I'm avoiding updating it unless I absolutely have to.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sat Jun 24, 2017 8:59 am

R0J0hound wrote:For mirror and flip you can set the width and height to negative. I find that more useful as the actions you refer to do that anyway and are redundant.
I didn't add scale as that's based on image size and I thought it made things unintuitive because you can change the texture size with the set resolution action. It can be done with the set size action if it's really needed.
So I think I purposely didn't add those two features.

Any pasted objects should draw exactly as they are overlapping the paster object. So that last bit should be true. I don't think you can load an image into the paster object but you can load it into a Sprite and paste it.

I'm glad you find it useful but I'm avoiding updating it unless I absolutely have to.


Thank you for the reply, i got your ideas, however, its too complicated for me because i have hundreds of assets with totally different image sizes.
i know sprites can handle scale and mirror, however, load image in sprite overwrites all instances with the same frame, In order to have 100 instances loading different images in a layout, i will have to add 100 frames to the sprite.
Anyway, thank you for trying to help, i appreciate it.
B
17
S
5
Posts: 31
Reputation: 1,150

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests