/script>
[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

is it hard to make gauges programming wise?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 61
Thread images: 6

File: 30123012.jpg (22KB, 133x117px) Image search: [Google]
30123012.jpg
22KB, 133x117px
is it hard to make gauges programming wise?
>>
I dont know, but having a health bar in general makes the game much more enjoyable for me
>>
>>377921094
no
Quake is shit and out dated
And dead
TF2 is dead
Overwatch king now, bitter spergs
"C-C-CASUAL!!" and? Kill yourself.
>>
>>377921949
okay but what does that have to do with anything
>>
>>377922167
Quakebaby falseflagging, don't give him attention
>>
>>377922167
>>377922252
Never played Quake retard
It's a shit game for neckbeards though
>>
>>377921949
>>377922369
Proof that Overwatch fags are the worst, kys
>>
>>377921094
A straight health bar no, but something like KH's circular HP bar I'm not sure about.
>>
>>377921094
Why do you ask?
If you're going to make a game from scratch, I'd say gauges are the least of your worries.
>>
>>377921949
What thread was this even intended for.
>>
>>377921949
What the actual fuck are you going on about?
>>
>>377922891
Nigga you can program a health bar however you want, it's just an art asset.

Basically if you can draw a circle filled in to different degrees, you can program a circular health gage.
>>
>>377921094
Just make a straight HP bar and bend it with code.
>>
What exactly is the question here? I don't get it.
>>
>>377921094
It's much harder than straight gauges. With bars, you just have to make the bar and the bar back the same size, then change the width of the bar by using the current gauge amount over the maximum gauge amount.

You can also make a shader that takes a straight bar and bends it.

Some engines such as Unity support radial gauges automatically, though. Otherwise it will require a bit of Trig.
>>377921949
>people are trying false flag as Overwatch fans now because they're mad about the event threads.
Neat.
>>
>>377923694
>the op actually believes this
>>
>>377923157
ive been always fascinated by HUDs and im wondering if ill be able to make different gauges/bars for the game im working on

didnt stomp on it just yet
>>
>>377923694
onBarCreate(
bar.setCurvature(360));
>>
File: IMG_0562.jpg (107KB, 1267x887px) Image search: [Google]
IMG_0562.jpg
107KB, 1267x887px
>>377921949
>>
>>377921094
Absolutely not. Do you need help?
>>
>>377923830
>trig
Hahaha you don't even need trig you just need to split up the gauge like you would a pizza or something.

>>377923874
The secret to game design is that art assets are basically the smoke and mirrors that make your shitty code seem good, so learn to draw or git gud at Photoshop.
>>
>>377921094
no
the fact that you made a thread asking this question shows just how stupid you are
think for 2 seconds before you post
>>
>>377923830
>take a straight bar and bend it
>shader
Don't fucking doing this unless you want blurry garbage. Make your full bar art asset and then have a shader do a radial mask. It's not hard at all.

>>377924117
Extremely lazy 1990's way of doing it, don't do this either.
>>
>>377923961
bar.Walk(away)
>>
>>377923792
Do you have a reading disability? Nigga asked if it's hard to program guages.
>>
>>377923874
When programming it all reduces to numbers.
HP would be an int. For example, 250. That'd be maxHp.
currentHp would be equal to maxHp on the beginning of a fight/level/after completely healed.
Then you'd have different enemies with different hit power. So it'd be currentHp = currentHp - enemyAttackPower;
So the hud would have to update to show the new value stored in currentHp. Obviously, currentHp < 0 would mean game over.

For magic, at least like in the way KH1 works, it'd use little numbers. maxMp in that pic is 3.
So a fire attack would use 1.
In this case, currentMp = currentMp - magicMpCost;
The little yellow bar is just another abstraction of the numbers and how the magic used it.
>>
>>377923837
im not this innocent dont you even worry about it

>>377924070
its a college project but i appreciate the thought

>>377924135
im bored and im just about to touch the HUDs so why not ask just for the sake of it
>>
>>377924252
What if you wanted your bar to increase in length, though?
>>
>>377923961

woah, where'd you find yandere dev's code?
>>
>>377924450
>osana is still not done
>it's been about six months since he said a couple of weeks left
>tiny build still hasn't taken over

I wish I could create a scam so well executed.
>>
>>377924428
Depends. A straight linear bar? Just draw a rectangle with whatever length it is. Has a repeating texture? There's bindings for that, guarantied. Some kind of polygon? Mask off the right portion of the texture depending on how much health is missing.
>>
>>377924359
i understand how it works in the math, but thanks

mostly in doubt design wise
>>
>>377921735
I like games without HUDs. Like Crash with the mask presenting health. Or Super Mario with Mario's size showing his vitality.
>>
File: 1495161149578.jpg (57KB, 640x640px) Image search: [Google]
1495161149578.jpg
57KB, 640x640px
>>377921949
>>
>>377924356
Da fuq does piercings have to do with vidya?
>>
>>377921094
I'd just use a n-frame animation of the gauge at n different positions, then use the hp % to determine which frame to display.
>>
>>377921094
depends on the design, if it's just a rectangle it's easy

if it's like pic related i dunno lol
>>
>>377924898
worded it wrong

programming in the sense of having the assets increase and decrease, and design in the sense of having the maxHP and currentHP grow in the HUD
>>
>>377921949
nu-gamers everyone
>>
>>377925028
That sounds like it could be much better.
>>
>>377926063
In the sense that you can fully customize the appearance and animation of the gauge using any shape or combination of shapes, yeah it is.
>>
>>377921094
No. Just make 100x of bitmaps for each state of gauge and display the one which best fits the actual value of the variable it depicts. I'm not kidding, there are AAA games which literally did this.
>>
>>377926590
That sounds like a lot of unnecessary work
>>
>>377926590
I could see games with "life orbs" doing this
>>
>>377926704
I guess it easier to display a polygon with different texture on it depicting gauge than invent how to impose some procedurally drawn bar on rendered image in framebuffer in directx application.
>>
resource gauges are one of the easier things to implement.
>>
>>377921094
REAL vg programmer here.
I know my shit since early 2000s programming with c++ making own directdraw (for 2d games) engines etc etc.

Not gauges are not difficult at all.
you create a controller and then you call it with something like
>setHP(100, {otherparams} );

On a more technical level, on how it is being drawn there are many ways you can do it,

> you can build it using 2D primitives, like squares,circles, gradients
> you can use emulate a 2D gauge using 3D polygons that lay on a surface
> you can use precolored textures that you can trim/stretch
> you can use a spritesheet with each state being a different frame

AMA
>>
>>377927386

In English, Einstein.
>>
>>377927590
sorry I'm not native english
but no, it's not that difficult,
It's literally the easiest part of the game, once the design is fixed and you know what you need to do.

You just use polygons to draw them. It's the easiest way.
>>
>>377921094
No, it's extremely easy, more code than a bar but still really easy to make.
>>
>>377925015
kek
>>
Quick, post your favorite stat bars
>>
>>377924450
but i didn't make any if statements
>>
>>377922167
Dead Ringer's gauge in TF2 doesn't work properly. Might be that.
I honestly don't know.
>>
File: hud~2.jpg (3KB, 83x75px) Image search: [Google]
hud~2.jpg
3KB, 83x75px
>not representing your HP with a vertical bar that decreases and changes color, your characters face that gets more bloody, an accurate number below it and, optionally, your crosshair changing color
Bonus points if the characters face frowns angrily while you shoot and looks around shiftily while idle
>>
>>377927590
>>377927830
Your english was fine, he was just being a smartass
https://youtu.be/7bBxRf6g2pE?t=49s
>>
File: 1477483828880.png (200KB, 574x559px) Image search: [Google]
1477483828880.png
200KB, 574x559px
>is it hard to make gauges programming wise?
No. The concept is the same as a health bar. A health bar is a composite of a background texture, a "full health" texture, and a linear gradient. You feed in your health percent into the linear gradient as a masking value, which converts the 0-1 gradient into a binary 0 or 1 value. Then you just multiply the masking value by the full health texture.

A gauge is exactly the same, except instead of a linear gradient, you have a spiral gradient.

You can programmatically generate a linear gradient in shader code by getting the value of texcoord.x You generate a spiral gradient like pic by atan2(texcoord)
>>
>make a trianglestrip primitive with a high vertex count (probably something like 32 or 64, the bigger the higher)
>loop through all the vertices and:
>set the position to (radius of gauge) in the direction of (arc of gauge / vertex count) * index * (value / max value)
>map the texture from the start of the sprite to the length * (value / max value)
>>
>>377921094
>there are people on /v/ who are this oblivious to programming
>>
>>377930616
The Kingdom hearts gradient would be atan2(1-texcoord.x, texcoord.y) because it is flipped along the y axis
>>
File: circularbar.png (10KB, 561x497px) Image search: [Google]
circularbar.png
10KB, 561x497px
>>377930616
You could also make a circle like pic related, cut out 3/4 with a stencil and rotate the circle to change the gauge.
Thread posts: 61
Thread images: 6


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.