Saturday, 15 March 2014

javascript - creating non-uniform spaces on game map -



javascript - creating non-uniform spaces on game map -

i need advice on creating game map. need create 1400 spaces on map. i'm imagining each space 1 of 10 different sizes - example, dozen 'size-10', 40 'size-9', etc., couple hundred @ smallest-sizes (this data-driven). there neutral space in center (probably bit larger others). i'd place these regions on game space randomly, there should no overlap, , no space between them. doesn't matter if total space rectangle. this effort, though it's out of league, led me research voronoi tesselations , find javascript implementation understand, examples i've seen utilize random points origins , i'm looking more custom result i've described above, might not way go. --- anyway, i'm open suggestions. please note i'm designer rather coder, coding own prototypes advice appreciated.

this seems similar knapsack problem if understand correctly. but, instead of optimizing, looking single solution. pretty hard problem seek , solve, both in terms of time complexity , in terms of getting reasonable (i.e. finishes in reasonable time) working. this interesting post (although deals optimization) - little work, furnish good-enough algorithm.

javascript html5-canvas voronoi

No comments:

Post a Comment