Game Mechanics what's the relation of the sprite size with the tile size?

Sevorih

Member
Hi, I've been new to this journey of making games. But in some tutorials on the internet I've heard some people talk superficially about this topic, when they always have their player sprite in the same size as their tiles. Is there any specific reason for that? Can I make a diferent size tileset from my player sprite size in a easy way?
Really curious about the answers, thanks in advance for whoever tackle this topic!
 

Greenwitch

Member
Well, it all depends what you wanna do with it. Generally, it doesn't matter. Maybe you wanna make a rogue-like dungeon crawler where your sprites have to sit perfectly within each square? In that case, why the heck not. It's all back to however you see it fit.

But in terms of other things, no, it's irrelevant. You can make your sprite any size you want as well as your tileset.
 

JackTurbo

Member
Also depends largely on your art style and perspective. In my game for example most my characters are around 1 tile wide but between 1.5 and 2 tiles tall (although their collision masks are just slightly smaller than one tile).

But then I'm not using grid based movement or anything.

Like most things in game dev there are multiple approaches and which is best will largely depend on the specifics of your own project
 

Yal

šŸ§ *penguin noises*
GMC Elder
There's plenty of reasons:
  • Having characters take up roughly 1-2 tiles makes collision checking much easier, since you can get away with checking just their corners for collision with the tiles most of the time. Characters that are much bigger than a tile easily can get a tile stuck inside them if you just do this, on the other hand.
  • This also applies to secondary uses of collisions, like pathfinding and finding valid positions to spawn randomly-spawned objects.
  • Having tile sizes be pretty big means you can more easily measure distances in the level editor, instantly seeing if a jump is possible or not just by counting how many tiles big it is.
  • Having tile and sprite sizes correspond to each other makes it easier to have a consistent graphical style among all your assets.
 

kburkhart84

Firehammer Games
Besides the above mentioned things, I just want to say that you should at the least make sure that you are using the same size pixels for everything. Tile size compared to sprite size isn't near as important. This is an issue because if you are making pixel art stuff you don't want to be scaling stuff very much because having different pixel sizes clashes bad usually.
 

YanBG

Member
I decided to go with a method from DIablo 2. Tiles are larger(160x80) but split into regions of 5x5 for collision checks. No graphic is wider than a full tile and large objects like gates won't clip with the player character(depth is checked on the 5x5). This also reduce the seams and you can draw nicer large patterns for floors etc.
http://paul.siramy.free.fr/_divers/dt1_doc/
 
  • Like
Reactions: Yal

curato

Member
I usually find it better to have the tile set be slightly smaller than the characters then use two tiles for doors and narrow hall ways so they don't look huge but are big enough things don't get stuck trying to walk though.
 

Yal

šŸ§ *penguin noises*
GMC Elder
I decided to go with a method from DIablo 2. Tiles are larger(160x80) but split into regions of 5x5 for collision checks. No graphic is wider than a full tile and large objects like gates won't clip with the player character(depth is checked on the 5x5). This also reduce the seams and you can draw nicer large patterns for floors etc.
http://paul.siramy.free.fr/_divers/dt1_doc/
That's a cool piece of trivia! I know several NES games used similar "macro tiles" because 8x8 tiles were too small and saving a whole level's worth of them would use up too much memory, but I didn't know it stuck around back in early PC days as well.

Slightly related, bunched-together assets made from several small individual assets are making a resurgence these days, but it's more to save level designer's time than to save memory:
 

YanBG

Member
That's a cool piece of trivia! I know several NES games used similar "macro tiles" because 8x8 tiles were too small and saving a whole level's worth of them would use up too much memory, but I didn't know it stuck around back in early PC days as well.
Yeah i just found it, while trying to model stone walls like in D2, it's a pretty simple but nice trick, because i already had issues with the regular 64x32(or 96x48 whatever) because some of my props were larger and were clipping or if smaller made the empty space of the tile not passable. Walls on the outer edge of the tile are now here, tbh this was possible with my older tile mechanic(there were different sprites for inside/back of the house) but the collision is only as much as the wall is thick:
 
Top