Skip to main content
GameDev.net gamedev.net
🔒 Locked

Scalable Combat Formulas (Python)

Started by PseudoEvolution Jul 15, 2008 at 3:51 PM 0 replies 700+ views
Original Post
PseudoEvolution
PseudoEvolution
So I am working on the formulas for an RPG game and I have one started. It seems to scale fine for the first 10-15 levels, but after that it gets unfair. If any of you have some extra time, I would love some help modifying or even redoing a good formula for a fair combat system. My game is being tested based on 50 levels, but I might cap it at 100. I'm using Attack Points and Defense Points. If the attacker's AP > DP, then he wins. The only multipliers are gear points and personality/class. A defensive class gets 1% bonus to DP. An offensive class gets 1% bonus to AP. I want someone who is a couple of levels lower, with good gear, to stand a chance against someone of a higher level with mediocre gear. For example: A level 35 with level 35 gear should stand a chance against a level 37 with level 34 gear. I hope that covers everything, here's the formulas I've been testing: Points=(30L*(L/5))+rand(L,(L+10))+(20L)+B L = level, B = Gear Points + Class Bonus Gear points = item level * 20 Class Bonus = 1% of AP or DP (after gear is applied). Of course, if someone has a mixture of lvl 7 and lvl 8 gear, it would be a float of 7-8 and so on. Here is the code I'm using for testing combat simulations (using Python). It simulated 100 battles and gives the # of wins:

import random

La=50 #Attacker's level
Ld=50 #Defender's level
Ga=50 #Attacker's Gear level
Gd=50 #Defender's Gear level
Ga = Ga * 20 #Attacker's Gear Points
Gd = Gd * 20 #Defender's Gear Points

WLAVG = 0  #Win/Lose Average

for i in range(1,101):
        AP1 = (((La*30) * (La/5)) + random.randrange(La, (La+10)) + (La*20) + Ga)
        DP1 = (((Ld*30) * (Ld/5)) + random.randrange(Ld, (Ld+10)) + (Ld*20) + Gd)
        DP1 = DP1 + (DP1 * 0.01)
        if AP1 > DP1:
                WLAVG += 1
        
print WLAVG,"% Wins"

So if anyone can fix my formula to scale better. I couldn't find any good formulas online that would work with my game, so I'm just doing it from scratch.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.