Author Topic: Combat Balancing  (Read 6826 times)

Serefan

  • Guest
Combat Balancing
« on: January 05, 2012, 02:02:09 PM »
Hi!

I've been working on my RL for a while now, and just started on the calculations for combat mechanics (health, tohit, damage, etc.). After thinking stuff through for a while I've found myself going back to using log10-based calculations time after time; they seemed to always give the most balanced output.
My only question is, will the constant use of logarithms in my calculations have an impact on performance?

Brigand

  • Rogueliker
  • ***
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Re: Combat Balancing
« Reply #1 on: January 05, 2012, 02:26:56 PM »
For a turn based game? I wouldn't think so. The absolute maximum number of times per turn this calculation would be called would be equal to the maximum number of creatures you on the map (big O of n?)

Z

  • Rogueliker
  • ***
  • Posts: 905
  • Karma: +0/-0
    • View Profile
    • Z's Roguelike Stuff
Re: Combat Balancing
« Reply #2 on: January 05, 2012, 02:36:04 PM »
Yeah, my computer does this in one second:

  float s = 0;
  for(long double f=1; f<20000000; f++) {
    s += log(f);
    }

Replacing log with multiplication or addition is 10 times faster, and integer addition is about 20 times faster. I don't why it would be a problem for combat mechanics (100 attacks per second, what's that?).

Serefan

  • Guest
Re: Combat Balancing
« Reply #3 on: January 06, 2012, 06:38:58 AM »
Thanks for the input guys. For the record, as it stands the game is turn-based, but I would like to try and implement a real-time version as the project moves along.

guest509

  • Guest
Re: Combat Balancing
« Reply #4 on: January 07, 2012, 12:53:03 AM »
  If by real time game you mean action game then animation and hit detection would be replacing a lot of the hit calculations. And that would be even more process intensive.

wire_hall_medic

  • Rogueliker
  • ***
  • Posts: 160
  • Karma: +0/-0
    • View Profile
Re: Combat Balancing
« Reply #5 on: February 05, 2012, 07:00:57 AM »
Yahoo Answers says the average processor these days is about 2 GHz.  I think 2 billion calculations per second is more than you should really need.

And I agree that graphics are what will be the most processor-intense.