NARMIIW - some kind of no-random-mod

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderators: Forum Moderators, Developers

tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

NARMIIW - some kind of no-random-mod

Post by tsr »

NARMIIW - No Attack Randomness Mod Implemented In WML

So, here it is a WML-only mod that takes away all[1] randomness of Wesnoth.

How does it work?
Well, it's kind of simple, I decided to use the terrain defense modifier value (that traditionally is used to calculate CtH) as just another damage modifier (like resistances[2], ToD) and grant all units 0% defense everywhere instead.

Current limitations
- Doesn't handle magic/marksman/guardsman/some-ability-I-forgot-about (unfortunately that means that you can only play northeners atm if you want to enjoy the full glory of the mod :( or refrain from using magicians/marks(wo)men/guardsmen)
- Doesn't handle random traits and other random things I might have forgot
- Requires a modified scenario-file
- The interface isn't up to this kind of mod (the attack-dialog appears before the attack-event, but you should be able to calculate the damage dealt quite easily, eg 5-4(60%) becomes 3-4(100%). Maybe I will post a FR about, maybe not.

Where do I get it?
So far it's in the tgz-archive below, if it gets highly popular and I finish all the tweaks so that it's complete I will probably upload it to the addon-server.

The archive contains modified versions of the scenario-files for the standard 1v1 maps of the official 1.4.1 release.

What is left to do?
- Deal with magic/marksman/guardsman/some-ability-I-forgot-about
- Deal with traits (but then it will have to be renamed to NRMIIW)
- Generalise it even more so that I don't have to bundle a bunch of modified scenario-files, but instead allow the player(s?) to chose if they want to play a NARMIIW-game or a standard game.


Ok, now all you luck-screws-my-game-people, go and have some fun!

As for the rest of you, you can try it too you know ;)


/tsr

[1] Ooops, that was I lie, I still haven't dealt with magic/marksman/guardsman, but that is somewhat minor stuff that I[3] will deal with if at least 3 people report that they have used the mod and share some intelligent comments[4]. And you still have the traits, but that imho is a minor 'glitch' that can - if I find it interesting enough to do - be removed too.

[2] Actually it's just like resistances, I just adjust the units resistances to add another percentage that is equal to the terrain defense.

[3] If you want to code it, I'm more than happy to recieve a patch.

[4] And yes, I get to decide if the comment is intelligent ;)
Attachments
NARMIIW.tar.gz
This is it folks, grab your copy while it's hot ;)
(11.07 KiB) Downloaded 273 times

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: NARMIIW - some kind of no-random-mod

Post by Mabuse »

if i were you i would include magic/marksman/guardsman as soon a spossible becasue it makes no sense to renounce on them, so actually the mod is unplayable -

you actually get punished for byuing a mage for example, limiting all factions that have mages

so the idea is not bad its nice to try it out, but it should be really completed becasue it makes no sense to play the mod atm

so go for it, then i try it out ;)

EDIT:
btw, and make it able to deal with traits of course also. i would have supposed that would happen automatically though (increasing base damage or health dont affect the calcultion itself ?)


EDIT:
In every case its good to have it, no matter it it will be used regularly or not;)
i also dont see a big nessessity for dealing with the interface.
The best bet is your own, good Taste.

tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: NARMIIW - some kind of no-random-mod

Post by tsr »

Mabuse wrote:if i were you i would include magic/marksman/guardsman as soon a spossible becasue it makes no sense to renounce on them, so actually the mod is unplayable -

you actually get punished for byuing a mage for example, limiting all factions that have mages
Agreed, I just wanted to get the code out there, for people to try out (and I'm also hoping that someone will be able guide me on how to incorporate magic/marksman/guardsman - especially guardsman).
Mabuse wrote: so the idea is not bad its nice to try it out, but it should be really completed becasue it makes no sense to play the mod atm

so go for it, then i try it out ;)
But well, if you think about it there aren't that many units that are affected by the current limitations, you could try it anyway :)
Mabuse wrote:btw, and make it able to deal with traits of course also. i would have supposed that would happen automatically though (increasing base damage or health dont affect the calcultion itself ?)
What I meant was that atm it allows units to recieve random traits and thus randomness still affects the game, I have no good idea on how to handle that, since traits are imho a relevant balancing factor.
Mabuse wrote:In every case its good to have it, no matter it it will be used regularly or not;)
i also dont see a big nessessity for dealing with the interface.
Well, I imagine (or actually hope) that the interface thing is 'just' a matter of switching 2 calls in the code (so that trigger_wml_event_attack appears before trigger_interface_event_attack_dialog), but I haven't got a real clue to be honest.

/tsr

User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: NARMIIW - some kind of no-random-mod

Post by zookeeper »

Here's a nicer implementation for you:

Code: Select all

[era]
    id=era_default_noluck
    name= _ "NoLuck Default Era"

    {RANDOM_SIDE}
    {multiplayer/factions/loyalists-default.cfg}
    {multiplayer/factions/rebels-default.cfg}
    {multiplayer/factions/northerners-default.cfg}
    {multiplayer/factions/undead-default.cfg}
    {multiplayer/factions/knalgans-default.cfg}
    {multiplayer/factions/drakes-default.cfg}

    #define NOLUCKIFY_UNIT UNIT_VAR
        {FOREACH {UNIT_VAR}.attack i}
            [object]
                silent=yes
                name="noluck"

                [filter]
                    x,y=${UNIT_VAR}.x,${UNIT_VAR}.y
                [/filter]

                [effect]
                    apply_to=attack
                    name=${UNIT_VAR}.attack[$i].name
                    range=${UNIT_VAR}.attack[$i].range
                    type=${UNIT_VAR}.attack[$i].type

                    [set_specials]
                        mode=append

                        [chance_to_hit]
                            id=always_hit
                            name,description="",""
                            cumulative=yes
                            value=100
                            apply_to=self
                        [/chance_to_hit]

                        [damage]
                            id,name,name_inactive,apply_to,multiply=damage10,"10% damage","",self,0.1
                            [filter_opponent]
                                defense=10
                            [/filter_opponent]
                        [/damage]
                        [damage]
                            id,name,name_inactive,apply_to,multiply=damage20,"20% damage","",self,0.2
                            [filter_opponent]
                                defense=20
                            [/filter_opponent]
                        [/damage]
                        [damage]
                            id,name,name_inactive,apply_to,multiply=damage30,"30% damage","",self,0.3
                            [filter_opponent]
                                defense=30
                            [/filter_opponent]
                        [/damage]
                        [damage]
                            id,name,name_inactive,apply_to,multiply=damage40,"40% damage","",self,0.4
                            [filter_opponent]
                                defense=40
                            [/filter_opponent]
                        [/damage]
                        [damage]
                            id,name,name_inactive,apply_to,multiply=damage50,"50% damage","",self,0.5
                            [filter_opponent]
                                defense=50
                            [/filter_opponent]
                        [/damage]
                        [damage]
                            id,name,name_inactive,apply_to,multiply=damage60,"60% damage","",self,0.6
                            [filter_opponent]
                                defense=60
                            [/filter_opponent]
                        [/damage]
                        [damage]
                            id,name,name_inactive,apply_to,multiply=damage70,"70% damage","",self,0.7
                            [filter_opponent]
                                defense=70
                            [/filter_opponent]
                        [/damage]
                    [/set_specials]
                [/effect]
            [/object]
        {NEXT i}
    #enddef

    [event]
        name=start

        [store_unit]
            [filter]
                x,y=1-999,1-999
            [/filter]

            kill=no
            variable=units
        [/store_unit]

        {FOREACH units j}
            {NOLUCKIFY_UNIT units[$j]}
        {NEXT j}

        {CLEAR_VARIABLE units}
    [/event]

    [event]
        name=prerecruit
        first_time_only=no

        {NOLUCKIFY_UNIT unit}
    [/event]

    [event]
        name=attack
        first_time_only=no

        [filter]
            [not]
                [wml_filter]
                    [modifications]
                        [object]
                            name="noluck"
                        [/object]
                    [/modifications]
                [/wml_filter]
            [/not]
        [/filter]

        {NOLUCKIFY_UNIT unit}
    [/event]
[/era]
Handles everything but attacks granted to units by [object]s. Surely enough even that would be possible, but I think only feasible in 1.5.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: NARMIIW - some kind of no-random-mod

Post by Mabuse »

wow, thanks, thats nice

"no luck default era."
what about putting it on add-on server ;)

i would try it out, and even if it is just to check some situtions, for example on isars cross (that comes to my ind in this moment), the attacking naga in the water village, what firepower is needed to get a statistical kill, so i can rely on the fact that as long i dont have no bad luck it would be dead or something.

surely a nice thing to check out statistical kills and stuff
The best bet is your own, good Taste.

Jozrael
Posts: 1034
Joined: June 2nd, 2006, 1:39 pm
Location: NJ, USA.

Re: NARMIIW - some kind of no-random-mod

Post by Jozrael »

You do realize that roughly 50% of the time you will have bad luck, according to your statistical kill model.

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: NARMIIW - some kind of no-random-mod

Post by Sapient »

#define NOLUCKIFY_UNIT UNIT_VAR
{FOREACH {UNIT_VAR}.attack i}
Can you really use a mecro definition argument as a macro parameter call like that?
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: NARMIIW - some kind of no-random-mod

Post by zookeeper »

Sapient wrote:
#define NOLUCKIFY_UNIT UNIT_VAR
{FOREACH {UNIT_VAR}.attack i}
Can you really use a mecro definition argument as a macro parameter call like that?
Yes, it worked just fine.

Anyways, I'll hopefully have a bit more refined version in a moment.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: NARMIIW - some kind of no-random-mod

Post by Mabuse »

Jozrael wrote:You do realize that roughly 50% of the time you will have bad luck, according to your statistical kill model.
only if it is exactly on the edge, beside that it

doesnt matter really, its just a good thing to set up a theoretical defense/attack, if you have bad luck you cant change anything about it anyway, beside having some Unit(s) as a reserve (which is usually the case ;)).

setting up a defense (or attack) that provide a statisticall kill is anyway better than relying on luck ;) to get that kill

of course you can also simply calculate it ;) - i am just curious about some things
The best bet is your own, good Taste.

tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: NARMIIW - some kind of no-random-mod

Post by tsr »

zookeeper wrote:Here's a nicer implementation for you:

Code: Select all

...
Handles everything but attacks granted to units by [object]s. Surely enough even that would be possible, but I think only feasible in 1.5.
Thanks, but actually it doesn't. Well it handles everything that my current implementation handles in a much nicer way. Thanks for that :)

But unfortunately it has two flaws.
(minor): it doesn't round in a nice way but floor:s the new damage-values
(major): it doesn't handle 'magic', eg a magic attack should always hit using 70% of the base attack no matter what defense the other unit is on. (and I suspect it has the same issue with marksman).

Too bad I'm too unskilled in WML to alter your code, but maybe you can or you could show me how to make a 'simple' filter in an attack event so to: just let the event fire for when attacker isn't using magic/marksman and defender isn't using magic.

Again, thanks for helping out I really appreciate it.

/tsr

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: NARMIIW - some kind of no-random-mod

Post by Mabuse »

tsr wrote: (major): it doesn't handle 'magic', eg a magic attack should always hit using 70% of the base attack no matter what defense the other unit is on. (and I suspect it has the same issue with marksman).
yes, thats right.

the noluck era cant handle magic(tested it), therefore remains useless for the moment
(as magic and marksman is of major importance to work correctly)

also i agree with tsr that it should round new damage values, so >.5 should be rounded up
(becasue it sucks when mage has 7 x 0.7 = 4.9 - and then its rounded down to 4 as base damage - so 4.9 should be 5 ;))
The best bet is your own, good Taste.

User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: NARMIIW - some kind of no-random-mod

Post by pauxlo »

Magic/marksman can be added ... just a similar [damage]-tag, which filters on the magic-special, and a not-filter to the other damage-tags.

Or, easier (and less safe-file-heavy): an if-clause in the for-loop, checking for the attack specials then.

User avatar
Lizard
Posts: 352
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: NARMIIW - some kind of no-random-mod

Post by Lizard »

couldn't you round by adding .5 and then take the int :?:
round(x) = round_down(x+0.5)
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: NARMIIW - some kind of no-random-mod

Post by Sapient »

or multiply by 10, add 5, then divide by 10.

(but this won't work for negative numbers)
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

Fosprey
Posts: 254
Joined: January 25th, 2008, 8:13 am

Re: NARMIIW - some kind of no-random-mod

Post by Fosprey »

Very nice, thanks, testing it.
looking into the wml code to see how it works

PD: The magic could be solved if we should rely on eras builded exclusive for the mod, Mages could have a different skill that makes them hit 100% of the time and the damage adjusted to it. And make an event that makes this type of attack to just ignore the new rules.
Last edited by Fosprey on May 2nd, 2008, 11:48 pm, edited 2 times in total.

Post Reply