• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by SirGive · Jun 02, 2011 at 05:28 PM ·

Simple RPG Algorithms

I'm having trouble coming up with attack, defense, etc. curves. I want these all to be interdependent on 4 basic stats. For instance, we have strength, constitution, intelligence, and dexterity. I'm trying to have them all curve up, but I want the values to progress in a nice slow upward way.

I have (x*x+x+3)4 for experience and it results in a pretty nice curve, but the formulas I'm using that are similar to that are giving me garbage for values of health, defense, attack, and damage. How are algorithms like these normally structured?

A google search hasn't helped me any. :/

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SirGive · Jun 02, 2011 at 06:21 PM 0
Share

Seriously? I thought this was a pretty basic and an easily answered question. All my curves are too sharp. I forgot how to even them out.

avatar image Chris D · Jun 02, 2011 at 06:34 PM -1
Share

It's not a Unity question, though...

avatar image SirGive · Jun 02, 2011 at 06:43 PM 0
Share

Its a program$$anonymous$$g logic issue within Unity. Its as relevant as can be. I'm not asking for algorithms to put in UD$$anonymous$$.

avatar image SrBilyon · Jun 02, 2011 at 07:19 PM 0
Share

He needs to know of RPG growth algorithms so that he can program them into Unity. Seems relevant enough. I just remembered that I wrote a formula a few years back on RPG stats increase on level up. I'll add an answer once i find/remember it.

avatar image DonaldTheDeveloper · Sep 03, 2016 at 09:01 PM -1
Share

Progression on the Unity Asset Store does all of this and more: Xp/Level $$anonymous$$anagement, xp booster, xp groups, leveling curves definitions, level scaling.

It is a great learning experience that will $$anonymous$$ch you how to create a very manageable system that will work with any game type or genre. (Especially $$anonymous$$$$anonymous$$O's)

https://www.assetstore.unity3d.com/en/#!/content/69124

4 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by SirGive · Jun 03, 2011 at 02:02 AM

Though SirVictory's answer was on point, randoms would just not work for me. I want a constant curve that allows for a continuing variable. Using my original curve, (x*x+x+3)4 I just had to extensively tweak it for the values I wanted. It is important to view certain points that you want the player to progress and be at. A visual of the different values was extremely helpful.

alt text

These values are accumulated to the whole, so the curve turned out pretty nicely.

alt text

The only thing I really had to do differently was find the end value I wanted and beginning value I wanted. I was able to accomplish this by scaling the original formula for different values. For instance, dividing it by 30 gave me a nice range for my attack value.

So pretty much, for those of you having trouble finding formulas, find a nice curve that you like and tweak it for each of your other stats.

Credit for the graphs and "pink" table goes to SirVictory.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SrBilyon · Jun 03, 2011 at 02:07 AM 0
Share

Thanks for the credit :D

avatar image
1

Answer by SrBilyon · Jun 02, 2011 at 07:25 PM

Here are some nice algorithms used in FF6, will add a stat growth algo if I can find it. http://www.rpglegion.com/ff6/ff6alg.txt

Here is some pseudo-code from memory on how I would implement it:

 var level = 1;
 
 //Default Values - Knight//
 var attack = 4;
 var defense = 2;
 
 //Tweak to your desire
 var atkMin = 1.2;
 var atkMax = 3.5;
 
 var defMin = 1.1;
 var defMax = 2.8;
 
 //You can multiply or add, multply will most likely give you bigger values :D
 attack = attack + (level + random(atkMin, atkMax));
 defense = defense + (level + random(defMin, defMax ));
 
 //Forgot how to round numbers in Unity :D
 attack = round(attack);
 defense = round(defense);


Not around a calculator or IDE, so can't really test it out for myself at the moment.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SirGive · Jun 02, 2011 at 07:42 PM 0
Share

Can't really use a random, as the stats have to be set for each player. Let me look into these, and thank you for answering this "non unity " question.

avatar image SrBilyon · Jun 02, 2011 at 08:05 PM 0
Share

You could have a different random range per class. The one above is "just for knights" or whatnot. $$anonymous$$y logic is really for a slope and not a curve, but maybe this can be a start.

avatar image
0

Answer by b1gry4n · Sep 03, 2016 at 09:53 PM

If you want a more visual control with your curves you can use the animation curve.

Then based off the players currentpoints divided by maxpoints (for stats) or simply plug in your "level" (0.1 = level 10 | 0.5 = level 50 | etc) you can evaluate the curve

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by blanklearn · Jun 07, 2017 at 06:34 AM

float wpnDamage = baseWpnDmg + lvlStrength + (lvlStrength*wpnStrengthModifier) + lvlSpeed + (lvlSpeed*wpnSpeedModifier) + (baseIncrementValue * (maxLevel/lvlStrength));

e.g: baseWpnDmg = 130; lvlStrength = 10; lvlSpeed = 8; wpnSpeedModifier = 0.6; wpnStrengthModifier = 0.6; baseIncrementValue = 5; maxLevel = 99;

wpnDamage = 130 + 10 + 6 + 8 + 4.8 + (5 * (99/10)) = 158.8 + 49.5 = 208.3

if we change lvlSpeed and lvlStrength to 25 and 30 respectively:

wpnDamage = 130 + 30 + 18 + 25 + 15 + (5 * (99/30)) = 218 + 16.5 = 234.5

to get a nicer curve you could experiment with changing the baseIncrementValue after a certain number of levels e.g: if (lvlStrength >= firstLevelCap){ IncrementValue = firstIncrementValue; } and so on and so on

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SrBilyon · Jun 07, 2017 at 06:37 AM 0
Share

Oh man, talk about a necro post ;)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges