Hot answers tagged

67 votes

How can I quickly check if my sprite tiles well?

Here's a quick hack that works with any image editor. If your tile image is called tile.png, create an index.html like this: <...
user avatar
  • 13.3k
37 votes
Accepted

Best practice for map coordinate system

Most games place the map origin in a corner. The main reason for this is that tilemaps are often internally stored in two-dimensional arrays, and most programming languages don't allow negative array ...
user avatar
  • 112k
35 votes
Accepted

Algorithm for procedureral 2D map with connected paths

One of the best, and most used, algorithms I've seen out there is generating dungeons using Binary Space Partitioning. The best general explanation I've read is the one found in The Chronicles of ...
user avatar
  • 2,298
30 votes
Accepted

What is the size limit to the Unity 2017.2 Tilemap?

Your RAM is your limit. The following tests were performed on a system with these specs: Intel i5-6600 16 GB RAM NVIDIA GeForce GTX 1070 Windows 7 Home Premium Here is a script I ran which grows a ...
user avatar
  • 112k
27 votes
Accepted

How to get all tiles from a Tilemap?

To get an array with all tiles from a rectangular area of your tilemap, use tilemap.GetTilesBlock(BoundsInt bounds). You will get a one-dimensional array of tiles, ...
user avatar
  • 112k
25 votes
Accepted

Generating tile map

What you could do is randomly generate a Voronoi map like this: Picking random center points (see the black dots) and randomly decide if they are grass or dirt. ...
user avatar
  • 10.5k
25 votes

Generating tile map

You could use perlin noise, which is normaly used for heightmap generation. Perlin noise in games Then you could use the heights as an adviser, how high the chance of grass/dirt occuring in one ...
user avatar
  • 465
18 votes

How can I quickly check if my sprite tiles well?

Using photoshop or GIMP, you can use the offset command. If you are working for say a 100x100px image, you can offset it 50px in each direction, and the seam where the image tiles together will be ...
user avatar
  • 281
17 votes

How can I quickly check if my sprite tiles well?

Krita has a feature that allows you to edit tiling textures and see the changes update live. By pressing the W key, it enables wrap around mode, which makes this possible. A youtube video of this ...
user avatar
17 votes
Accepted

Player gets stuck on edges between TilemapCollider2D tiles

After trying to write a code that merges the squares effectively (especially for large Tilemaps) both horizontally and vertically I decided to look if there is a better suited collider than the ...
user avatar
16 votes

How to get all tiles from a Tilemap?

Here is another way to do it with .cellBounds.allPositionsWithin ...
user avatar
14 votes
Accepted

Efficient way to calculate "vision cones" on 2D tile map?

Yay I found a research paper! In terms of computational cost Shadow Mapping seems pretty clear winner. Algorithm used can be found here and a C# implementation can be found here, relevant bit below. ...
user avatar
14 votes
Accepted

How can I fill the interior of a closed loop on a tile map?

Short: After completing the shape you should have a multiple of 2 Points for each affected row on your x-axis. From there it becomes just a matter of splitting up these Pairs of Points for each row ...
user avatar
  • 1,962
13 votes
Accepted

LibGDX keep camera within bounds of TiledMap

Alright, so you're working with two rectangles here. A larger static one (the map) and a smaller moving one (the camera) inside of it. What you want is to not let the bounds of the smaller rectangle ...
user avatar
  • 551
12 votes

Best practice for map coordinate system

In theory the location of the origin doesn't matter. All math operations you do when the map is rendered or when objects move on the map work fine regardless of where the origin actually. However in ...
user avatar
  • 2,353
9 votes

Generating tile map

http://gamedevelopment.tutsplus.com/tutorials/generate-random-cave-levels-using-cellular-automata--gamedev-9664 here is my version of the cellular automata method start by filling the grid with ...
user avatar
9 votes
Accepted

Are there definitive, unambiguous terms for hexagon tile orientations?

While I don't know of any truly official convention for classifying these, in the mathematical sense, I'll take Anko's advice and write up what I do know... Amit Patel (Red Blob Games) wrote what I'd ...
user avatar
  • 114k
9 votes

Is there a name for this technique to put the tiles on the corner of a level?

It's a palette. Same thing you see some artists doing with colors. They draw a group of a couple of the main colors or even a gradient going between them for easy access. It's much easier to use a ...
user avatar
  • 14.5k
8 votes
Accepted

Adapting tilemap algorithm to support isometric tilemap

You don't need to change the parser, just the renderer. The tiles will be at the 'same' place, except the projection is different. The good news is that the good context 2d can do isometric just by ...
user avatar
8 votes
Accepted

AI, Pathfinding - Searching Behavior

Complete vs. incomplete information What you are looking to do is path finding without complete information. The conceptually sound way to do this would require you to keep track of all of your non-...
user avatar
  • 3,855
8 votes
Accepted

Unity procedural TileMap generation without creating gameobject per tile

Here's what I'm aware of: Option 1. GameObject per tile. It's not completely horrible in certain cases. Depending on your needs, it could work.. well enough. Option 2. A single quad or plane ...
user avatar
  • 1,476
8 votes
Accepted

How can I procedurally find a wall that separates two or more points on a grid-based map?

I will present a general concept and three solutions using that concept. Concept is an Influence map: For each location in the map, you are going to store a number that represent the distance to each ...
user avatar
  • 18.5k
8 votes
Accepted

Strange warping/shimmering effect with Unity Tilemap and Cinemachine

Note that Cinemachine now has a Pixel Perfect extension that automates the kind of camera calculations I describe further down in this answer. Consider using that, and check the rest of this answer ...
user avatar
  • 114k
8 votes
Accepted

Is there a name for this technique to put the tiles on the corner of a level?

I don't know if there is a name, but this seems to be something you'd do to conserve memory. First, a basic tile is very low resolution - just a few pixels across. But when rendered, they are ...
user avatar
  • 10.3k
7 votes

LibGDX keep camera within bounds of TiledMap

You can easily clamp the camera position to the map boundaries like this: ...
user avatar
  • 707
7 votes

Generating tile map

Select a point on the map. Place desired tile type with a base value such as 40. Keep track of where you placed your newly desired tile. Add the starting point to a list. For each point in this ...
user avatar
  • 171
7 votes
Accepted

Drawing and scrolling very large zoomed tilemaps

Here are a few strategies you could try: Precalculate scaled-down versions of your tiles. When you use the full-scale tiles as source and let your engine scale them down everytime it draws them, it ...
user avatar
  • 112k
7 votes
Accepted

Storing walls that are between tiles

I start with coordinate systems — the coordinates for grid locations are (x,y) but as Krom mentioned in a different answer, for walls there can be up to two walls for each grid location. That leads to ...
user avatar
  • 5,886
7 votes

How can I deal with tilemap position in the editor?

The select tool. Clicking any tile with the select tool, the inspector will tell you the position relative to 0,0. With a little bit of math (and/or additional clicks), you can hone in on whichever ...
user avatar
  • 171
7 votes
Accepted

Tile palette off-centered

I fixed it by: 1.) Deleting my current tiles in the tile palette. 2.) In the inspector, after selecting the sprite that I wanted fixed properly on the tile palette, I changed the sprite's pivot ...
user avatar
  • 86

Only top scored, non community-wiki answers of a minimum length are eligible