• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Tile set optimizations

Erayd

Member
Basically, is there a performance boost/loss between choosing a tile size of 8 or 6 vs 16? Currently I have a tile set I'm building out with the idea that everything is chopped up in 16 pixel segments. Which in some scenarios means I have a lack of precision and objects need to be moved around on the sprite sheet, thereby sometimes taking up more than the expected space because things just didn't line up.

In the screenshot below I depict a house made entirely using a tile sheet. On the same tile sheet is a window(highlighted in red). That window could take up 4 tiles based on its size, however because of the 16 pixel constraint, in order to draw it where I want on the house, it must take up 6 tiles which down the line could become troublesome when I run out of space.

I imagine choosing a smaller tile size on a 1024x texture sheet will slow the performance a bit but is it noticeable? Will it matter in the long run?

An initial test tells me I lose about 400fps off my 1600... wow. In case anyone is wondering, yes, it definitely matters.

https://www.screencast.com/t/4yLKxxr1oJhA
 
Last edited:
S

Sinaz20

Guest
I'm not sure if this will help you... but you could make that window centered in 4 tiles, and just change the snapping values of the room to place the window at the proper position... sprite placement in the room is completely arbitrary, and constraining to the grid snap is optional.

[edit]To be clear, after reorganizing the window in the tileset, halve the snapping value, and you'll be able to place it still where you want it, and precision snapped.

[edit2]This is apparently incorrect advice... nevermind.
 
Last edited by a moderator:

Erayd

Member
I'm not sure that's an option on tile layers. I think they're specially optimized for thousands of tiles at once and one of the constraints is that the grid snap is directly related to the tile set grid size. I can only do one snap at a time and making a smaller size essentially adds more tiles, creating a large slow down. The options to adjust the grid are greyed out and a google search tells me it's because it is a tile layer.
 
S

Sinaz20

Guest
Oh, sorry. As I think back to all the times i've done offset object placement in the room, I assumed I had done this with tiles at some point-- nevermind, then.
 

Erayd

Member
For more complex things like say an awkwardly shaped tree, I make those in to part sprite/part object. Object for the bounding box and the sprite as the top so I can add them in to the room in separate layers. The bottom will always be drawn before the player showing it "behind". While the top will be drawn "above" the player. It also goes through a filter shader to highlight misc objects behind it or a half alpha see through circle around the player. This all means I can put them in the room anywhere, pixel perfect(Without even thinking about code! :3). I'm simply trying to optimize the simpler things like houses and windows or ground because when I get to things like economics and AI, I need that CPU.

I shall live within the constraints, tis a small price to pay.
 
Top