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

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
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
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.
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.?
Aug
21
comment Transparent JPanel, Canvas background in JFrame
What's the purpose of that JPanel?
Aug
19
comment Why does my code dividing a 2D array into chunks fail?
Ah, ok, so you want the chunks for loading, not for collision detection.
Aug
19
comment Why does my code dividing a 2D array into chunks fail?
Are you sure you have to create a chunkArray at all? If it's just for collision detection, couldn't you still work on the original world array, but instead of checking all of it, limit the checks to a certain area of interets?
Jun
30
comment which quarter of a triangle the point is in
@MSalters Thank you, very good observation! By the way, I didn't mean to suggest matrices as the way to implement this, it's just to demonstrate the steps.
Apr
10
comment Can you adjust the proportions of a 3D model via scripting?
I think Esa's answer nails it (even without a code example).
Apr
10
comment Game loop in Javascript
Reading other people's source code can be an excellent way to learn things.
Apr
10
comment Can you adjust the proportions of a 3D model via scripting?
It's doable, but the result might not look very good. Also, I wonder if in addition to the body proportions you would also have to adjust the animations anyway to account for the different ages. So in the end, my gut feeling is that you won't safe much time doing a parameterized model over drawing the different ages separately, but the quality might be much worse.
Apr
9
comment Is any data structure more efficient than quad-tree for storing and querying points that lay within an OBB?
Yes, that's why I thought this datastructure might be (more) suitable for your situation. Glad I could help.
Apr
8
comment Is any data structure more efficient than quad-tree for storing and querying points that lay within an OBB?
What you probably want is to walk up and down the tree to determine areas that are close by.
Apr
1
comment Calculate turn rate between xy and target xy on a moving sprite with variable speed
Cool! Glad to hear you got it working. In retrospect, I think if I were to implement this, I would now prefer my second answer over this one.
Mar
27
comment How to translate swipe gestures into rotations?
Nice screenshot but where's your code?
Mar
21
comment How can I smoothly rotate a joint to an angle?
Could you show us the code you've got so far, please?
Mar
19
comment OOP architecture for Hero with many attributes
What exactly do you find "clumsy" about this design?
Mar
16
comment Cannot distinguish depth in an isometric cube
Is slightly changing the angle from which you view the world an option? Your problem arises because different blocks happen to line up perfectly from the current POV, so changing the pitch angle should help.
Mar
15
comment Swing for game development - regarding threads
What type of game are we talking about? More like Minesweeper or more like Minecraft?