647 reputation
48
bio website
location
age
visits member for 3 years, 1 month
seen 18 mins ago

May
20
revised Algorithm for dividing a 2D grid into organic looking plates
added 24 characters in body
May
20
comment Algorithm for dividing a 2D grid into organic looking plates
I've now updated the code slightly: the bit masks are gone and with them is the restriction of a maximum of 32 colors. The bit masks were used to store for each unfilled cell which are the candidate plates it could be assigned to. The new version simply looks that information up in the actual grid. Secondly, I added the border wrap-around. It turned out that both changes actually simplified the code somewhat. Last but not least, I changed some variable names for better readability. Enjoy!
May
20
revised Algorithm for dividing a 2D grid into organic looking plates
Updated the algorithm: no bit masks necessary, implemented wrap-around.
May
20
revised Algorithm for dividing a 2D grid into organic looking plates
added 2 characters in body
May
20
revised Algorithm for dividing a 2D grid into organic looking plates
Improved code legibility
May
19
comment Algorithm for dividing a 2D grid into organic looking plates
Storing the cells with adjacent plates might be useful if, e.g., you want to guarantee that the plates are (more or less) the same size.
May
19
revised Algorithm for dividing a 2D grid into organic looking plates
added 145 characters in body
May
19
revised Algorithm for dividing a 2D grid into organic looking plates
added 31 characters in body
May
19
comment Algorithm for dividing a 2D grid into organic looking plates
@ChristianGeese - Filled cells should never be overwritten: the cells array contains a list of all unwritten cells and a cell is removed from that list as soon as it is assigned a plate. This way it can never be overwritten. But now I'm curious: you say you already implemented it this way, yet a 500x500 grid with 6 plates take "forever" -- the above code, however, can fill 500x500 with 10 plates in under a second on my machine?!
May
19
comment Algorithm for dividing a 2D grid into organic looking plates
Well, you beat me to it ;-) But apart from that, I think it's useful in that there's some sample code to look at.
May
19
revised Algorithm for dividing a 2D grid into organic looking plates
added 740 characters in body
May
19
revised Algorithm for dividing a 2D grid into organic looking plates
added 740 characters in body
May
19
answered Algorithm for dividing a 2D grid into organic looking plates
Apr
1
awarded  Yearling
Mar
27
revised Licensing and commercial game development
Removed addressing and thank you note.
Mar
27
suggested approved edit on Licensing and commercial game development
Feb
6
comment how to detect collision with libgdx and tiledmap
How are your tiles represented internally? That is, how do you know where on your grid you have to draw grass, where to draw a tree, where to draw a wall, etc.?
Dec
8
answered How does Vector3.Angle compute the resulting angle?
Nov
18
revised .fnt font file offset issues in Unity
deleted 8 characters in body
Nov
18
revised .fnt font file offset issues in Unity
added 903 characters in body