Hey. is there a way to create exponentially increasing counters using simplistic commands?
Basically I was able to do something..:
nullcounter1=w
deathcounter1=x
deathcounter2=y
exponentialgrowth=z
addition=a
finding x^z=a?
null= y, w
x is set to w which gives variable number to y while refilling x to original value through w.
z is set to 2, which is squaring the number.
y is squared by giving itself to w, z times and clearing y=0.
w is added to x, subtracting 1 each time.
thus giving equation a.
I wanted to give bonus points to the players exponentially for doing chains of things and giving bigger points per completion of things. But this method was a bit too complex. Took too many triggers and was visually slow to add.
This chain is too complicated for my liking. Is there any other way to do it without set numbers? I was looking for a method like this to do it so that I could use a set of predefined triggers that grinds out the answer each time without predefined numbers and will add it dependant on the current number the player has. thanks.
Not worth it. There might be some way to implement an exponential algorithm into triggers, but that's going way to far. Even doing multiplication between counters in Starcraft means you're either doing something the hard way, or else you're deliberatly attempting some advanced function just to show off.
I'd suggest using counter addition of fixed amounts, tedious as that may be. It's easy to generate repetative triggers with the right tools, and most likely you won't need to use probably more than a few dozen or even a hundred exponential amounts anyway, especially since exponential numbers tend to quickly hit the limit of the 32 bit integer range.
The exponential function (for integers at least), just means that you're multiplying a number to itself many times.
and if the base is constant, then you just have 3 counters: 2 for multiplying against each other, and 1 to count how many times you've multiplied (that is, the index).
For the function a^x, where "a" is constant:
start with 1 in one counter, 0 in another counter. Subtract from the first and add the base "a" to the second. Then count off from the second counter back into the first, again multiplying by "a" (subtract 1 from counter2, add "a" to counter1).
Repeat as necessary until the desired index is reached. You might have to use a switch to determine which way you are counting, but you can use other methods as well.
I don't think you'll probably need to vary the base, unless you're making a very complicated system. If you're making a system where points are given exponentially in a time limit, just add 1 to the index for each task completed, or for each enemy killed. Then just count down the index, multiplying by "a" each time.
Another reason this would be impractical: Ever watch the multiplication function in my binary calculator map (you can get it in the My Maps link in my sig)? Try multiplying by the thousands, and count how long it takes. Sure, there's a faster way to do multiplication I found (dunno about division, though), but if it takes that long, then exponents are going to be MUCH longer.
If you're still determined to have exponents, though, I'll make a test map of it if you want.
In my microprocessor class we had to write a multiplier with only the add, nand, and beq instructions, and it had to run in constant time regardless of the input.
The solution isn't what you would probably first think of - for x * y, add x to itself y times. Maybe there's a better way to do exponents too? Barring that, if your base is constant you would only need one trigger for each value you expect the exponent to take on...but I guess that was already obvious.
QUOTE(Tux)
or else you're deliberatly attempting some advanced function just to show off.

Hmm... who was the one to make a graphing calculator on SC?

Psst... it was you, wasn't it?
I was thinking of using the exponential numbers only to a degree,
such as completing a level with certain good points, you would get a amount of 2 points or so, which could exponentially increase dependant on how many good things you do.
([points earned during current round]^[current round bonus points])+[total points]
Doing three good things will have an exponential increaser of 3,
increasing the 2 to 8 and adding it to a grand total.
Im talking small numbers here tux.
Not 40^5.. -.-
Im talking numbers you can count towards.
The points earned during current round would have limited growth, but im trying to accomplish or find a way to do this without manually doing everything.
The limit would probably be around 15 points per round,
which could exponentially increase by 2-3.
which would have a max around 3375 points each round.
Manually doing the triggers would result in 15+15+15=45 triggers for each addition scenario. Maybe more if different kinds of things are added. Im still thinking about it.
I was thinking about using decreased numeral values to lower the potenial for unsightly scores...
Meaning 100 points = 1 deceased numeral point.
To simplify the range of the scores by x/100 or two decimal points.
The thing is, the more good things you do during a single round, the more points you will get.
You get extremely high amounts of points for doing really good during a level.
Just shows more variation in points, and whatnot, skill stuff... points... something like that.
If you want to be difficult try doing roots or negative powers.
Hm, maybe if I implemented negative points for negative actions.
QUOTE
In my microprocessor class we had to write a multiplier with only the add, nand, and beq instructions, and it had to run in constant time regardless of the input.
You mean something like
this?
But as I said, it's still a bitch to make. But once you can get constant multiplying, you could just make exponents by multiplying y number of times, and adding to the result. I'm not sure know how you could make the y counting+multiplying be constant time in turn, though.
ya know Tux...
From my experience with you, you like to overly complicate things and use overly plentiful amounts of triggers in your maps and label sparingly...
I learned nothing from this map.
gg...
Instead I learned other ways by reading tutorials...
thanks anyway.
You learned nothing because you know nothing. The point of it was just to show how to make constant-time multiplication in Starcraft between counters. If you don't know what that means, or why it's useful, I doubt it would be very useful to you anyway.
But I will agree that no sane map maker would have any use for something like that. Even just plain counter addition/subtraction is more than needed for almost any reasonable map, let alone stuff like multiply or exponents (worst of all). There's always an easier way.