Recently I've programmed an auto-tile system for my game engine, which use 47 possible tile combinations. The technique is to check each of the eight adjacent cells ariound the center tile which are represented as a power of two, like so:
128, 001, 002
064, 000, 004
032, 016, 008
This method work great so far for me, the autotile system is assembled with the proper edge tiles automatically in real-time.
The real issue was to write the hash table of keys and values, which was EXTREMELY time-consuming. It took me nearly 6 hours to enter the values and make sure they're exact. See my hash table below.
My question: is there a way to auto-generate the keys/values of that hash table with an algorithm so that next time I don't have to enter it manually? I feel it's very important to ask because I will probably have to do it again for something else similar.
Let's mention that the 2D array can be larger in other contexts. I'm also using 0 and 1 as values, but it could be any other IDs. I just tried to keep my example simple. Anyone know what would be the most efficient and fastest way to match all patterns in the 2d array in a C++ or C# program (or whatever)?
It's for a game I'm trying to make. When clicking with the mouse the player set tiles on the grid, so in real-time I need to check if the pattern condition is met each time the player click to change a tile.
URLs or tutorials with similar topics would be greatly appreciated. Thank you for your insights!
So as the topic title already ask, which branch of mathematics teach pathfinding? I would like to learn more about similar process or topics. I remember having seen a mathematics book with some kind of pathfinding drawings (with nodes), I never could find it again.
Well, I have a bunch of scripts written in Ruby, and somehow I need C or C++ interpret this code to run it. I've never done this kind of task before, so I feel kinda lost. Anyone can guide me and recommend the proper tutorials, books or websites so I can make a good start?
Mm, I'm just wondering, there was once a section on NeHe's website with a collection of demos submitted by users, but it doesn't seems to be there any longer. Can we find this section again somewhere? There was lots of interesting demos there to study.