🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
I'm really considering making ANL a header-only library. Seems like it's small enough and specific-purpose enough (ie, not many modules of any given program should need to call into it) that doing so shouldn't hurt anything too drastically, and this way I wouldn't have to try to do binary releases. Thoughts? Yays or nays?
Previous Entry
Color Rotation
Next Entry
Minecraft on the XBox
Comments
yckx
I like the idea of header only libraries, but I'm not too familiar on what the downsides may be.
July 21, 2011 01:02 AM
I actually ran into a downside. ANL uses gradient look-up tables to generate the Perlin noise. These are static tables, and header-only libraries don't really like static data. Hard to avoid multiple-definition errors if the library is included more than once. I'll probably just stay the course for now, at least until (if) I can eliminate the static tables.
July 21, 2011 01:05 AM
It is, but then I was looking at more refactoring to the base noise generator classes to eliminate them. They're hefty enough that I didn't want them to be members of the generators, otherwise each generator would own their own copy. I could make them static members, but that just puts me right back to where I am now, needing a .cpp for static tables. Generating the tables at run-time still needs there to be a pointer variable, somewhere, that all the various instances can reference, unless I give each generator their own instance. There are a few other things I could have done like wrapping them in functions and taking the chance that the inline operator wouldn't be taken literally, and that the compiler would instead consolidate all the individual instances. In the end, my C++ kung fu isn't strong enough to come up with an elegant solution that doesn't require a huge amount of refactoring. I could spend the time refactoring it, or I could just keep it as-is and spend that time instead on adding more function types and writing more documentation.
July 21, 2011 03:32 PM
Advertisement
Latest Entries
Mechanics of Flow in Gold Rush.
6367 views
Gold Rush
5107 views
DungeonBot3000: Inventory and Items Display
5374 views
DungeonBot3000: Postmortem
5345 views
DungeonBot3000: Boss Fight Scripting
4782 views
DungeonBot3000: Friggin Laser Beams
5387 views
DungeonBot3000: Video
4528 views
DungeonBot3000: Stats, Combat, and Items
6429 views
DungeonBot3000
4744 views
Diablo:Immortal
13366 views
Advertisement