This is some old-school game dev efficiency vs. the modern brute-force mentality. Indie devs are rediscovering and reinventing things the big studios have forgotten and schools no longer teach.
I got a little bit into game boy game making & is crazy too wrap your head around all these limitations. But once your understand you have so many ideas to optimise
@@matthewcharles9813 While there can be nothing wrong with starting a new project, it can become a bad habit of constantly restarting and never finishing. This can happen for many reasons, commonly by passing the honeymoon phase of your project, where difficulty starts to ramp up. Why it shakes me is what it can do to a dev who stays stuck in the loop, it's happened to me for a time and I know plenty of devs who have been stuck in a loop constantly restarting projects or changing the scope/design of their games for years and never finishing anything.
@@sylvan4042 I'm kinda in this stage right now, everytime I start on a project and it gets boring, I move on to a new one that I find interresting. Do you have any tips for getting out of the bad habits?
I will never forgive youtube for the 1.5 year period where all I got recommended was garbage slop content and couldn't find awesome channels like this.
@viralshark but I don't like looking at that kind of stuff on RU-vid! And any suspicious activities I do are Done on another browser (Tor), under different accounts with separate email addresses using SimpleLogin...
Don't forget to clean your watch and search histories on RU-vid so they don't keep recommending what you accidentally clicked. And choose "Don't recommend this channel" to avoid what you dislike. From this point on you can manually key in what you want to watch.
I think the craziest part of this is that it's the first time anything in the world of graphics programming has actually made intuitive sense to me. Instead of having each time correspond to a world tile and have 9 neighbors, each display tile corresponds to a corner and only has four neighbors. The display tiles don't have a "base tile," they are only made by combinations of neighbors. I didn't even plan on making a 2D game but it's a cool hack to know!
this is the opposite of a hack, it simplifies the design concisely rather than working around a design limitation by generating unmaintainable excess or unsupported behaviour.
Not really a hack like MagicGonads says. Say you make 16x16 tiles. All this process does is cut the 16x16 tile into 4 pieces that it can then choose from to use for the actual tile you wanna place. Now granted the program here can do this automatically. But even for paralax mapping this works wonders and can help you a lot.
Old programmer here, and I'm so happy that all of this is having a revival! I remember that problem from my DOS games too well. Many opted to just not build on unsuited border tiles, before this came along (and then it all went out of fashion together with times based games). At least opting for this solution is a no-brainer, as opposed to the question how to layout isometric maps: diamond shaped or square with offset odd rows. Maybe that discussion is coming back, too 😊
This may be the single best game design video I've ever seen. It gives an interesting idea. Shows how it works. Suggests where you can get more detailed information. And gives a code example. Perfect.
"I think this scope will be a lot smaller" it's like famous last words. haha. Hope it actually is smaller in scope because we all been in the situation when it starts "small" but it becomes big after a while. Best of luck!
This is super helpful! At this point whenever I see you post I just wonder what I'll be refactoring in my game next. Thanks so much for sharing. Looking forward to your new project!
Thank you SO MUCH for 1. Exploring the different standard tile set sizes, 2. Showing an example in a game engine, and 3. Linking to more educational tools and videos. I was literally searching for this information and having trouble finding it, and RU-vid recommended this to me. Thanks again! Subscribed.
I remember coming up with this exact system for one of my games, and once I did I was honestly amazed that an idea like this wasn't already well known and used in the wider game industry. I remember the reason I looked into it was because I wanted to make a level editor with slopes, but in a way that's more free-form than something like mario maker 2 (where slopes are this dedicated object that can only be used in specific ways). Eventually I realized that trying to account for 8 neighboring tiles in my algorithm would've been nigh impossible once slopes were brought into the mix, so in my search to simplify things I came up with this system. Even ignoring slopes it made everything so much simpler, and expanded the options I had when designing tiles (now they're allowed to extend outside of the grid rather than being strictly limited to it, which was another issue I had). In the end I found that I would need 20 different slope tiles for every type of slope I wanted in the game along with the 16 base ones, so I can only imagine how many that would've been had I had to worry about 8 neighbors instead of 4
casually dropping the most GOATED tutorial i've ever seen in my entire life, if i hadn't watched this video i would've literally never even thought something like this was possible. The amount of time this saves is incredible. 10/10 would learn again.
I just have to say this: In my eyes, this video is exceptionally good. It's informative, sticks to the topic, no unnecessary long intro and a nice flow and commentary. This is what I like to see when I go on RU-vid to find a solution to a problem. Great job, keep up your good work and best wishes for your games! :)
This is more widely known as "corner tiles", as a variation from "edge tiles" (which are themselves more widely known as Wang tiles, from the guy that invented them). I love these, they let you do hand-made transitions between tile types and there's up to 4-color (4 different "terrain types") packings so you can smoothly transition from any tile to any tile as required (since each tile can have at most 4 different colors, 1 per corner, if you have more than 4 colors you just make additional sets). I've been working (for a long time) on a few variations on these, for even more flexible and organic looks. I expect to publish my results somewhere somehow.
I'm so impressed by people like you who seem to get so much done in your spare time devving. I'm also a spare time dev and it's such a struggle to get progress done being a busy adult!
It's really interesting watching how it actually works. I actually "discovered" this method while creating a cistom tileset for RPG Maker, I was trying to figure out how it worked and came to the conclusion the tiles were divided (More than what is shown) so it can "Build" all the tiles combinations
This got me more invested into working on my 2.5D game using pixel-art without the anxiety im having from working on a lot of tiles for it, thank you! And goodluck on your game!!!!
We use tiles and meta tiles all the time in GBA development! Having a handful of 8x8 tiles create a wide variety of 16x16 tiles really saves space and compute time. And layers/transparency really help too.
I was thinking that too. It's basically exactly marching squares, except that the lookup table contains bitmaps instead of edge lists. It also leaves out the interpolation step, but interpolation wouldn't do anything here because the original scalar field is binary anyway. That does bring up the possibility, though, of having individual tiles be procedurally generated according to up to two line segments, and doing the full marching squares algorithm to generate those line segments in each tile. Then you could have a "strength" for each tile, rather than simply being on or off. Implementing a countour-lines-to-tile generator with a rich looking output would be really involved, of course. Edit: Alternatively, instead of having "strength", you could make the actual game logic tile grid higher resolution than the display tile grid, then apply a scaling filter to it to get the field to apply MS algorithm to. So each display tile, for example, could cover a 3x3 grid of game tiles. You scale that down to get a more smoothly varying field to compute the contours of.
That is a good analogy! When I started building tile systems, I came from a background of working with marching squares (I built software to convert implicit surfaces to meshes) so I didn't even occur to me that there would be other possibilities than the "dual grid system" 😅 I considered the ground type to be located at the corners of the tiles and the tiles interpolating/blending between them. This means that I wouldn't consider there to be 2 coordinate systems involved.
@@feuermurmel I’m working on a side project using marching cubes and voxels right now, and I keep having to remind myself that the voxels are offset from the cubes as I think through details. It would be interesting to build a voxel rendering engine which uses 3D “tiles” and a 3D version of the dual grid system. You’d have to make 256 tiles for that, although you could start with 15 and add special cases when you want to break symmetry.
@@chaumasI've seen it done lately in what they call "Wave Function Collapse". It's built on top of a grid system and they need matching tiles, so they use variations on these ideas. It's perfectly doable in a regular 3D grid with cube tiles. If you introduce tile rotation, you can drastically reduce the number of required tiles (you can do that in 2D as well)
@@feuermurmel Yes! this kind of tiling is commonly known as "corner tiles" for this same reason. You can just do a Bresenham line along your grid using it, although they are not very good at diagonal lines: either it's too coarse or it has too much repetition, depending on scale. The "blob" tileset does a tad better since you can spot diagonals within a tile and you can draw them as proper diagonals, but they're more tiles (which makes sense, since now you're accounting for diagonals). You can find 6x8 and 7x7 packings of these (with a tiny bit of repetition), though if you allow for tile rotation (which means the tile is not directional -- no shadows, no vertical hints) you can get away with just 15 of them (no packing though). Your lines will have 45 degree steps instead of 90 deg, which is better but still not great.
Funnily enough, I made a video on this exact approach back in April for my 3D engine. Since the original bedrock I was working with was a GBA game, I basically just went _"Beep boop"_ and took the tilemap approach of the GBA and earlier consoles used (2x2 metatiles made out of 8x8px tiles) With some elbow grease I've since squeezed the entire 3D mesh builder down to ~300 lines of code. You've got me wanting to release the source for my builder now lolol
Was very confused at the premise of this video for the first couple minutes, until you got to the part explaining why you weren't just doing the type of tileset at 1:45, haha. In any case, this is neat.
I like the idea of discovering plants and then farming them. You can have different biomes and then have to simulate their native habitat to grow them successfully indoors.
Wow! This video really helped me decide how I want to go about tilesets for my games. And I was so pleasantly surprised by how good your games look! I especially love the character design from your newer idea, and how the plants bounce a bit when you place them. It's so dynamic and lively!
amazing, i was having this exact problem implementing fog of war (that i was using tilemaps for so i could have a nice 90s rts style hand drawn fog edges) and came to the exact same solution of offsetting the grid, after a week of pulling my hair out trying a million different approaches. then this video drops literally 24 hours after i figured it out and the algorithm recommends it to me. incredible.
Great video! I've run into problems like this with tilesets before and thought there must be a better way. The video editing and presentation is also top notch.
The moment the three tile sets popped up on screen, my first thought was "couldn't you write a small program that would generate the second two from the first one?" I'm glad that turned out to be exactly where this was going.
Haven't been following anything you've done, as this is my first time your video has popped up from youtube's 's algorithm, but it has completely derailed my plans for tiles in a very positive way. Thank you!
What a treat to get more of your content! I'm exited to see how I can leverage the dual tile system in the future. Thank you for providing starter code, it's been fun to explore. I appreciate that you showcase other creators and supply references. I first saw your amazing water shader on a different channel only to find out that specific creator did not come up with it or reference you in the video. And another one within the last week who claimed they made a BEAUTIFUL ocean when it is exactly your shader. It's so easy to give credit where it is due, especially when you have so graciously provided the code on github! Really excited to follow along on your creative endeavors!
Thanks for making a video about this. I haven't thought about this problem in many years but I'm glad to now know that there was a great solution for it. It kind of makes me want to design a game with a grid system just so I can use it.
Awesome video! I've started my transition into Godot recently by remaking an old fire emblem-like project and have been wanting to try implementing a dual grid setup for it. This helped a ton!
One of my first game projects, when I was in high school, I made an isomeric game with a large tile based world. I solved this problem using exactly one tile per type with perfect overlapping... The bottom two edges of the tile image extended about 1/4 or so down over the next tile, with the pattern background broken up with transparency. They were drawn in order from the bottom of the screen up, left to right, so each tile's "overhang" would just blend itself into the next tile down in a consistent manner. A few tiles, like bricks or other construction, had a property that raised the Z level to avoid the overhang when needed. When you have a tile system that supports it, this is a really, really easy way to get seamless blending for any number of tile types. And because the blend still applies between tiles of the same type, having multiple variants of the same type quickly leads to a ton of variation as any two tiles next to each other will create a subtle variation as if you had exponentially more variants (make 4 grass tiles, now you have, effectively, 16 unique variants of tile based on which ones overlap, lol). I used this one more time on a square grid (overhang was bottom and right), and it works just as well there too. Honestly, I don't know why I haven't seen it used elsewhere.
Great video. RPG Maker only requires 6 tiles, and then it automatically cuts those up into quarter-tile pieces and recombines them in various ways to generate a 47-piece set for you. It's super convenient. I reversed engineered it years ago and implemented my own version in Java. One of these days maybe I'll try doing it in Godot.
This is SO helpful. I haven't worked much with tile maps, but it was something on my radar as something to get more familiar with. This likely saved me hours of trial, error, and research. Thank you so much!
Oh, I have been coding for 40 years, and doing gamedev as a hobby most of those years as well as professionally the last couple of years, but I had never heard of this system before. Amazing :)
Perfect explanation of everything tiles-related, plus easy to understand description of how dual-grid works, in 6 minutes and 20 seconds! Thank you! Instant-subscribe!
ooo ive watched all of thinmatrixes videos but mustve forgot abt this when i started my own game. very good explanation love your videos as always girl! my existing approach for my game i think is quite unique so ill share here. i made two tilemaps, one for a “base” layer and the other as the “main” layer. i made one set of border tiles that i use as a mask so any main layer tiles can border with any base layer tiles. this does limit which tiles can border which, but means you dont have to do make any variants of tiles! and since i only planned to have a few border tiles anyway this worked for me perfectly.
Neat! I've thought of this for when drawing every single combination would result in an explosion in the tile count. Overdraw is kept in check since it's at most 2 layers. I did a small proof of concept with plain-color tiles and it worked beautifully!
This is great. I love the content, and as a game dev, these tips are really useful. Just want to let you know, as of Godot 4.3, TileMaps are deprecated in exchange for multiple TileMapLayer nodes instead. The code is almost the same, except for a few things. Overall, love the channel! Thanks for the great content!
Another old programmer here, I love coming across Computer Science solutions like this. Great example of using less in a more efficient way. I also enjoy the relative simplicity of the code too. I'm surprised this isn't already a part of Gadot for standard use in 2d sprite games.
I'm stunned by how beautiful your games are. I'm a person who rarely comments on videos, but your explanation, passion, and creativity made me do this. Good luck with your game!
With the 15 piece tile set think painting vertices instead of tile centers (you could also just offset the grid you use for painting, I think). For 47 (blob) tiles it works well to paint the first 16 (which is enough for the top of a wall or a road) and autogenerate the rest (quarter the tile, see the rpg maker autotiling system). Dual grid seems great, but I don't think it is easier than the other methods, my intuition is what corners you want to have rounded is the deciding factor. E.g. for the top of jrpg style walls I would want sharp corners. Also keep in mind that using transparency and layering tiles is an option to reduce tile requirements. It is definitely possible to make autotilesets with a small amount of graphical work. In 3D it is even easier, because you don't have to bake the lighting, can stick meshes into one another or hide bad geometry by sticking geometry on top. E.g. for a wall in 3d you only need a pillar and a wall (or even just a single wall if you use the right shape).
What I find cool about this is that no quarter-tile is redundant. Which means you can implement this as 16 16x16 tiles, or as 64 8x8 tiles, with no changes to the art.
Instant subscribe, amazing video! I find most content makers on YT bloat their content, please don't change this format, the plug was short and sweet and left me curious about your projects, the video itself was highly informative, honestly I'm gonna go watch all your content now.
wow this is the no joke the best video ive seen on tiles. all the basic tileset tutorials only covered the 15-piece tileset (and didn't call it that so i had no idea there were more variations lol)
Something that can likely be done to improve this as well (assuming you don't want unique connections between different pairs of tiles) would be to change the tilemap configuration from comparing two SPECIFIC types of tiles (like how it compares grass to dirt), to instead simply comparing "this" to "other". Then, you draw the two layers of the tiles separately from each-other instead of storing them in the same sprite such that they fit together like a puzzle piece. This would likely be done by using a bitmap to identify the frames for each tile, so if "this" tile overlaps in a way that would require it to draw the frame with index 1011, then the "other" tile will draw in that same location with index 0100, and those indexes will be picked to make them fit together like jigsaw pieces. Just like that, you don't need a tile to represent every connection between two different terrains, you just need the 15 frames for grass, 15 frames for dirt, 15 frames for sand, 15 for water, etc. Otherwise adding new terrain types would DRASTICALLY increase the required frames because you would need separate images for grass to water than dirt to water than sand to water, and all other combinations.
This video is incredibly useful! I have just started my game dev journey and tiles (drawing in general) have been very overwhelming. I made my first grass as the 4x4 grid and used the webtyler tool. Thanks for the tips!
wow this is a very nice approach. For my own game, i made it before watching this video, the tiles are 16x16 but the textures are 8x8 and i draw 4 mini-tiles per game tile.
wow this seems like no brainer now that I'm actually seeing it, I can't believe I hadn't seen this technique before, I think I'll be using this but for isometric tiles
in the making-of documentary for the 2019(!!) NES game Micro Mages, the devs talk abt how they overcame a similar conundrum to create the most space-efficient graphics set they could. worth a watch here on RU-vid
I adore you channel and the calming, educational yet enetertaining spirit you have. It is inspiring to me as a young aspiring game developer. Thank you for the video. Please keep posting!
Another way to handle the coordinate system is to use double-resolution addressing. With this, your world coordinates have double the resolution of your grid. Then, when accessing the world grid, you left shift the coordinate by one, eliminating the lowest bit. When accessing the tile grid, you also left shift but then add the shifted out bit to the coordinate. This, obviously, can be combined with the pixel coordinate grid; e.g. for 16-pixel tiles, the lowest 4 bits of the coordinate would be the pixel coordinates within a tile, with the 4th bit the one that gets added to the tile grid when shifting out.
You can wrap the logic for transforming between the two grids in helper functions. Most languages will compile helper-functions out of the finished product entirely, so they usually don't have runtime cost. Also helps keep that logic consistent in your code since you don't run the risk of making mistakes down the line.
This also makes level generation about 10000x easier. No need to worry about which wall is facing what direction, just fill WALL or FLOOR, then do a post process step on all tiles to check their neighbours and solve what their appearance should be that way. Of course, this is computationally expensive, but if you are just doing it when you initially generate your world, it's not a problem!
You can solve the corner issue of the 16-piece subset by having multiple layers to get the shape you want. The problem is that this forces you to have multiple layers, and overlapping tiles. The dual-grid system is genius!
the song that begins at 2:28 (space chillout by penguinmusic) is a great choice btw, sounds so nostalgic of old flash games like william and sly. which feels fitting for small game devs who perhaps grew up with those games and use them as inspiration :]
This is the ideal devlog/tutorial structure, thank you! I haven't thought about this before. After watching I noticed something cool: not only is it 'dual grid' because of having... two grids... but if you interpret the grids as planar graphs then they actually are 'dual' in the sense of 'dual graph'! For planar graphs, a dual graph is one where the faces become vertices (typically their orthocenter), the edges become edges (typically their perpendicular bisector), thus the vertices become faces. Noticing this actually means it generalises to different planar graph worlds for generating 'vertex colouring' (what we would call the idea of assigning a number (e.g. a sprite index) to each vertex in the graph- but in the dual graph these assign numbers to faces). The question is (outside of square grids) how useful is that for compactly representing the adjacent tiles?
I made a plugin for Godot called Better Terrain that features a big improvement to the autotiling system in the engine. For a long while I've considered implementing a "dual grid" system, though there are a few tricky problems related to implementation that I haven't solved. This video was inspiring, seems like some of the old tricks are still alive today.
Oooo yess, I know Better Terrain! Such an awesome plugin, it was really helpful to connect all the different types of wall tiles in my game. Thanks so much for making it - truly a lifesaver :D
this video is marvel, and your channel is amazing, the uniform style of video ux and sound effects creates a feeling that i'm not watching a video but playing a game