Hit resolution

General feedback and discussion of the game.

Moderator: Forum Moderators

sycophant
Posts: 2
Joined: July 11th, 2004, 7:29 pm

Hit resolution

Post by sycophant »

Hey, all. Love Wesnoth, but must say it's TOO HARD, and that comes from someone who's been playing games for a while..

Had a specific question for you folks, though. If I attack a unit, and it says hit chance is 40%, there are no further modifications to that chance, correct? If that's true, then I'm wondering if the random number generation isn't somehow screwed up. I've been noticing that my hits don't seem to average out as they should. For instance, I'm playing a scenario currently, and just missed 12 times in a row (with different attackers) with a 40% hit chance. There's only a 0.2% chance of that occurring (60% ^ 12). Is the seed perhaps being regenerated on every hit or somesuch?

All in all, love the game. It's just TOO HARD! (About ready to quit, or start cheating!)

Thanx,
BRiaN
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Wesnoth is a game that you can figure out in a couple of minutes but take months to master. It really is just practice. Even though simplicity is one of the supposed features of the game, there is a lot of factors to get a feel for terrain, time of day, and healing. These factors are not just flavoring for the game; they really spell the difference between winning and losing. If you go too fast your front line will get slaughtered. Things like those just take some time to master. You can also get practice with 1-player multiplayer games and cheat by save-loading. At least that way you can play through the scenarios.
fmunoz
Founding Artist
Posts: 1469
Joined: August 17th, 2003, 10:04 am
Location: Spain
Contact:

Post by fmunoz »

0.2% chance is not that much but in a normal game you can really get thousands of attacks so after a couple of games you will remenber the "runs" (but forget the non runs series, tricks of human brain)
Wesnoth uses the standar random number generator... I think that its good enought for a game.
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

If the attack dialog says you have x% chance to hit, then yes, you really do have that chance to hit.

The code in-game is equivalent to this:

Code: Select all

if((rand()%100) < chance_to_hit) {
    ...hits...
}
Yes I realize that some implementations of rand() don't always produce truly random-looking sequences in the bottom bits, however for a game I think it is close enough to randomI to be indistinguishable from true randomness to a player.

I don't mean to sound patronizing, but humans do have a way of seeing patterns in randomness. Unless someone can show that rand() as used has serious issues, then we're not changing it.

As for the game being too hard, it possibly is. I plan to have a detailed look at the balance and difficulty of the campaigns before the 1.0 release. I welcome you and all users to be involved in this process.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Ave
Posts: 221
Joined: February 28th, 2004, 4:42 pm
Location: Hungary

Post by Ave »

rand()%100 isn't completely random due to folding.
Lets say, rand() is completely random and produces numbers 0-255. (yeah i know its range is different).
Now, 0-255%100 produces 0 3 times (0,100,200), but produces 56 only 2 times (56, 156).
40% = 0-39, 100-139, 200-239 = 3*40 = 120 out of 256
120/256 = 46%

The man page for rand() explicitly mentions not using low order bits.
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

scott wrote:Wesnoth is a game that you can figure out in a couple of minutes but take months to master. It really is just practice.
It is REALLY just practice. In fact, Wesnoth is the ONLY non-action game I've ever played that more than a little practice was useful in. If you're ready to give up or start cheating, change to Hard mode. Sure, you may lose repeatedly, but you'll probably learn a lot faster. Then, you can switch back to Easy and win easily.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Ave wrote:rand()%100 isn't completely random due to folding.
Sure, but the lowest range I know of is 0-65536. The difference due to folding is insubstantial.
Ave wrote: The man page for rand() explicitly mentions not using low order bits.
See my post above, and in numerous posts elsewhere where I have said that I think this is relevant perhaps for cryptographic applications, but not for games. People (fmunoz, and others) have run analysis over the lower order bits on typical implementations and found them to be fine.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
thk

Post by thk »

I think the random numbers are fine, but if one would be worried about Ave's argument, how about:
int(100*drand48());

drand48() returns a float between 0 and 1 and is part of the stdlib as well. It would be initialized with srand(time(NULL)); ...
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

How about just adding something to the statistics package/menu to display how unlucky/lucky you have been so far. It might just stop people complaining about this...
casueps
Posts: 34
Joined: June 24th, 2004, 4:02 pm

Post by casueps »

Could it just be that he was trying to hit an elf in the forest or something like that? Being 40% a low probability, combined with a 70% probability of missing, i think it gives a chance of 12% to hit. That is more or less one hit in 10 attempts, so its not that odd that he missed 12 times.
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

casueps wrote:Could it just be that he was trying to hit an elf in the forest or something like that? Being 40% a low probability, combined with a 70% probability of missing, i think it gives a chance of 12% to hit. That is more or less one hit in 10 attempts, so its not that odd that he missed 12 times.
What? No probabilities are combined when calculating chance to hit.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
User avatar
Aleksi
Music Contributor
Posts: 534
Joined: November 12th, 2003, 9:00 am
Location: France
Contact:

Re: Hit resolution

Post by Aleksi »

sycophant wrote:Hey, all. Love Wesnoth, but must say it's TOO HARD, and that comes from someone who's been playing games for a while..

Had a specific question for you folks, though. If I attack a unit, and it says hit chance is 40%, there are no further modifications to that chance, correct? If that's true, then I'm wondering if the random number generation isn't somehow screwed up. I've been noticing that my hits don't seem to average out as they should. For instance, I'm playing a scenario currently, and just missed 12 times in a row (with different attackers) with a 40% hit chance. There's only a 0.2% chance of that occurring (60% ^ 12). Is the seed perhaps being regenerated on every hit or somesuch?

All in all, love the game. It's just TOO HARD! (About ready to quit, or start cheating!)

Thanx,
BRiaN
Play the multiplayer mode. It will teach you a LOT! This game is not too hard on my opinion. Play against Miyo and you'll learn fast! :wink:
By the way Miyo, i'll take my revenge from LSM soon! :P :P

Aleksi.
cyberfrag
Posts: 12
Joined: July 14th, 2004, 9:48 am
Location: Germany

Post by cyberfrag »

Hey all,

Now I just registered to post a reply on this one...

I was worried about just the same, sycophant complains about.

I already figured out before, that the random number generator seems to be okay - at least as far as I dived in :-)

However I am still getting "impossible" results.
You know - it is _really_ frustrating to have your lvl3 Elf taken out by two lvl2 Orcs in one round while he's standing in the forest, just because the Orcs hit _every_single_time_!

Now due to the subject this is of course not really very "objective" - I can however say, that, having a seemingly perfectly save unit killed, due to bad luck, is a pain in the ass for the player - regardless of the overall campaign-difficulty.

Well - I don't just want to complain - so here come my proposials:

- Showing "luck/bad luck" - statistics would really help in getting this issue a more concrete basis
- If the random numbers are correct, I would suggest to change the damage calculations in some future release. Exact hit-rates for example might be an idea (that is: 50% means I will get exactly one half of my blows placed on the target).

Hmm... gotta leave now.

I _really_ hope this issue will be addressed, as, apart from that, Wesnoth is a really great game.

CU
Cyberfrag
Slesh

Post by Slesh »

Wesnoth is a game that you can figure out in a couple of minutes but take months to master.
I think he just compared Wesnoth to Othello (Reversi). Death!
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

Slesh wrote:
Wesnoth is a game that you can figure out in a couple of minutes but take months to master.
I think he just compared Wesnoth to Othello (Reversi). Death!
No, he compared it to chess. Othello stole the description!

Comparing it to chess is much better, since chess is a fellow game of war. Othello is a game of confuse-the-player-because-he's-not-used-to-the-rules, that's all.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Post Reply