Hot answers tagged

67

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: <body style="background:url(tile.png) repeat 0 0"></body> (Thanks @Deryllium for the simpler alternative!) Open that in a web browser. Whenever you need to check how well the image tiles, save it, and refresh the web ...


57

"Staggered" refers to the jagged edges of isometric maps that have an overall rectangular shape. These maps emphasize the north/south and west/east axes, and often have North up (example: Civilization 2). Diamond maps on the other hand emphasize the diagonal orientation and movement. North is often at the top right (example: Simcity 2000). Also ...


37

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 indexes. There are a lot of discussions about which corner should be the origin, but I don't consider any of the arguments particularly strong. In the end it's ...


34

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 Doryen (attached at the end for backup purposes) because explains the procedure without getting into the code, thus leaving the implementation to the reader. Two ...


28

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 tilemap by filling it with a single tile (32x32 pixels). The Method Grow() adds another column and another row to the current map. The method gets called 100 ...


25

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 region of the map is. Example (Perlin noise values from 0-256): If the value is over 200 the chance that grass is placed is 80% (dirt 20%). If the value is between ...


23

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. Then for over all tiles, check if it's closest to a center point of dirt or a grass. Done! If what you did previously is "flip a coin" for each tile (noise), generating a Voronoi diagram will ...


22

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, so you need to know by yourself when the next row of tiles starts. Any empty cells will be represented with a null value. If you want all tiles, use tilemap.cellBounds. This gets you a BoundsInt ...


20

Yes, they use tilemaps (more precisely : small 8x8 hardware tiles). The main reason is that background scrolling and sprites display on most 16-bit consoles are hardware accelerated (there is a dedicated hardware chip for that, VDP in case of genesis). The only way to use that feature on genesis is to divide the background and sprites into small 8x8 tiles (...


19

TiledMap tiledMap = new TmxMapLoader().load("path/to/tiled/map.tmx"); MapProperties prop = tiledMap.getProperties(); int mapWidth = prop.get("width", Integer.class); int mapHeight = prop.get("height", Integer.class); int tilePixelWidth = prop.get("tilewidth", Integer.class); int tilePixelHeight = prop.get("tileheight", Integer.class); int mapPixelWidth =...


18

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 displayed in the middle of the image. This page has screenshots demonstrating how this works: http://blogs.adobe.com/jkost/2015/01/how-to-create-a-seamless-...


17

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 feature in action is available here. (feature is enabled at 0:12)


15

After banging my head against this problem for a day I found a wonderful tutorial on the very subject over at Sion Dream. I knew there was a way to use object layers! In a nutshell, create an objects layer on your map (Tiled, Tide and the tutorial author's pick, Gleed, all provide this function), draw the shapes you want your Box2d static bodies to be, then ...


14

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. #region FOV algorithm // Octant data // // \ 1 | 2 / // 8 \ | / 3 // -----+----- // 7 / | \ 4 // / 6 | 5 \ ...


14

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 and then fill the inbetweens. Long1: This is not a complete algorithm. This is just a description of steps to be taken. How to achieve each step is up to the ...


13

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 move outside the inner bounds of the larger rectangle. // These values likely need to be scaled according to your world coordinates. // The left boundary of ...


13

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 PolygonCollider2D which I've been using. Then I stumbled across a certain component and now I feel really stupid... The trick to avoid the problem I mentioned in my ...


12

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 practice there is one reason why you might want to make the center of the map be the origin - and that is limited precision of floating point values. With ...


12

Here is another way to do it with .cellBounds.allPositionsWithin public Tilemap tilemap; public List<Vector3> tileWorldLocations; // Use this for initialization void Start () { tileWorldLocations = new List<Vector3>(); foreach (var pos in tilemap.cellBounds.allPositionsWithin) { Vector3Int localPlace = new Vector3Int(pos....


9

You can create tiled maps on without using .tmx. TiledMap map = new TileMap(); MapLayers layers = map.getLayers(); TiledMapTileLayer layer1 = new TiledMapTileLayer(width, height, tile_width, tile_height); Cell cell = new Cell(); cell.setTile(new StaticTiledMapTile(texture_region)); layer1.setCell(x, y, cell); layers.addLayer(layer1); Each of these ...


9

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 random then run these cullular automata rules on it a couple times If a living cell has less than two living neighbours, it dies. If a living cell has two or three ...


9

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 consider the definitive guide to using hexagonal grids in games. This guide uses the nomenclature: flat topped pointy topped So while it's not super ...


9

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 picker tool to select the next color than to go into the color picker wheel, fiddle around with it for a couple of minutes and pray it matches the rest of the ...


8

An alternatve would be to not place the power-ups near the players but at positions which involve taking some risks to get there. This way you would encourage players to stop hiding which can increase the fun-factor and would reward them for their "courage". On top of that no one could complain that someone was just lucky to pick up a powerful power-up ...


8

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 setting the right isometric transform. Once you set it, just draw in a regular way (including drawImage), and all will be drawn in the isometric way !!! magic !!!...


8

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-playing character's information state (i.e., the parts of the map they already have discovered). Local information A more workable solution in your case might ...


8

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 referencing a texture you create at run-time. You would essentially use your tile atlas texture to "paint" your map as one new texture. Depending on the size of your ...


8

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 color point. That way, for each position you can query how far it is from blue, red, green, etc. We call the result is the influence map. For more detail on the ...


8

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 magnified 2x, 3x, 4x, etc. and are much more "blocky" on the screen. Next, older games will have a block of memory dedicated to screen display - what is in that ...


7

I would go for the pseudo-3d approach and visualize the height with a vertical offset. To avoid the problem that parts of the map are concealed by cliffs, I would only use a few pixels per height level and avoid having differences of more than 4 or 5 levels. As you can see from this mockup, this is good for visualizing that the tile to the north is higher ...


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