Jump to content
  • Advertisement
Sign in to follow this  
concerningluke

Stat modifiers in RPGs

This topic is 4381 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm building a space RPG. In the game, there will be many factors that modify the preformance of diffrent items. For example, a fighter's thrust value is 10 by default, but this can be changed. If the pilot's flight skill level is high, the pilot tunes the thruster preformance, giving it a 50% boost. If if a thrust booster item is added to the ship, the thrusters power is increased by 2. If the thruster get damaged, it's base preformance is reduced by percentage of it's health (so a thruster with only 20% of its health left would work at 20% of the base thruster power). There are even freeform attributes. The thruster be given the "sabatoged" attribute, so when it is used, it has a chance of exploding. The list goes on and on. My question is, what would be the best way to create a system that allows for many effects and values, while still retaining speed of operation and ease of programming. I'm programming with BlitzMax, if that helps at all. Thanks for your time.

Share this post


Link to post
Share on other sites
Advertisement
I would recommend having a base attribute along with an associative array of effects that are applied to the attribute. For example, as in your example, you'd have a thrust attribute. To change the base attribute, you simply change this value. To apply temporary or bonus effects, add a value to the array, and remove it when it no longer applies. For example, you can add a "booster"->0.5 attribute, indicating that a "booster" effect has been applied to thrust, increasing its base value by 50%. You can also have a set of predefined bonuses/penalties directly in the code itself. For example, you can always have a "pilot skill" bonus that applies no matter what other effects there are. You can use the key of each element of the array to remove a value when appropriate (when the "booster" item is unequipped, you can use the "booster" key to remove the bonus).

Finally, make a function (I only briefly glanced at what BlitzMax was; it looks like it uses BASIC, so you should be able to make functions) that provides the updated thrust value. You can either calculate the bonuses each time the function is called, or you can store it in another variable and update the value each time a bonus is added or removed. Which way you choose depends on how often you call the function.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!