View Single Post
  #13  
Old 09-25-2008, 06:42 PM
Cantus
Fire Beetle
 
Join Date: Sep 2008
Location: New York
Posts: 18
Default

Quote:
Originally Posted by ChaosSlayer View Post
I havent looked ta actual code but in order to minimize extra calculation in mind it would look like this:

You store ALL values in a table which is accessed by parameters of Level and Dly

When weapon strike you simly add X(a,b) to the final damage, where X(a,b) points the table with pre-calculated values
Hi, Chaos!

What you're describing is a brute-force lookup table... just one that's built on-the-fly (which would, in all likelihood, be slower than a comprehensive, pre-built static lookup table.)

There are three options for calculating damage bonuses:
  • A brute-force table like what you describe
  • A pure-formula approach where damage bonuses are calculated mathematically
  • A hybrid approach where formulas are used in cases where they're simple and fast, and tables are used for all other situations

I tried all three possibilities, and the third option -- the hybrid approach -- is what provided the best performance.

That's what's implemented here in this thread. As I mentioned above, testing (that you can easily re-create) proves that this function is a very efficient and fast way of calculating these values, and that it will have an absolutely unnoticeable impact on server performance.

Please don't think I'm shooting down your idea! It's a great one! I'm just pointing out that it was considered, tested, and found to be not quite as efficient as the solution presented in this thread.
Reply With Quote