wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 11-20-2009, 10:03 PM   #1
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default ImageBars

To make it short, after messing around with images for some time and after rewriting TextSplat, i found using TextTags for bars a terrible approach (especially since its HARD to center those bars). So i wrote a library to display bars out of images.

This library uses vJass, ARGB and ImageUtils.

Images

ImageBar with full alpha background filling from left to right:
Zoom (requires log in)

ImageBar with full alpha background filling from right to left:
Zoom (requires log in)

ImageBar with full alpha background filling from bottom to top:
Zoom (requires log in)

ImageBar with full alpha background filling from top to bottom:
Zoom (requires log in)



Changelog

21/11/2009 - Version 1.0.0
- initial release

27/11/2009 - Version 1.1.0
- increased TICK to 1./40 to increase performance
- made the Z position of ImageBars relative to the Z of the ground
- added a way to get the color of each layer of a bar
- added a method to get the unit the bar is currently locked to
- added some more samples to the testmap
- included more sophisticated base images for bars based off of images included in Ammorth's MultiBar system.

08/12/2009 - Version 1.1.1
- added a Z offset from the unit the bar is currently locked to.
- integrated some samples into the test code (and fixed the samples' code).

23/01/10 - Version 1.1.2
- corrected documentation errors

28/02/2010 - Version 1.1.3
- fixed errors from ImageUtils popping up



Expand Library Code + Credits:

There are four more samples inside the testmap.
Attached Files
File Type: w3x ImageBars_1.1.3.w3x (85.5 KB, 137 views)

Last edited by Deaod : 06-29-2010 at 10:41 PM. Reason: Updated to 1.1.3
Deaod is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-20-2009, 10:54 PM   #2
Seshiro
User
 
Seshiro's Avatar
 
Join Date: Aug 2008
Posts: 158

Submissions (1)

Seshiro is on a distinguished road (20)

Default

In my opinion it doesn't really look good, and images do suck performance afaik
Seshiro is offline   Reply With Quote
Old 11-20-2009, 11:45 PM   #3
TriggerHappy
 
Join Date: Feb 2008
Posts: 405

Submissions (2)

TriggerHappy will become famous soon enough (43)TriggerHappy will become famous soon enough (43)

Default

Quote:
Originally Posted by Seshiro
In my opinion it doesn't really look good, and images do suck performance afaik

His examples are probably just ugly.

I think TOB uses something like this, with a blood bar or some shit.

I have never played it.
TriggerHappy is offline   Reply With Quote
Old 11-21-2009, 12:19 AM   #4
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

ToB probably uses a model for that, but i guess you could almost replicate that bar with this library (some properties would be hard to reproduce).

Also, images are fast enough. And you can have more than 99 imagebars at once.
__________________
Deaod is offline   Reply With Quote
Old 11-21-2009, 07:57 AM   #5
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

I think this is pretty cool...
  • You should set the default updates per second to 40 rather than 64, updating stuff more than 40 times per second never seems to make any visual difference, and I am one of those people who can perceive the difference between 60 and 100 FPS when playing a shooter.
  • I would like for the callback method to be as optimized as possible, even if it gets a little bit more ugly. The inlined code would not be much longer, and if anyone really uses this with 100 bars updating 40 times per second, the extra performance will be worth it.
  • You need to periodically update the z position of an imagebar that's locked to a unit to be equal to the z position of the unit, otherwise it looks bad when walking over uneven terrain.
  • Can you include a method to get the unit an imagebar is locked to?
  • You should probably make an effort to create a more attractive test map. These image bars should be superior to text tags for certain things, but people won't understand that or use this library based on the demo map provided.
grim001 is offline   Reply With Quote
Old 11-21-2009, 03:20 PM   #6
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Quote:
You should set the default updates per second to 40 rather than 64, updating stuff more than 40 times per second never seems to make any visual difference, and I am one of those people who can perceive the difference between 60 and 100 FPS when playing a shooter.
Will do.

Quote:
I would like for the callback method to be as optimized as possible, even if it gets a little bit more ugly. The inlined code would not be much longer, and if anyone really uses this with 100 bars updating 40 times per second, the extra performance will be worth it.
I see no way to optimize that function without fucking up the API of ImageUtils.

Quote:
You need to periodically update the z position of an imagebar that's locked to a unit to be equal to the z position of the unit, otherwise it looks bad when walking over uneven terrain.
I think ill make the Z position relative.

Quote:
Can you include a method to get the unit an imagebar is locked to?
Sure.

Quote:
You should probably make an effort to create a more attractive test map. These image bars should be superior to text tags for certain things, but people won't understand that or use this library based on the demo map provided.
I could try to port some examples from the TTBARS library.
Would any artist feel like it to create some images that could be used for a bar?
__________________
Deaod is offline   Reply With Quote
Old 11-27-2009, 03:58 PM   #7
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Version 1.1.0
__________________
Deaod is offline   Reply With Quote
Old 11-28-2009, 11:35 PM   #8
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

  • Since you made imagebar.z relative to the locked unit, .x and .y ought to have the same behavior.
  • You aren't using the actual z value of the locked unit, which makes it not look good when traversing uneven terrain. It also totally fails to notice the unit's flyheight.
  • Not breaking encapsulation is one thing, you should at least inline the GetUnitZ stuff for the Callback method though.
  • You included example code in the demo map, but the testmap doesn't actually show examples using that code.
grim001 is offline   Reply With Quote
Old 11-29-2009, 04:04 AM   #9
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Quote:
Since you made imagebar.z relative to the locked unit [...]
Its not relative to the locked unit. Its relative to the current Z of the ground beneath the origin of the background. Also, noones stopping you from throwing GetUnitFlyHeight into the Z member.
Quote:
Not breaking encapsulation is one thing, you should at least inline the GetUnitZ stuff for the Callback method though.
Ill optimize the Callback a bit.
Quote:
You included example code in the demo map, but the testmap doesn't actually show examples using that code.
Alright, gonna link them up.
__________________
Deaod is offline   Reply With Quote
Old 11-29-2009, 10:57 AM   #10
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Quote:
Originally Posted by Deaod
Its not relative to the locked unit. Its relative to the current Z of the ground beneath the origin of the background.
If it's locked to a unit, it ought to be locked to the unit on all 3 axes. It doesn't look like the tag is properly following the unit at all when you walk over uneven terrain. It would also totally fail to follow the unit if it got knocked into the air. Do you want the user to run another periodic timer that forces the Z to be the flying height of the unit? That might not even work correctly since they aren't running off the same timer; it could cause the bar's position to flicker.
grim001 is offline   Reply With Quote
Old 11-29-2009, 11:05 AM   #11
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Alrighty, gonna add a Z offset.
__________________
Deaod is offline   Reply With Quote
Old 11-29-2009, 05:01 PM   #12
Furby
User
 
Furby's Avatar
 
Join Date: Oct 2008
Posts: 26

Submissions (1)

Furby has little to show at this moment (7)

Send a message via ICQ to Furby Send a message via AIM to Furby Send a message via MSN to Furby
Default

No offense, but this looks f-ugly.

But, I have idea how to improve it. :)

Make simple 2D model which uses ingame textures and make animations for it, every animation will have differently filled bar, first animation 0/100, second 1/100 and so on. Then you just make unit with this model and move this unit with hero periodicly it will look much better, that's guaranted. :)

-Furby-
__________________
Living in the fantasy, that would be a life.
Furby is offline   Reply With Quote
Old 11-29-2009, 05:13 PM   #13
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Look, why dont you go and do it yourself? Why dont you draw some nice base images, which dont look "f-ugly" ingame?

You are missing the whole point of this library (scripting the bars).
__________________
Deaod is offline   Reply With Quote
Old 11-29-2009, 06:26 PM   #14
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

Damn, yo, nice, ey.

Must say I kinda like your coding style and the method you build these systems of yours. This system looks pretty cool.

Anyways, you think that moving that location in GetPointZ can cause desyncs if I do some stuff with GetLocalPlayer()?

Have you tested that which methods can be used locally and stuff?


Also, this is kinda offtopic, but since you have been playing with these images lately, Id like to know if you know how fast is creating and destroying images.
Would creating and destroying few dozens or hundreds of images every .03 sec cause some strain and stuff or what you think?
__________________
No Marlo, no game.

Last edited by Viikuna- : 11-29-2009 at 06:27 PM.
Viikuna- is offline   Reply With Quote
Old 11-29-2009, 06:47 PM   #15
Furby
User
 
Furby's Avatar
 
Join Date: Oct 2008
Posts: 26

Submissions (1)

Furby has little to show at this moment (7)

Send a message via ICQ to Furby Send a message via AIM to Furby Send a message via MSN to Furby
Default

Eww.. sorry I didn't really mean to offend you. I was just commenting the basic look of that picuture and my feeling of it in real map usage.

Sorry, didn't mean it like that.
__________________
Living in the fantasy, that would be a life.
Furby is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 11:28 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services