Modified Luck in Source Code

General feedback and discussion of the game.

Moderator: Forum Moderators

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Re: Modified Luck in Source Code

Post by turin »

Uhm... guys, no it doesn't. Re-read PawelS's first sentence:
PawelS wrote:My change is pretty simple: the combat damage is multiplied by the chance to hit, and then the chance to hit is set to 100%.
So, a 5-4 attack with 50% CTH will do a flat 10 damage, every time; a 5-4 attack with a 70%CTH will do 14 damage, every time. Terrain defenses are taken into account.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Modified Luck in Source Code

Post by Dave »

PawelS wrote:I wouldn't mind a bit luck, but it was easier for me to eliminate it altogether than to reduce it.
It should be fairly easy to make it have some luck. Just make it that each attack has a 'guaranteed' component. This damage is inflicted whether the hit lands or not. The remainder is calculated based on whether it hits or not.

Then you can scale what the guaranteed component is. e.g. 50% of damage could be dealt in 'guaranteed' doses, and 50% based on whether hits land or not.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
PawelS
Posts: 31
Joined: March 28th, 2009, 12:15 pm
Location: Poland, EU

Re: Modified Luck in Source Code

Post by PawelS »

turin wrote:So, a 5-4 attack with 50% CTH will do a flat 10 damage, every time; a 5-4 attack with a 70%CTH will do 14 damage, every time. Terrain defenses are taken into account.
Yes, that's how it works.
Dave wrote:It should be fairly easy to make it have some luck. Just make it that each attack has a 'guaranteed' component. This damage is inflicted whether the hit lands or not. The remainder is calculated based on whether it hits or not.

Then you can scale what the guaranteed component is. e.g. 50% of damage could be dealt in 'guaranteed' doses, and 50% based on whether hits land or not.
Good idea, but it's a bit more complicated to implement than just adding a few lines of code.


Speaking of gameplay, I noticed that the campaigns are a little easier with this change (compared to unmodified game without reloading), because it's easier to control which units get experience, and to avoid losing units. So it's better to play the campaigns at higher difficulty levels.
User avatar
thespaceinvader
Retired Art Director
Posts: 8414
Joined: August 25th, 2007, 10:12 am
Location: Oxford, UK
Contact:

Re: Modified Luck in Source Code

Post by thespaceinvader »

I'd like to add: I'm extremely pleased to see someone who doesn't like the current luck system actually put his code where his mouth is and mod the game to make a luckless version.

Is there any chance that you could upload the relevant files somewhere along with instructions for the less technically-minded to include them in their game? It would save an awful lot of flamewars if we could, instead of telling people 'it's not going to happen in mainline, so mod the game if you want it', tell them 'it's not going to happen in mainline, but follow the instructions in this linked post to do it'.
http://thespaceinvader.co.uk | http://thespaceinvader.deviantart.com
Back to work. Current projects: Catching up on commits. Picking Meridia back up. Sprite animations, many and varied.
User avatar
PawelS
Posts: 31
Joined: March 28th, 2009, 12:15 pm
Location: Poland, EU

Re: Modified Luck in Source Code

Post by PawelS »

I'm not sure what should I upload (and where). Modifying the actions.cpp file shouldn't be a problem for someone who knows how to compile the game (there are threads about compiling on different systems in the "Release Announcements, Compiling, and Installation" section). Someone who doesn't know how to compile would need the executable. I have a Windows executable with my change added (version 1.6, compiled using CodeBlocks), but I don't know where to upload it (it's over 12 MB).
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Modified Luck in Source Code

Post by zookeeper »

There will be a WML-based era identical to this one (each hit deals damage according to the opponent's defense with 100% CtH) when 1.6.1 comes out.

EDIT: In case anyone would interpret the above wording as meaning that the era would ever be mainline, don't.
User avatar
thespaceinvader
Retired Art Director
Posts: 8414
Joined: August 25th, 2007, 10:12 am
Location: Oxford, UK
Contact:

Re: Modified Luck in Source Code

Post by thespaceinvader »

Ah, that makes life much easier =)

I'm showing my level of technical nous, here, aren't i - I completely forgot about that little intermediate 'compiling' stage before you can apply changes like this >.<
http://thespaceinvader.co.uk | http://thespaceinvader.deviantart.com
Back to work. Current projects: Catching up on commits. Picking Meridia back up. Sprite animations, many and varied.
bert1
Posts: 240
Joined: December 6th, 2006, 10:39 pm
Location: Morecambe, UK

Re: Modified Luck in Source Code

Post by bert1 »

Great! An easy way to try out a no luck mod! I'll look forward to that.
Good is simply that which is willed. - Eugene Halliday
Jozrael
Posts: 1034
Joined: June 2nd, 2006, 1:39 pm
Location: NJ, USA.

Re: Modified Luck in Source Code

Post by Jozrael »

Obviously this is what is already occuring, since he's multiplying by chance to hit.

So if you had a 10-2 attack against a unit on 50% terrain, you'd do 5-2, or 10 damage.
User avatar
PawelS
Posts: 31
Joined: March 28th, 2009, 12:15 pm
Location: Poland, EU

Re: Modified Luck in Source Code

Post by PawelS »

@Jozrael: Seems you have read only the first page of this thread before posting :)
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Modified Luck in Source Code

Post by Max »

PawelS wrote:Speaking of gameplay, I noticed that the campaigns are a little easier with this change (compared to unmodified game without reloading), because it's easier to control which units get experience, and to avoid losing units. So it's better to play the campaigns at higher difficulty levels.
i wounder if that's always the case. some scenarios where i put e.g footpads on terrain where they have 70% defense to delay a big army. there's a good (more or less calculable) chance that some of them level (which further adds to the delay tactics). shouldn't the ai have a better chance than to get rid of them?
User avatar
PawelS
Posts: 31
Joined: March 28th, 2009, 12:15 pm
Location: Poland, EU

Re: Modified Luck in Source Code

Post by PawelS »

In some cases this may be true, although units that have 70% defense don't take much damage, so in combination with healers and/or army rotation they often can be used for defense effectively.
hiro hito
Posts: 201
Joined: November 23rd, 2006, 8:00 am

Re: Modified Luck in Source Code

Post by hiro hito »

I am glad to see that someone, with "code" knowledge, tries to make something with the fighting system! :D

Cheer up PawelS!

If I can help you in any way (except technical one), to test your setup, just PM me when you want...
"Of course His Majesty is a pacifist. When I told him that to initiate war was a mistake, he agreed.Thus, gradually, he began to lead toward war."-Emperor Shòwa (Enlightened Peace)'s chief cabinet secretary
User avatar
PawelS
Posts: 31
Joined: March 28th, 2009, 12:15 pm
Location: Poland, EU

Re: Modified Luck in Source Code

Post by PawelS »

I did it basically to be able to play the campaigns in "deterministic mode" myself, so I don't need any more testing. Of course you're free to make the same change, test it, and post your impressions here (if you don't know how to compile and want to get the Windows executable from me, contact me by PM).

Btw I noticed a bug: sometimes when a unit has two attacks, and is able to kill the enemy with any of them, the one that makes my unit take some damage is selected as default instead of the one that allows my unit to remain unscratched. I don't know if this is caused by my change or a bug in the standard version of Wesnoth.
Soliton
Site Administrator
Posts: 1683
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: Modified Luck in Source Code

Post by Soliton »

PawelS wrote:Btw I noticed a bug: sometimes when a unit has two attacks, and is able to kill the enemy with any of them, the one that makes my unit take some damage is selected as default instead of the one that allows my unit to remain unscratched.
Is poison involved? If so that's fixed in the next version.
"If gameplay requires it, they can be made to live on Venus." -- scott
Post Reply