
-----------------------------------
rownale
Thu May 11, 2006 4:37 pm

RPG game : battle formulas
-----------------------------------
hey im trying to make a battle formula for my rpg game but it isnt very good

damage := Rand.Int (strength, strength + extradamage)

strength is strength 
extradamage is default 2 upgrades with every weapon upgrade

i know its bad
my ranged one is even worse though lol

throw := Rand.Int (1, 100)
if ranged (which is 15 default) > throw then
put "You hit the enemy for",rockdamage (which is 1 default)
elsif...
put "you miss"

so yeah my battle formulas suck

-----------------------------------
Clayton
Thu May 11, 2006 4:41 pm


-----------------------------------
so what exactly is it that you are trying to get help on? contrary to popular belief we are not psychic here, plz provide a detailed description of your problem, thnx :D

-----------------------------------
rownale
Thu May 11, 2006 4:44 pm


-----------------------------------
I also would like to make weapon variables saved in txt instead of using tons of if commands but i dont know how to do that stuff either

-----------------------------------
rownale
Thu May 11, 2006 4:45 pm


-----------------------------------
my problem is that the battle formula is awful
and so if anyone has made an rpg and is willing to post their formulas for calculating max and min damage plz help

-----------------------------------
Clayton
Thu May 11, 2006 4:50 pm


-----------------------------------
if you want to check into i/o to file check the Turing Walkthrough, there you will find anything you need on I/O to file, as for battle formulae, it would be better to know what you are trying to make so we can better help you :D

-----------------------------------
Cervantes
Thu May 11, 2006 5:08 pm


-----------------------------------
I'd recommend using D&D (Dungeons and Dragons) type battle systems.

You'll need to learn to use higher level data structures. [url=http://www.compsci.ca/v2/viewtopic.php?t=9636]Types get you part of the way there, but really the best way to do this is with [url=http://www.compsci.ca/v2/viewtopic.php?t=10904]Object Oriented Programming.

Check out the Turing Walkthrough and work your way up to those concepts. You've probably got a long way to go before you can make an RPG. A lot of people have wanted to make RPG's but failed when they got part way in because they did not have sufficient knowledge of aggregate data structures.

-----------------------------------
do_pete
Thu May 11, 2006 5:20 pm


-----------------------------------
Also check out the RPG Guide.

-----------------------------------
rownale
Thu May 11, 2006 5:36 pm


-----------------------------------
k thanks

-----------------------------------
MysticVegeta
Thu May 11, 2006 5:47 pm


-----------------------------------
Some random formulae I could come up with are:


damage := Rand.Int (0 , x - defenseStrength) + Rand.Int (1, level) * c


x and c are constants.
As you can see, as the defenseStrength increses the domain for the Rand.Int decreases which means less damage as defense grows. the second part states that the more level it is, the greater the domain for the Rand.Int, which means the greater the chances to get more damage. You could be more creative and make x and c be variables depending on something else, for eg the level... this is a very basic formula, I am sure there are LOTS of other formulae for more accuracy...

For hitting the enemy... it could be:

hitChances := Rand.Int (0, x - enemyLevel) + Rand.Int (0, playerLevel) + Rand.Int (0, playerWeaponLevel)

if hitChances > c then
   put "YOU HIT HIM"
else 
   put "YOU MISS"
end if


Well this one is pretty easy to figure out... The more the enemyLevel, the lesser the domain for Rand.Int, the less chances for him to get hit + The more the player level, the more the domain for that Rand.Int, the more chances for him to get hit + The more the playerWeaponLevel, the more the domain of Rand.Int, the more chances to get hit...

The idea is the same.. again, this is very basic, people here come up with 1000X more complicated formulae but this is good to begin with :) Come on IRC to get more better ones from Cervantes, zylum, gandalf, martin, etc.

-----------------------------------
Darkmantis
Thu May 11, 2006 5:52 pm


-----------------------------------
I think it looks more professional to put the amount of damage done to the enemy instead of "you hit"

-----------------------------------
MysticVegeta
Thu May 11, 2006 6:01 pm


-----------------------------------
well yes ofcourse, if you read the syntax-heading, it says "Pseudocode", also the point of the post is to tell about formulae not about how appealing it looks to the player, not saying you are wrong or anything.

-----------------------------------
monkeynamedsteve
Thu May 11, 2006 6:06 pm


-----------------------------------
Hey, this game sounds interesting. Could you post a copy of the code please? Maybe you have and I'm just stupid. If so, sorry to waste your time.

-----------------------------------
rownale
Thu May 11, 2006 6:09 pm


-----------------------------------
k thanks for the formula mystic i might try that 

and monkeynamedsteve i never actually said anything about the actual game other than the battle formula...

-----------------------------------
monkeynamedsteve
Thu May 11, 2006 6:10 pm


-----------------------------------
Okies, then I'm jsut stupid.
Sorry bout that.

-----------------------------------
do_pete
Thu May 11, 2006 6:16 pm


-----------------------------------
If you really want the code for an RPG just go to [Turing Source Code], there are plenty there.

-----------------------------------
monkeynamedsteve
Thu May 11, 2006 6:20 pm


-----------------------------------
Na, I was just wondering what this one looked like, I'm not doing an RPG.
