Wc3C.net MultiBars
 Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar

12-07-2007, 02:35 PM   #16
Ammorth

Join Date: Sep 2006
Posts: 1,812

Submissions (10)

I did create an arithmetic way to solve for the XP, but had a few rounding error problems (apparently 663.000 == 662 with a R2I() call).

JASS:
```globals
real array XPforLevel
constant real XP_REQUIRED_CONSTANT_FACTOR = 68.00
constant real XP_REQUIRED_LEVEL_FACTOR = 125.00
constant real XP_REQUIRED_PREVIOUS_LEVEL_FACTOR = 1.10
integer array XP_REQUIRED_TABLE
endglobals

function GetRequiredXP takes integer forlevel returns real
if XPforLevel[forlevel] != 0 then
return XPforLevel[forlevel]
endif
if forlevel < 2 then
return 0
endif
if XP_REQUIRED_TABLE[forlevel] != 0 then
set XPforLevel[forlevel] = XP_REQUIRED_TABLE[forlevel] // get value from table
return XPforLevel[forlevel]
endif
if forlevel == 2 and XP_REQUIRED_TABLE[forlevel] == 0 then
set XPforLevel[forlevel] = 200 // default if none existed
return XPforLevel[forlevel]
endif
set XPforLevel[forlevel] = ((GetRequiredXP(forlevel-1)*XP_REQUIRED_PREVIOUS_LEVEL_FACTOR)+(XP_REQUIRED_LEVEL_FACTOR*forlevel)+XP_REQUIRED_CONSTANT_FACTOR)
return XPforLevel[forlevel]
endfunction```

The problem is that it must return a real for the rounding of the next-level-calculations to be accurate. This method also requires more user-input (all the game-play constant values) vs only a max level.

I personally like the other method better. Once you create the hero once (which I do at map init), there is no noticeable lag. I also don't have to worry about weird rounding issues, since the game has done all the calculations internally. And hey, it only gets the value by creating a unit if the value is not already pre-set. I actually got the idea to use the hero from the GetItemCost function.
__________________

12-07-2007, 04:06 PM   #17
Rising_Dusk
Obscurity, the Art

Projects Director

Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Quote:
 I actually got the idea to use the hero from the GetItemCost function.
I noticed. :p
It's still cool though, and I agree, your other method does seem cleaner and requires less user-input. You also don't even need the input for max level. Just check if the level changes when you add a level and voillah, if it doesn't it hit max and you can return 0.0 or something and if it did then you can return an actual value.

Good stuff.
__________________

12-08-2007, 07:22 AM   #18
Ammorth

Join Date: Sep 2006
Posts: 1,812

Submissions (10)

__________________

 12-08-2007, 05:33 PM #19 Anopob Yay!     Join Date: May 2006 Posts: 870 Whoa that's awesome, though I failed with 1% left in the game (damn it!). +rep __________________ Give +REP to people who help you with things or make good resources. Better Ways of Requesting For Help - Race Contest #2 WIP Thread (Bone Race) As of December 1st I have my blue rep. Yay :D
12-09-2007, 12:57 PM   #20

Respected User

Join Date: Apr 2003
Posts: 1,699

Submissions (10)

nice map, nice design, nice system. Awesome!
__________________
Current Projects:
 MaDOS (outdated) System for object movements & effects - NEW VERSION IS UNDER W.I.P Cinematic System System for making better cinematics and with fancy effects Timing System Timing system that simulates the usage of PolledWait just with 0.01 accuracy

12-09-2007, 01:38 PM   #21
Vexorian
Free Software Terrorist

Technical Director

Join Date: Apr 2003
Posts: 14,898

Submissions (37)

I like the map, and the way the system looks, I don't like the code.

The problem is that it is just doing too much, the whole unit life, mana, experience stuff should be an usage example outside the system's code, and avoid including that XP function in this library, the library itself should only have the basic tools to create a multiboard progress bar with whatever image and name you want to give it. The actual creation of them should be outside it, as sample triggers, or if you want as another library.
__________________
 Wc3 map optimizer 5.0 Someone should fix .wav sound in this thing. JassHelper 0.A.2.A Turns your simple code into something that is complicated enough to work.
 Wc3 map optimizer 5.0 JassHelper 0.A.2.A Xye 0.12.1 | Editor/Levels xe0.9 CS16.0 My spells jEdit modes for vJass&Zinc (v9) WarCiTy 0.2.0
Faster != more useful

12-09-2007, 04:21 PM   #22
Ammorth

Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Quote:
 Originally Posted by Vexorian The problem is that it is just doing too much, the whole unit life, mana, experience stuff should be an usage example outside the system's code, and avoid including that XP function in this library, the library itself should only have the basic tools to create a multiboard progress bar with whatever image and name you want to give it. The actual creation of them should be outside it, as sample triggers, or if you want as another library.

I'm going to have to disagree with you here. Systems are designed to make the life easier for the people using them. It wouldn't make sense to use a system if it made your code harder to make. One of the key uses (as illustrated by my demo map) is health, mana, and experience bars. Including dynamic bars that only take 2 lines of code (if using a label) is what I consider easy. For someone having to re-create the code that updates these bars could out-weigh how easy the implementation is. Then they ask their selves: Is it really worth it?

And if a person doesn't want to use the health, mana, exp bars, just set the period to 5 or 10 seconds. If there are no unit bars in existences, it closes the loop right away.
__________________

 12-09-2007, 05:08 PM #23 cohadar master of fugue     Join Date: Jun 2007 Posts: 2,453 Submissions (5) Systems indeed are made to make things easier for people but codes that suffers from "do it all" syndrome are actually useless because of their magnitude (perfect example would be Vexorian's caster system as opposed to using only CSSafety) So I must totally agree with Vexorian here, you need to split multibars core code from specific stuff. Just do exactly as Vexorian described and you shall be fine. __________________ Omg database crash deleted my signature, as a side effect this immensely improved wc3c. Last edited by cohadar : 12-09-2007 at 05:09 PM.
12-09-2007, 07:35 PM   #24
Vexorian
Free Software Terrorist

Technical Director

Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Quote:
 but codes that suffers from "do it all" syndrome are actually useless because of their magnitude
This system is like making the caster system and include all the spells I made with it in the same library as opposed to keep things like system and applications separate. Rather than a multi function system it is working more as a sample or template than a system. Rather closer to ABC instantiating the textmacro forcing global A, B and C hashes...

Quote:
 'm going to have to disagree with you here. Systems are designed to make the life easier for the people using them.

Quote:
 It wouldn't make sense to use a system if it made your code harder to make.
Hence the reason I ask you about this change. I don't want a mana bar, I don't want an experience bar, etc. I want to make my own bar and place it in any place of any multiboard and let it have whatever graphics I want and let it measure whatever I want.

Quote:
 One of the key uses (as illustrated by my demo map) is health, mana, and experience bars. Including dynamic bars that only take 2 lines of code (if using a label) is what I consider easy. For someone having to re-create the code that updates these bars could out-weigh how easy the implementation is. Then they ask their selves: Is it really worth it?

Nobody is asking you to remove the applications of it, just to keep applications outside the system's library. Let me try to explain it "A system has to be used and not include its own uses"

You should make your system be able to work without that XP function, without any MANA or HEALTH constant, etc. Let another library do it. It is an extra abstraction layer that will let your users keep using 2 calls for your stuff but will also make it more powerful for other guys, right now it looks more viable to me to code my own multiboard progress bar than to use your system.
__________________
 Wc3 map optimizer 5.0 Someone should fix .wav sound in this thing. JassHelper 0.A.2.A Turns your simple code into something that is complicated enough to work.
 Wc3 map optimizer 5.0 JassHelper 0.A.2.A Xye 0.12.1 | Editor/Levels xe0.9 CS16.0 My spells jEdit modes for vJass&Zinc (v9) WarCiTy 0.2.0
Faster != more useful

 12-09-2007, 08:05 PM #25 moyack Evil Emoticon   Respected UserProject Leader: PoC   Join Date: Jan 2006 Posts: 3,279 Submissions (17) Ammorth: your system is very good, but the mana, life and experience bars shouldn't be part of the core library. Instead you can offer with the pack a library which will be like a "plugin", a library which will require the core bar library, which will offer to the user a "ready to use" life, mana and /or experience bar. Take advantage of the require library feature, and make modular your resource.
12-09-2007, 08:20 PM   #26
master of fugue

Join Date: Jun 2007
Posts: 2,453

Submissions (5)

offtopic:
Quote:
 Originally Posted by Vexorian Rather closer to ABC instantiating the textmacro forcing global A, B and C hashes...

Fighting fire with fire khe khe...
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.

12-09-2007, 09:27 PM   #27
Ammorth

Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Split the system. Hopefully all is well now.
__________________

01-04-2008, 07:09 AM   #28
Ammorth

Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Soo... I know it's the holidays and everyone is probably doing stuff, but whats the status of this? I doubt I will be able to do much after the holidays are up since exams are approaching.
__________________

 01-04-2008, 11:52 PM #29 moyack Evil Emoticon   Respected UserProject Leader: PoC   Join Date: Jan 2006 Posts: 3,279 Submissions (17) I'll check it out right now!!! EDIT: Ok, checked again and I only have one complain: I won the game but still I lost WHY??? WHY???? This bug must be fixed immediately or I'll found where you live and I'll kick in your ass!! I'm so angry that I'm going to fuck you in the worst way!!! ** Approved ** I like your system, and you did a very good test script of it, there's no bugs or anything odd. And the usefulness of this is very wide. Excellent work :) Last edited by moyack : 01-05-2008 at 12:15 AM.
01-05-2008, 04:52 AM   #30
Ammorth

Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Quote:
 Originally Posted by moyack EDIT: Ok, checked again and I only have one complain: I won the game but still I lost WHY??? WHY???? This bug must be fixed immediately or I'll found where you live and I'll kick in your ass!! I'm so angry that I'm going to fuck you in the worst way!!!

Ill take it you didn't read the note about how I don't give a shit about the demo game :P

The reason you both won and lost is because you have NoPause enabled through war3err. When you win, it pauses the game. Not being able to pause allows the timer to continue, forcing you to lose.

Gameover

Retry?
Y/N
__________________