| Mirage Source http://www.miragesource.net/forums/ |
|
| Some Algorithm questions. http://www.miragesource.net/forums/viewtopic.php?f=201&t=3521 |
Page 1 of 2 |
| Author: | Asrrin29 [ Mon Mar 24, 2008 3:31 pm ] |
| Post subject: | Some Algorithm questions. |
Ok, now that I have most of my stats in order, I'm taking a closer look at my algorithms concerning damage and defense. I want to do something similar to WoW, where higher level players get penalized for wearing low level (and hence lower DEF) armor. I have my damage algorithm pretty much the way I want it, it's the defense thing that's killing me. I want to convert the Total DEF a player has to a percentage of damage reduction to apply to the damage received. right now I am trying to get the DEF minus a certain percentage of the DEF based on the item level and the player level. if the item level is too out of whack with the player level, it should take out a big chunk of the DEF. for instance a level 10 player using a level 10 item should get no to very little penalty, but a level 15 player would get a bigger penalty, but it's still worth using, and a level 20 player would be better off buying an upgrade, because the DEF bonus would be so low. Any math majors here want to help point me in the right direction? |
|
| Author: | Jacob [ Mon Mar 24, 2008 3:44 pm ] |
| Post subject: | Re: Some Algorithm questions. |
http://www.wowwiki.com/Armor Quote: Mob Levels 1 - 59 DR% = Armor / (Armor + 400 + 85 * MobLevel) Mob Levels 60+ DR% = Armor / (Armor + 400 + 85 * (MobLevel + 4.5 * (MobLevel - 59))) Simplified, the formula becomes: DR% = Armor / (Armor - 22167.5 + 467.5 * MobLevel) That's how WoW does it. |
|
| Author: | Asrrin29 [ Mon Mar 24, 2008 4:33 pm ] |
| Post subject: | Re: Some Algorithm questions. |
I'm not worried so much about NPC armor, more along the lines of player armor. I'm working on something to do with either a logarithmic function or an exponential function. As the player's level outgrows the item level of the armor, the percentage of DEF lost due to level disparity grows exponentially until finally it no longer becomes worth it to wear it. In this way you can have a low level reward that a person can use because of a high DEF, but it will encourage him to ditch it at some point as he has "outgrown" the armor, even if it has a better DEF then a higher level item. |
|
| Author: | Asrrin29 [ Mon Mar 24, 2008 5:20 pm ] |
| Post subject: | Re: Some Algorithm questions. |
Ok, I have an algorithm I think just might do the trick: Protection = DEF - (DEF * (e^((Ilvl-Plvl)/2.5)-1)/100) Ilvl is item level, Plvl is player level. For values < 5, the percent of DEF being taken off is < 6%. After that it grows exponentially until a level 20 player would get no benefit from the armor. I can tweak this even more (hopefully) to allow for larger disparities between levels the higher the level you are. (for instance, the difference between a level 5 and a level 10 is greater then the difference between a level 50 and a level 60.) EDIT: Protection = DEF - (DEF * (e^((Ilvl-Plvl)/((Plvl/40)-2.5))-1)/100) That slows the exponential curve down as you get higher player levels. at higher level like 60-70, a 10 or 15 level difference is about the same as a 5-7 level difference in lower levels. |
|
| Author: | Lea [ Mon Mar 24, 2008 10:10 pm ] |
| Post subject: | Re: Some Algorithm questions. |
How about Armor Level / Player Level * C + K for any constants C and K |
|
| Author: | Asrrin29 [ Mon Mar 24, 2008 10:54 pm ] |
| Post subject: | Re: Some Algorithm questions. |
that doesn't give me the scaling that I want. I know it looks convoluted, but the formula above allows for a sliding scale. As long as the player's level is relatively around the level of the item (because of the (Plvl/40)-2.5 the higher the player level the more "leeway" there is) then the penalty to the overall DEF is less then 10%. but after that you see a sharp increase of the penalty per level, and too far away from the item's level and you effectively have NO DEF. |
|
| Author: | Dragoons Master [ Sat Apr 05, 2008 10:09 pm ] |
| Post subject: | Re: Some Algorithm questions. |
I use this for player max hp: GetPlayerMaxHP = (Int((3000 * Log(GetPlayerDEF(Index) + 2000) - 22791) * Log(GetPlayerLevel(Index) * 10)) * ((Player(Index).Char(Player(Index).CharNum).BuffHP + 100) / 100)) It's a nice almost plain curve xD Took me a while to get it how I wanted, hehe. |
|
| Author: | Asrrin29 [ Sat Apr 05, 2008 11:05 pm ] |
| Post subject: | Re: Some Algorithm questions. |
That's pretty cool, but I just base MaxHP on a new stat, Con. and multiply it times the class HP. so mages would something like 4 or 5 hp per point of con, were fighters would get 8 or 9 or more. |
|
| Author: | Dragoons Master [ Sat Apr 05, 2008 11:15 pm ] |
| Post subject: | Re: Some Algorithm questions. |
I use the same curve just changing the multipliers a little to get the damage and things like that. For example, the damage is like this: GetPlayerDamage = Int(3000 * Log(GetPlayerSTR(Index) + 2000) + 1000 * (Log(GetPlayerDEX(Index) + 2000))) - 30403 So I consider Strength 3 times more than Dexterity |
|
| Author: | Asrrin29 [ Sun Apr 06, 2008 4:31 am ] |
| Post subject: | Re: Some Algorithm questions. |
strength and dex are treated linearly. Nothing affects DEF except for equipment, dex affects Ranged AP and strength affects melee AP, AP and weapon damage affect total player damage, which is affected by the protection afforded by DEF. at least in my game. |
|
| Author: | James [ Mon Apr 14, 2008 1:26 am ] |
| Post subject: | Re: Some Algorithm questions. |
You could do a mix of exponential and linear curves in the form of the golden function or a variation thereof. It's pretty nice and gives you really nice natural ratios. |
|
| Author: | Asrrin29 [ Mon Apr 14, 2008 2:04 am ] |
| Post subject: | Re: Some Algorithm questions. |
Golden ratios aren't exactly what I am looking for. Too arbitrary for what I intended. I have set up in my equation a way that allows for the range between level and item level to grow as the numbers get larger. Like I've said previously, there is a big difference between a level 5 and a level 10, but not much difference between a level 50 and a level 60, even though there are 10 more levels. it has to do with ratios yes, but not the way I like. Thanks for the tip though mag, I might look at using that in some other calculations. |
|
| Author: | James [ Mon Apr 14, 2008 2:25 am ] |
| Post subject: | Re: Some Algorithm questions. |
The golden ratio is far from arbitrary.... |
|
| Author: | Asrrin29 [ Mon Apr 14, 2008 2:47 am ] |
| Post subject: | Re: Some Algorithm questions. |
it's a self-repeating pattern of ratios that doesn't suite my particular purposes. I'm sure if you tweaked it enough it might work, but Unless I can find something better then the equation I've presented, I think I've got a solid system. |
|
| Author: | James [ Mon Apr 14, 2008 2:57 am ] |
| Post subject: | Re: Some Algorithm questions. |
the golden function is not a constant function of the golden ration, but onl,y has the golden ration at x=1 and the silver ration at x=2. >_< |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|