This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Robot War => Your Projects
Author Message
Unregistered HyperCam 2

Super Elite (Last Title)

Joined: 10 Nov 2003
Posts: 4468

Posted: 02 Mar 2008 01:35:02 am    Post subject:

Here's a new idea for scoring. Before today, calculating damage involved subtracting the victim's DEF (defense) from the attackers ATK (attack) and a few other factors. This had a lot of problems because extremely strong and weak enemies were using the same set of rules. And no one wants for fight enemies that inflict 0 damage.

So this is the new plan...

Health Bars

Squidge enemy shown with 4, 3, 2, and 1 Health Points

It fits the game a lot better since you can tell at a glance how much HP is left. Most enemies have 1 or 2 HP to start with. Large ones like tanks may have 3 or 4. And bosses always have 5. Edgar himself can have up to 255 depending on his level.


No matter who's hitting whom, when an attack lands, there is a certain percentage chance the victim will lose 1 HP from its bar. This chance is shown below as P[hit] (probability of hit).

The Battle Equation...
[font="Courier"]P[hit] = 1 - k(1/2)attacker's ATK victim's DEF

The constant k hasn't been chosen yet, but it can be between 0 and 1. For now, I assume k=1. P[hit] itself is always between 0 and 1. Where 0 means 0% percent hit chance and 1 is a 100% chance.

Chance of losing 1HP from any attack
...So for example, if the attacker's ATK is equal to his victim's DEF, the attacker has a 50% chance of inflicting 1 HP damage for any on this particular victim. Or if the attacker was twice as strong, he has a 75% chance. x3 strength means a 87.5% chance. x4 means 93.75% and so on... The highest possible is 99.6%.

Expected Damage
To find out how long the average battle will last, we have to know the average (expected) amount of damage each hit deals out. Attacks do one of two things, hitting (1HP damage) or missing (0HP damage).

[font="Courier"]P[hit] = { 1HP, 1 - k(1/2)attacker's ATK victim's DEF
P[miss] = { 0HP, (1/2)attacker's ATK victim's DEF

The expected damage is:
[font="Courier"]E[damage] = (damage of hit chance of hit) + (damage of miss chance of miss)

Assuming the fighters are equally-matched from the Battle Equation...
E[damage] = ( 1HP 50%) + ( 0HP 50%)
E[damage] = 1/2 HP damage

It's okay that this isn't a whole number because it just represents an average over time.

Finding Average Length of Battle
To see how long this battle would last, you just take your opponent's HP and divide by the expected damage...

[font="Courier"]Length of battle = Victim's HP E[damage]
Say for example your opponent had 3 bars and you're equally-matched. Then it would take

Length of battle = 3 1/2
Length of battle = 6

6 attacks on average to beat it. Of course, there's a slimmer chance you might only need 3 turns. But averages are king.

There's a super-slim chance it could take dozens or hundreds of tries to land a single hit. Luckily, you can walk away from "freak enemies" at any time. Or, if you have HP to spare, you can simply dive onto the enemy to inflict the battle equation in rapid succession. :biggrin:

Ultimate Goal: Choosing k
From the battle equation you can see it has a big impact on how long each battle lasts. In general, a K close to 1 yeilds...

  • Shorter matches
  • Shorter gameplay
  • Predictability
  • Less dependence on luck
  • Player avoids fewer enemies
K close to 0 yeilds opposite effects. So there's a lot of pros and cons either way. But that's months away. Anyway, this system looks pretty good so far, so I'll probably stick with it. Cool

Last edited by Guest on 02 Mar 2008 01:33:46 pm; edited 1 time in total
Back to top
title goes here

Bandwidth Hog

Joined: 01 Nov 2005
Posts: 2007

Posted: 02 Mar 2008 09:31:14 am    Post subject:

I like the equations, but is that how the sprites will always appear? with the health next to it? or will it only show up when you actually deal damage to it? Is it going to have a major impact on speed to show the health bar (it looks like a separate sprite afaik)?
Back to top
Unregistered HyperCam 2

Super Elite (Last Title)

Joined: 10 Nov 2003
Posts: 4468

Posted: 02 Mar 2008 01:31:41 pm    Post subject:

That's a good point. I might have the game limit him to fighting maybe 3 or 4 enemies at once so thing don't get bogged down. And probably only enemies with normal HP will have bars (exploding enemies or indestructible ones would have none). The good thing is it uses CrASH_MAN's sprite drawer which is amazingly fast.
Back to top
Unregistered HyperCam 2

Super Elite (Last Title)

Joined: 10 Nov 2003
Posts: 4468

Posted: 24 Dec 2010 05:26:08 am    Post subject:

I'll probably be re-visiting this idea over the Christmas break. Currently, the physics uses the ATK vs. DEF differnce to decide how far to throw the victim. It's okay, but it doesn't quite make stat gains rewarding enough.
Back to top


Joined: 05 Jan 2008
Posts: 152

Posted: 26 Dec 2010 01:55:59 pm    Post subject:

I just re-read this (the first and subsequent posts) and realized an odd(maybe) similarity to another game. In Pokemon Red and Blue on gameboy the highest accuracy any attack could have was also 99.6 percent. In the case of Pokemon though it was a programming oversight (IE if an attack had it's accuracy listed at 100% it was in fact only 99.6 percent accurate. I just found it to be an interesting coincidence. Wink
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours