ID:114690
 
Keywords: f_damage, library
F_Damage 1.1.0 is out!

Great! Wait, what?

Yeah, because F_Damage needed new features *eyerolls*. Actually, it did. SuperAntx happens to be using the library in Eternia: Prologue due to it's awesome performance. He liked it, he really did. But it was missing a certain ... someting.

Scientific notation kinda sucks

SuperAntx's first note was that scientific notation looks .... really odd in most games, if not all games. Although you can balance the numbers to avoid making big damage displays, the fact still remains: Scientific notation looks bad in games.

So what did I do? I added a #define flag, called F_damage_no_scientific. It turns off scientific notation, so instead of 1E+7, you just get 1000000. Simple.

Alignment is cool

Previously, F_Damage aligned the damage text in the centre of the target atom. So if you had a 96x96, it'd kind of just go middle-ish, centre aligning the text.

You do this by a new optional argument: halign. halign takes a new type of object in, an F_Damage_Horizontal_Alignment datum. F_Damage now also provides three horizontal alignment rules, called F_Damage.LEFT_ALIGN, F_Damage.CENTER_ALIGN, F_Damage.RIGHT_ALIGN. Being a datum, you can also implement your own alignment rules.

In summary

With the new release of F_Damage (1.1.0), you can do this:

F_damage(some_enemy, "#FF5603", F_Damage.RIGHT_ALIGN)


Pick it up here: http://www.byond.com/developer/Flick/F_Damage
It's still canned! Perhaps you should write an uncanned version?
Maybe I'll un-can it one day, but I doubt it could really ever be a full-on framework, you know. We'll see I guess.
How do I make it good aligned, so I can use it in my rpg?
Extend F_Damage_Horizontal_Alignment:

F_Damage_Horizontal_Alignment/Chaos_Neutral
align(var/obj/F_damage_num/O, var/target_width, var/damage_length, var/position)
O.pixel_x = ( position * F_damage_numWidth ) - damage_length * F_damage_numWidth + rand(-2, 2)


// Usage:
F_damage(src, rand(1,1000), "#ff0", new/F_Damage_Horizontal_Alignment/Chaos_Neutral())
Personally I feel that it needs a little something extra; perhaps if it could truly drill down to the core platform of BYOND and provide a co-processor stream, so I can execute all of my damage processing on the F_Damage thread.
Perhaps it could flip burgers also?
This library actively permeates my entire project. Thanks.
Stephen001 wrote:
Perhaps it could flip burgers also?

No, it should be able to make pizza also.
With anchovies.
It's me or after using "Big Test Left" it starts to lag :/
It does 1000 calls to F_Damage in 1.5 seconds real-time here. Can you profile the demo and see what you get?

It's probably worth noting that you'd find the case Big_Test to be pretty unlikely in a real game, as it's calling F_Damage in a tight loop, with no breaks for any other logic, or even time to let the damage display float up. The test is more for getting better CPU stats.
F_Damage is pawesome, I'm using it in AM Knight.
Nice! When you release it, I'll start to build up a list of games F_Damage is used in, to put on the hub.