It is currently Wed Dec 12, 2018 11:30 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sat Nov 17, 2018 2:43 pm 
Offline
User avatar

Joined: Mon Feb 07, 2011 12:46 pm
Posts: 1024
Oziphantom wrote:
This is basically how D&D works..

Roll for Attack, I got a 12
Roll for Defense, they got a 8

I did 4 damage.
I don't know what version that is.

OHRRPGCE has attack minus defense, and then multiplied by elemental damage modifiers.

GURPS has first you roll attack and defender rolls their defense (there are some choices to make on both sides); if the attack is a hit and defense is a miss, then you roll for damage, and then deduct the target's armour and then apply the wounding multiplier, and then a few other stuff if applicable.

_________________
.


Top
 Profile  
 
PostPosted: Sat Nov 17, 2018 3:39 pm 
Offline
User avatar

Joined: Sat Jan 09, 2016 9:21 pm
Posts: 518
Location: Central Illinois, USA
This FAQ explains in-depth how Dragon Warrior 1 worked.

The simple answer is:
Quote:
There are two formulas for attack damage for enemies. The standard range is
from:

(EnemyStrength - HeroDefense / 2) / 4,

to:

(EnemyStrength - HeroDefense / 2) / 2

_________________
My games: http://www.bitethechili.com


Top
 Profile  
 
PostPosted: Sat Nov 17, 2018 10:49 pm 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 106
Location: Edmonton, Canada
zzo38 wrote:
I don't know what version that is.

OHRRPGCE has attack minus defense, and then multiplied by elemental damage modifiers.

GURPS has first you roll attack and defender rolls their defense (there are some choices to make on both sides); if the attack is a hit and defense is a miss, then you roll for damage, and then deduct the target's armour and then apply the wounding multiplier, and then a few other stuff if applicable.


My example was loosely based on how Fallout 1-2 calculates the damage. I was trying to present the idea, not the actual system. There are many of them exist.


Top
 Profile  
 
PostPosted: Sun Nov 18, 2018 8:10 am 
Offline

Joined: Fri Feb 24, 2012 12:09 pm
Posts: 730
DRW wrote:
For example, this calculation:
damage = attack / (100 / (100 + defense));
where all variables are global zeropage variables of type unsigned char, requires 11 scanlines worth of CPU time.

Unsigned char means that your attack & defense values are in range 0..255?
Or is it only smaller range like 0..15? Then you could easily pre-calculate all possible results and store them in a table.

Ehm, how or why do you calculate "100 / (100 + defense)"?
The result would be always zero?
Unless defense were zero, or the unsigned chars were negative?
Or unless your unsigned chars were converted to floating point values? Floating point won't be very fast for sure.
Or did you use fixed point fractions not shown in the formula?

In general, "damage=max(0,attack-defense)" doesn't sound so bad. It's simple, and more or less logical.
If it works depends on what you are doing...
For example, a paper hat might help against rain drops, but not so much against bulldozers.
In that case the formula would be fine. But it might fail if you had other situations in mind.

PS. Just wondering "giving him more initial energy" means that the opponents are all males?
I've recently found a similar gendered sentence in old source code that I had written a few decades ago : )


Top
 Profile  
 
PostPosted: Sun Nov 18, 2018 9:48 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20863
Location: NE Indiana, USA (NTSC)
nocash wrote:
PS. Just wondering "giving him more initial energy" means that the opponents are all males?
I've recently found a similar gendered sentence in old source code that I had written a few decades ago : )

Use of "he" to mean "he or she" is older usage that may have been more common in previous decades.


Top
 Profile  
 
PostPosted: Sun Nov 18, 2018 10:52 am 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1765
Thanks for your tips.

I guess I'll do the simple max(1, (attack - defense)) then since it really seems to be used in a lot of places.
(I use 1 as the default value because enemies who can't be attacked and temporary hero invincibility are a conscious decision, so this shouldn't happen for regular calculations.)

The attack value gets calculated by hero attack value + weapon attack value + item attack value.

nocash wrote:
Unsigned char means that your attack & defense values are in range 0..255?
Or is it only smaller range like 0..15?

Probably in the higher range, i.e. not just 1-15.

nocash wrote:
Ehm, how or why do you calculate "100 / (100 + defense)"?

It was a calculation that I found on the internet. I didn't actually use it myself. But yeah, for int values, that's indeed not a good approach.

nocash wrote:
PS. Just wondering "giving him more initial energy" means that the opponents are all males?

Seriously? :roll:

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group