K
Kululu17
Guest
Hi all,
I am setting up some of the basic variables for a game, and am trying to decide if I allow non-integer values for things like player HP, Hunger, etc.
The issue is with things that give bonuses, etc. Let say a weapon has a standard damage of 2, and I want a player skill to give a 10% bonus. If I use integer values, the bonus doesn't work 2.2 rounds to 2, so no bonus. That's just one example, but there are lots of things that I want to apply several bonuses to, which would create non-integer numbers.
I see three approaches:
1. Use really big numbers for everything so even with integers and rounding it will still work out (make the standard damage 20 instead of 2, and standard HP 1000, etc.)
2. Just use decimals, but round off when displaying them.
3. Switch bonus with probabilities - so 2 damage with a 10% bonus would be 2 damage 90% of the time and 4 damage 10% of the time... well you get the idea.
I know Gamemaker numbers are all floating point numbers anyway, but just wondering if there is some reason (other than ease of display) to keep everything as an integer.
Thanks!
I am setting up some of the basic variables for a game, and am trying to decide if I allow non-integer values for things like player HP, Hunger, etc.
The issue is with things that give bonuses, etc. Let say a weapon has a standard damage of 2, and I want a player skill to give a 10% bonus. If I use integer values, the bonus doesn't work 2.2 rounds to 2, so no bonus. That's just one example, but there are lots of things that I want to apply several bonuses to, which would create non-integer numbers.
I see three approaches:
1. Use really big numbers for everything so even with integers and rounding it will still work out (make the standard damage 20 instead of 2, and standard HP 1000, etc.)
2. Just use decimals, but round off when displaying them.
3. Switch bonus with probabilities - so 2 damage with a 10% bonus would be 2 damage 90% of the time and 4 damage 10% of the time... well you get the idea.
I know Gamemaker numbers are all floating point numbers anyway, but just wondering if there is some reason (other than ease of display) to keep everything as an integer.
Thanks!