• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[System] Bonus

Level 18
Joined
Jan 21, 2006
Messages
2,552
Wow all these systems re-writes are completely useless. Why don't you just use what is already available and release this "map" of yours? If optimization is required, then work from there. Don't work on optimization before you even have a product to optimize.

I would rather have a fun map to play than dozens of libraries that don't provide anything more than what is already available. Not to mention the resources section is just becoming cluttered with crap that I've already seen. It would be nice to see libraries in the JASS section that are actually useful, not cluttered with all this crap.

If copyrights were enforced on Warcraft III modding, you would be in violation of many. You're simply taking what someone has already wrote and then applying tiny optimizations here and there. You don't support credit to anybody who made these systems first, but then you act as if it is purely all your own work. I could re-invent the wheel and call it "my" invention but that would be ridiculous. That's what all of this rewritten crap is. Ridiculous.

I'm really sick of seeing all these Nestharus submissions that don't provide the community with anything they did not already have. You just make it harder for people to work with you because you've got your own versions of everything that people consider standard.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Hello Nestharus, did you know this thread was already open or did you send me the wrong thread?

Anyway, make sure you keep it at 4 levels maximum for the bonus, because that way the bonus abilities can be converted to *.SLK files.

I can't make that happen for you. It adds too much complexity to the code, complexity that I frankly don't feel like dealing with.

edit
And 2.0.0.0 is out. I still really want to be able to have users be able to pass in custom code for Bonuses, but that'd require triggers, so this is the best it's going to be ^)^. This is how a Bonus lib should be written ;D.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
The only other update I'm going to do on this is checking if v is equal to the current bonus, which is a very tiny update that I am too tired to apply right now.

sooo, in short, here is my list of answers that are never going to change


no to custom code bonuses like Bonus at wc3c

You just use powers of 10 - 1, 10, 100, 1000.
no

make sure you keep it at 4 levels maximum for the bonus, because that way the bonus abilities can be converted to *.SLK files.
no

There is no point arguing anything above as my answers are going to firmly remain no. End of discussion.


This resource is completely ready for approval. The only update I'm planning is just a speed increase for handling 0 change cases (couple of lines of code) (very slight, but helpful in the map I'm working on).
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
It's not laziness in the slightest and those are my final answers. The 10s idea is a special hell no..


I'm not gong to spend my time making the resource crappy with bad ideas.


10s is beyond horrible and I will never do it. I'm not going to spam the map with hundreds of objects to cut loop size down a tiny bit... if you think that like -5 iterations is worth it for like 30+ objects per buff, then you are crazy, unless you somehow think that you can add the same ability multiple times now.


make sure you keep it at 4 levels maximum for the bonus, because that way the bonus abilities can be converted to *.SLK files.
This drastically complicates the code, increases object count substantially (+1 for every extra object), and slows down the speed of the code, hence my no.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Reread my post, I edited it.


I 100% refuse, I will never ever do it.

edit
object count for ur idea is 9*sig fig.. for 2s it's around 1/3 object count. For 4 digits on 10s, that'd be 4 iterations. For 2s, it'd be 10 iterations. For 7 digits, 10s would be 7 iterations. 2s would be 20 iterations. The iteration count is always very low on 2s. I don't see how it is worth it for around 3x more objects. If it was like 100 vs 300, then I'd start considering it.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Remind me why you post this here then? Just because you have to do a lot of extra work for something little doesn't mean it isn't worth it. Sometimes things turn out this way. In the end its all about what gets a map to fuckin' run, and nobody cares about 3x more objects for their bonus attribute calculations that is a small fraction of the objects that are created in a map.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
If you guys want to continue arguing with me, learn that other algorithm and prove your case. If you guys don't care to learn that algorithm, then you have no right to argue with me on this point and you must accept my ruling.


And yes, it is VERY unreasonable to demand someone to change something to something else when you don't even know what that something else entails and the other person does. If you say that it is reasonable, then I must call you a moron and request that you step down from your moderating position.


Case closed.
 
Last edited:
Level 18
Joined
Jan 21, 2006
Messages
2,552
The speed gain is pretty much 0 (possibly slower) due to the extra complexity of the algorithm. You have double native calls + more globals to deal with. You also have math intensive operations. The iterations are less, but each iteration is significantly slower. The powers of 10 might actually be slower >.>.

All of which makes no difference for a bonus attribute system. Plus, "math intensive" operations? You're not solving an N-dimension matrix you're doing a fairly small set of basic operations.

I already told you at the start, my answer is never going to change. It is going to remain no. This entire conversation is pointless and a waste of time.

Using your systems is a waste of time.

If you guys want to continue arguing with me, learn that other algorithm and prove your case. If you guys don't care to learn that algorithm, then you have no right to argue with me on this point and you must accept my ruling.

Nobody cares about your algorithms for Warcraft III. It's Warcraft, not some assembly code for processing complex commands for a micro processor that only has 4 registers and a maximum memory capacity of 12 MB. As long as what you're doing isn't completely unnecessary, and you're not running it on a timer, then it really makes no difference.

Case closed.

Submission denied.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
All of which makes no difference for a bonus attribute system.
Using your systems is a waste of time.

I will be forced to report you if you continue your pointless trolling.


edit
And you do realize that you have contradicted yourself in both your posts right? Well, actually, your first post didn't even make any sense. This resource already works, and given that, you would have disagreed with Bribe about the changes if you had actually been following what you said in your first post.

In your second post, you state that you don't care about the algorithms, but you demand I change mine to a crappier algorithm just because you say so. If that's not a contradiction, I don't know what is.

I really don't want to believe that you are taking Bribe's side just because you are determined to get in a fight with me at every single turn, but that is appearing to be the case. Troll much? I think so.

If all you care about is fighting rather than the resource itself, then you are trolling.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I want to see this map of yours that benefits from all these cuts in functionality for minor efficiency gags. You constantly claim that every single optimization you make benefits you greatly but nobody has seen the final results. You can't use theory in an emulated programming language, in reality you have absolutely no idea how your little gags here and there actually affect the running time of the underlying code. It's as good as a guess yet you're basing your arguments off of it.

I'm sorry if it offends you, but I'm asking for evidence that all this optimization is necessary. It doesn't appear necessary, and never have I been unable to continue a project because my code is so godly inefficient that it makes the game unplayable half-way through development. Never. The limitation is always on the Warcraft game engine and graphics engine, not my code.

In your second post, you state that you don't care about the algorithms, but you demand I change mine to a crappier algorithm just because you say so. If that's not a contradiction, I don't know what is.

It's not the algorithm, it's the functionality. You use algorithms that are optimized but the evidence that this optimization is beneficial is non existent.

I really don't want to believe that you are taking Bribe's side just because you are determined to get in a fight with me at every single turn, but that is appearing to be the case. Troll much? I think so.

Every single turn? Please, don't flatter yourself. I just see your optimization crap posted all over these forums and I choose to analyze one or two instances of it. Every single time you've mentioned a benefit from optimization it has been a theoretical, unapplied analysis of what you think.

If all you care about is fighting rather than the resource itself, then you are trolling.

If all you care about is efficiency in your small dinky scripts then don't open discussion about them. You want us to all say "OMG your systems are SO FAST" when in reality its "OMG your systems are so hard to read, use, and they lack functionality".
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I'm sorry if it offends you, but I'm asking for evidence that all this optimization is necessary. It doesn't appear necessary, and never have I been unable to continue a project because my code is so godly inefficient that it makes the game unplayable half-way through development. Never. The limitation is always on the Warcraft game engine and graphics engine, not my code.

So you are demanding I make the script crappier because it's too optimal? Wtf is up with that? You do know how crazy that sounds right?

edit
You're sounding like the U.S. Gov back with the smart car incident when smart cars were too good to be allowed into the U.S... they had to be dumbed down from like 100+ mpg to 40 mpg or so in order to be allowed in.

edit
We're not arguing about functionality right now, we're arguing about the speed of powers of 10 as compared to powers of 2... and you are for some reason agreeing with Bribe that it should be changed to powers of 10 because apparently my script is too optimal right now. 0 changes to API, 0 changes to functionality... what you are saying has absolutely no relevance to what is currently being argued, which is why you are sounding totally bonkers atm.


Now, if you are trying to compare this to Bonus at wc3c, then that's a whole other story, but there has been no evidence in any of your posts that that has been your aim.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
So you are demanding I make the script crappier because it's too optimal? Wtf is up with that? You do know how crazy that sounds right?

It has nothing to do with optimization. I'm saying you should focus your efforts on functionality and interfacing instead of unnecessarily optimizing scripts that don't need optimization.

We're not arguing about functionality right now, we're arguing about the speed of powers of 10 as compared to powers of 2... and you are for some reason agreeing with Bribe that it should be changed to powers of 10 because apparently my script is too optimal right now. 0 changes to API, 0 changes to functionality... what you are saying has absolutely no relevance to what is currently being argued.

I never said that I explicitly agree with Bribe. Our views are probably two different ones.

But I thought Bribe was mentioning something else, which prompted my initial debate. I really didn't pay much attention to it, I admit.

No wonder you thought I was trolling.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I never said that I explicitly agree with Bribe. Our views are probably two different ones.

Then what exactly are you arguing for? You have not made yourself clear in any of this. To me, it appeared that you were arguing for the powers of 10, which would be a change that would only modify the speed and overhead of the script (less speed, more overhead), not the functionality.

edit
oh yes, in my wmw map, I sometimes have to go over 600-1000 units at a time and apply 8 different bonuses to all of them... w/o speed, it the thing would cause spikes... I had to thoroughly optimize my IsPathBlocked thing too to prevent spikes. BigInt also causes spikes on decent sized save/load codes and I have received complaints about those spikes, which is why I also need to finish my optimization of BigInt.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
And what is that argument? The powers of 10 argument or the one from your very first post?

Wow all these systems re-writes are completely useless. Why don't you just use what is already available and release this "map" of yours? If optimization is required, then work from there. Don't work on optimization before you even have a product to optimize.

I would rather have a fun map to play than dozens of libraries that don't provide anything more than what is already available. Not to mention the resources section is just becoming cluttered with crap that I've already seen. It would be nice to see libraries in the JASS section that are actually useful, not cluttered with all this crap.

If copyrights were enforced on Warcraft III modding, you would be in violation of many. You're simply taking what someone has already wrote and then applying tiny optimizations here and there. You don't support credit to anybody who made these systems first, but then you act as if it is purely all your own work. I could re-invent the wheel and call it "my" invention but that would be ridiculous. That's what all of this rewritten crap is. Ridiculous.

I'm really sick of seeing all these Nestharus submissions that don't provide the community with anything they did not already have. You just make it harder for people to work with you because you've got your own versions of everything that people consider standard.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
And yes, it is VERY unreasonable to demand someone to change something to something else when you don't even know what that something else entails and the other person does. If you say that it is reasonable, then I must call you a moron and request that you step down from your moderating position.

It's not hard to use the abilities I mentioned. Don't be so over-sensitive. Holy smokes man. Asking that I step down from being the only moderator in the JASS section just because I don't blindly do everything you say any more, that's pretty harsh.

Object Editor attributes:

l1: -1
l2: -10
l3: -100
l4: -1,000

Application:

JASS:
function IncBonus takes integer level returns nothing
    local integer a = 1000
    local integer i = 4
    loop
        loop
            exitwhen level < a
            //Apply ability level which correlates with "i"
            set level = level - a
        endloop
        set i = i - 1
        exitwhen i == 0
        set a = a / 10 //will do 1000, 100, 10, 1
    endloop
endfunction

Holy smokes the above algorithm is really tough.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
That will only work for life and mana


try again


also, that will only work reasonably up to around 999 (27 iterations)


Furthermore, the argument doesn't account for ini.


The objects will be 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200, etc, 1 object for each sig fig, 9 levels each. You need one array for sig figs, a modulos operation, an array to store each sig fig of bonus, and then an array for looping through sig figs. From there, you add ability and set its level to the value stored in the bonus sig fig array.


That is the algorithm. As I said, you have no idea what you are demanding me to do.
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ok, I'll just explain to you how it works.


Think of the bonuses in terms of binary numbers

11100000

The largest bit is negative
[1]1100000

So you add up all of the bit values and that is the number you get

010 would be 2
110 would be -100 + 10, which is -4+2, or -2. 111 is -4+2+1, or -1.


The algorithm sets the bits in the number. It loops from the largest bit (the negative) down to the smallest bit (0,1) and sets them to true or false (add or remove the ability for that bit). That is all ^)^. Simple no?

The powers of 2 represents the bit size of the number. 2^16 is a number that is 16 bits long for example, meaning that it will take 16 iterations in order to set all the bits : ).

Life/Mana work a bit differently... in that one, you add bits rather than set bits. At the start, it counts how many -bits it needs to add, but does not add them yet. Adding negative bits first is dangerous as it may kill the units. Afterwards, it adds all of its positive bits, then it adds its negative bits (the ones that were previously counted). Negative bits always have to be done before positive bits in order to make the bonus value positive.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I see why the other Bonus libs were written incorrectly.
They would only add abilities.

No, they'd do both. They were written incorrectly due to their config stuff (all hard coded nonsense).


If you look at my config, you can easily add in new abilities and modify current abilities ^)^. You can mod the system for use in your map. If you don't need sight bonus, you can disable it or delete the line ;D.


Also, BonusMod tries to handle even custom bonuses that don't use abilities at all, which is pretty silly.

edit
The reason Bonus v1.x.x.x was coded incorrectly was because you couldn't easily add your own abilities to it. It had hard coded abilities. You could modify those hard coded abilities, but you couldn't add your own :\.

edit
I am also unwilling to change from powers to 2 to powers of 10 because powers of 10 is idiotic. If you read my little description of the powers of 10 algorithm and look at just how many objects you have to generate, you will understand just how stupid it is -.-. Understand what you ask of me before you demand I do it. It works just like powers of 2 except that the sig figs are no longer true/false, hence the masses of levels.

edit
also because powers of 10 requires the digit value, you have to rip it out with mod, which is a pretty intense operation.

edit
We shouldn't even be having this absolutely idiotic argument of powers of 10 -.-. There is no way in hell that I'm doing it.

edit
Also, because you read the number backwards, you have to store all of the ripped out values into some sort of array, so you need an additional loop for processing the bonus value and storing all of its digits.

edit
Give something a little more thought before you go around saying people need to change their crap. You obviously gave this very little thought as the initial algorithm you wrote was 100% wrong -.-. With that algorithm, you could have only gotten either the values of 111 or -1000+111.

edit
This resource no longer needs work. The work you are requiring of it is ridiculous and nobody in their right mind would willingly do it.
 
Last edited:

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
You've used pretty exaggerated situations like modifying all stats for hundreds of units at at one instant, over complicated the description of something that's usually as simple as adding/removing an ability, but obviously you have your reasons and you've got more experience at it than I have. I can see why someone would use this resource instead of the other bonus systems, because it's way more configurable, so this does have a place and it's no use arguing with you about powers of 10 because obviously I'm thinking about things from theory.

So I'll approve this and you can relax now.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
You've used pretty exaggerated situations like modifying all stats for hundreds of units at at one instant
I do that in my wmw map on a timer (up to 620 units)... care to see the code??

over complicated the description of something that's usually as simple as adding/removing an ability
How is this description complicated?
JASS:
*   Adds bonuses to units. In the ini area, these bonuses can be enabled and disabled.
*   Ranges of bonus values can also be modified.

it's no use arguing with you about powers of 10 because obviously I'm thinking about things from theory.
I gave you the theoretical algorithm in its entirety to show you that it was quite possibly much slower + generated many more objects.

The objects will be 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200, etc, 1 object for each sig fig, 9 levels each. You need one array for sig figs, a modulos operation, an array to store each sig fig of bonus, and then an array for looping through sig figs. From there, you add ability and set its level to the value stored in the bonus sig fig array.
also because powers of 10 requires the digit value, you have to rip it out with mod, which is a pretty intense operation.
Also, because you read the number backwards, you have to store all of the ripped out values into some sort of array, so you need an additional loop for processing the bonus value and storing all of its digits.
With the algorithm you wrote, you could have only gotten either the values of 1, 10, 100, 11, 101, 110, 111 or -1000+all the before.

So powers of 10 requires this additional loop for preprocessing
JASS:
local integer array digits
local integer digitCount = 0
loop
    exitwhen 0 == bonus
    set digits[digitCount] = bonus-bonus/10*10
    set digitCount = digitCount + 1
    set bonus = bonus/10
endloop

Then it needs an additional line for looping backwards along the digits as well as the abilities.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
The algorthm I wrote only requires those four levels which I showed. level 1: 1, 2: 10, 3: 100, 4: 1000. I don't know what you mean by "sig file" nor do I understand where you get this (to me) nonsense pattern of "1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200" unless you mean that's how many times the function has to loop.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ahem, you can't add an ability more than once... life/mana are the only ones that work with the -value trick. No other abilities work like that... therefor, you have to have the levels if you want it to work. With your method, the only values you could get were the ones I listed out.


Would you like me to link to wc3c's ability guide by PitzerMike?

edit
A special bug allows you to to adjust the max mana and life of a unit without a permanent ability on that unit. Simply make a custom AIlf (Life Bonus) or AImb (Mana Bonus) ability and give it more than one level. Now set the bonus for level one to zero and the level two to the exact opposit you want to achieve. That would be -200 if you want to add 200. Now use UnitAddAbility and SetUnitAbilityLevel to add the ability at level two to your target. There's a bug in those abilities that prevents the bonus from being applied correctly. Then immediately remove the ability again using UnitRemoveAbility. This time it will try to undo the -200 bonus (which hadn't been applied due to a bug) and add 200 to the unit. That's it, you've changed the life/mana without having to keep any abilities on the unit.

Notice that it explicitly states max mana and max life.

edit
Object 1
Level 1: 1
Level 2: 2
Level 3: 3
Level 4: 4
Level 5: 5
Level 6: 6
Level 7: 7
Level 8: 8
Level 9: 9

Object 2
Level 1: 10
Level 2: 20
Level 3: 30
Level 4: 40
Level 5: 50
Level 6: 60
Level 7: 70
Level 8: 80
Level 9: 90

etc
 
Level 5
Joined
Oct 13, 2010
Messages
84
Addition informations about sight range bonus
- whatever sight range bonus you give to a unit, the sight range of that unit only increases when the bonus mod 64 = 0 (i.e: 64, 128, 192, etc...)
- the sight range changes 2s after adding the bonus

Just share knowledge!
 
Top