• Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a \$25 Amazon gift card!

# thescholar

Member Since 19 May 2012
Offline Last Active Private

### Auto-tile system - algorithm to auto-generate hash table

30 October 2012 - 07:21 PM

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.

### How to match a 2d pattern in a 2d array?

30 October 2012 - 04:01 PM

I'm trying to figure out how it's possible to match a 2D pattern inside a 2D array as shown below;

2D array
1, 0, 0, 1, 0, 1
1, 0, 1, 1, 1, 1
0, 1, 0, 0, 1, 0
1, 0, 1, 1, 0, 1
0, 0, 0, 0, 1, 0
1, 1, 1, 1, 0, 1

2D pattern to be matched
1, 0, 1
0, 1, 0
1, 0, 1

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!

### Which branch of mathematics teach about pathfinding?

29 October 2012 - 06:22 PM

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.

Thanks for the insights!

### Scripting system, how to make C/C++ interpret Ruby Code

19 May 2012 - 04:16 PM

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?

Thank you and have a great week-end!

### NeHe Demo Collection?

19 May 2012 - 04:09 PM

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.

PARTNERS