673f89d866141

673f89d867504
4 Guests are here.
 

Topic: Better Weapon Info test Read 4836 times  

673f89d8680b6ZylonBane

673f89d868124
This mod is an attempt to turn SS2's weapon settings MFD into something more like the weapon panel in Deus Ex, displaying detailed weapon stats and which stats have been affected by modification. The primary motivation for this was to allow players to directly see the effects of the SCP Tinker OS upgrade (which improves the effect of all weapon modifications), but it should be useful for non-SCP players as well.

There were some interesting challenges with this:

The script API, somewhat surprisingly, doesn't have functions for unloading weapons or changing their fire modes, so all the engine code that does this had to be re-implemented in Squirrel.

The overlay API provides no functionality for buttons or scrolling text boxes. You have to roll all that yourself.

The overlay API provides no functionality for replacing existing MFD panels or otherwise integrating with the MFD system. Creating the illusion of having done so can only be accomplished by acts of rank skulduggery.

The overlay API provides no functionality for rotating bitmaps. Since I wanted to display the weapon icon at the top of the panel, but all the weapon icons are oriented vertically, I ended up using the sub-bitmap rendering function to redraw the bitmaps into a rotated orientation, one pixel at a time. This in turn required drawing the weapon icons into a "transparent" overlay, which has the advantage of not needing to be re-rendered every frame, so this rotation process could be done only once when the panel is first opened. An earlier version of this mod just included pre-rotated icon bitmaps, but that would have made this incompatible with mods that include their own weapon icons, and we can't have that now can we.

Turns out that in Dark, projectile velocities are non-linear. For example, input of velocities from 1 - 10 results in actual velocites per velocity unit of:
- 1: DU/Sec: 0.40
- 2: DU/Sec: 0.70
- 3: DU/Sec: 0.80
- 4: DU/Sec: 0.85
- 5: DU/Sec: 0.88
- 6: DU/Sec: 0.90
- 7: DU/Sec: 0.92
- 8: DU/Sec: 0.93
- 9: DU/Sec: 0.94
- 10: DU/Sec: 0.942
(DU = DromEd Units)

They eventually converge on a 1:1 relationship once velocities get around the 50s, but still, this makes the projectile velocities reported somewhat approximate. On top of that, there's never been any well-defined relationship established between DromEd units and real-world distances, so this entire stat is a bit wobbly.

And sadly, there appears to be no way for Squirrel to detect mousewheel events, so I couldn't replicate NewDark's cool mousewheel scrolling of text boxes. You gotta use the scroll buttons like some kind of savage.

Anyway, the mod in its current state reports the following info about each weapon. Any modified stats are indicated by the percentage change from the base stat.
- Modification level + description
- Condition
- Fire mode (semi-auto, full auto, burst)
- Fire rate
- Ammo per shot
- Clip size/energy capacity
- Projectile velocity
- Reload time
- Reliability
- Stat requirements to equip, maintain, modify, and repair
- Ammo type(s) used

What's not yet reported is damage per shot and kickback. These both require consolidating a large amount of information into a single number, and I haven't figured out yet what the best way is to go about this. Damage in particular is going to be a huge pain in the ass due to all the different ways there are to implement damage sources in Dark.

And I reaaalllly doubt this will play well with RSD. It would be nice if it did, but RSD commits a lot of upgrade and UI shenanigans of its own.



EDIT: Testing complete, posted in mods forum here.
« Last Edit: 03. November 2024, 16:41:50 by ZylonBane »

673f89d868279Dark-Star88

  • Company: I freaking wish
673f89d8682d1
DAMN!  :stroke:

ZB still figuring out how to make the Dark engine dance like a monkey!

Don't feel bad that you couldn't do all you wanted, it's amazing you got this far! I'll give it a look-see soon.

673f89d86841fvoodoo47

673f89d868475
had the CZ translation loaded when trying this, the text part is not compatible obviously, but oddly enough, the button on the left is translated while the one on the right is not.

need to find the texture name somehow.

673f89d868576ZylonBane

673f89d8685c4
The text displayed on the mode switch button is pulled from the same string file the weapon HUD uses, so it will get translated. There is no vanilla string that just says "UNLOAD" though. In the vanilla Settings panel the text on that button is part of the bitmap. "SETTINGS" should be localized though, since it loads the original background and pastes just the label part over the custom background that this uses. If you look at iface/wsettbkg.png in this mod you'll see that the label region is blank.

I'll eventually break out all the non-vanilla text into a standalone string file so this can be easily localized.
Acknowledged by: voodoo47

673f89d868664ZylonBane

673f89d8686b1
Download updated. Now displays weapon condition icon, and all text now translatable via external string file.

673f89d8687b9ZylonBane

673f89d868808
On the damage line, I'll be indicating damage sources that do radius damage instead of contact damage, but I can't decide what the best word for it would be. "Blast"? "Area"? "AoE"? "Radius"? Something else?

Also, @RoSoDude, I'd like to try making this compatible with RSD, but to do that it will have to launch RSD's modification panel when the Modify button is clicked. Is there any way for another script to do that?

673f89d8688c3voodoo47

673f89d868918
blast maybe not as not everything also explodes, AoE sounds too gamey, radius a bit editoresque, so area, perhaps.

673f89d868d86RoSoDude

673f89d868ddc
On the damage line, I'll be indicating damage sources that do radius damage instead of contact damage, but I can't decide what the best word for it would be. "Blast"? "Area"? "AoE"? "Radius"? Something else?

Also, @RoSoDude, I'd like to try making this compatible with RSD, but to do that it will have to launch RSD's modification panel when the Modify button is clicked. Is there any way for another script to do that?

SS2-RSD actually swaps out the native HRM plug overlay for a custom replacement overlay when the weapon settings overlay is opened. If you tested the mods together and my modification menu didn't open, then it's probably something I need to update on my end. I probably need to make my check for HRM plug replacement earlier or something.
673f89d868f88
Thats a nice idea for a mod. I remember that some weapons in original SS2 were having some unique properties like reduced recoil, more accuracy, never jamming etc. then it were patched out by some release of community patch. With such info being displayed it makes sense to make different versions of the same gun present again now that player can observe and compare the difference between the two guns not only by trial and error. After all what if these unique stats were not a bug but a feature? I recall some buffed shotguns, pistols and rifles being present only in some well hidden or protected places so it makes sense to have some high quality rewards for exploration.

673f89d869275ZylonBane

673f89d8692c9
SS2-RSD actually swaps out the native HRM plug overlay for a custom replacement overlay when the weapon settings overlay is opened.
With this mod the native settings overlay is never opened. WeaponScript is replaced with a custom script that opens the custom overlay, including custom Repair and Modify plugs, because the native ones interfere with rendering of script overlays.

I just took another look at the RSD code for launching the custom modify overlay, and it appears to rely on setting private variables to get it to activate, unfortunately. If it was instead something like posting a message, or calling a function in one of its classes (which Squirrel sometimes allows between scripts, oddly), that would have worked.

673f89d8698c8sarge945

673f89d869924
Thats a nice idea for a mod. I remember that some weapons in original SS2 were having some unique properties like reduced recoil, more accuracy, never jamming etc. then it were patched out by some release of community patch. With such info being displayed it makes sense to make different versions of the same gun present again now that player can observe and compare the difference between the two guns not only by trial and error. After all what if these unique stats were not a bug but a feature? I recall some buffed shotguns, pistols and rifles being present only in some well hidden or protected places so it makes sense to have some high quality rewards for exploration.

Even now, with the modification level clearly visible, the vast majority of newer players, at least from what I have seen, always miss the first modified pistol (available in medsci2) because without opening the overlay, it just looks like a crappy condition 1 pistol (which, incidentally, is why I keep pestering the SCP devs to add the arrows from RSD to denote upgraded weapons in the inventory).

If they miss something as obvious as the modification level, how can you expect people to discover that a weapon has altered stats?

But the problem goes further than simply not having the altered stats displayed somewhere. The actual implementation itself was bad. Several weapons were unbreakable, but would still degrade as usual down to a condition of 1. Because there's already a degree of chance associated with weapons breaking, many people would (rightfully) think that maybe they just got really lucky and their weapon didn't break  when it got to low condition.

These modified weapons were clearly not a bug. The concretes in the maps were clearly modified to have alternate stats, which was an intentional process and very unlikely to have happened by accident. They were presumably removed because they were confusing, janky, and inconsistent, rather than being a bug, and while the altered stats menu certainly helps to deobfuscate things a little, it doesn't really solve the fundamental problem.

On that note, @ZylonBane or @voodoo47, do either of you have a list of the unique vanilla weapons on-hand? I can't find them anywhere in the wiki and I'm curious about them, and I don't want to have to go searching through every single map in the editor.

673f89d869ae8ZylonBane

673f89d869b38
No, I don't think we have a master list of weapons where modified properties were pre-set on the concretes. IIRC most of the "special" weapons were fixed by ADaOB.

These modified weapons were clearly not a bug. The concretes in the maps were clearly modified to have alternate stats, which was an intentional process and very unlikely to have happened by accident.
Oh you sweet summer child. Over the course of creating SCP we've found SO MANY objects with inherited properties redundantly set on the concretes, either from changing technology over the course of development, changing standards for how to do things, authors just not understanding how things work, and probably plain old fucking around. And that's not even getting into all the objects with duplicated scripts, inapplicable properties, broken schemas, and nonsensical links. There's so much mess in vanilla SS2 it's a wonder it works as well as it does.

Intentionally putting in weapons with normally undiscoverable special attributes would have been extraordinarily unlike Looking Glass and Irrational, given how much effort they put into designing their games to empower the player to make informed decisions.

673f89d869da9ZylonBane

673f89d869df9
In on-topic news, weapon kickback is such a byzantine mess.

All guns have a "Kickback" property that, like Base Gun Description, has a unique set of attributes for each gun setting.

Further, these attributes are divided into "Kickback" and "Jolt". Kickback controls the animation of the weapon model when firing. Jolt controls how the player view is jerked around. There's "Jolt Pitch" for up/down rotation, "Jolt Heading" for left/right rotation, and "Jolt Back" for player knockback. Jolt Pitch and Heading seem to generally implement the concept of muzzle rise (though it can also randomly lower the muzzle as well), while Jolt Back seems to represent recoil.

But wait! For some reason the Player Gun Description property contains a Flags field that allows selectively enabling/disabling the aforementioned Jolt Pitch and Jolt Heading. For Jolt Pitch there are separate up and down rotation flags, and for Jolt Heading there are separate left and right rotation flags. There is no flag for Jolt Back. Some weapons have both Jolt Pitch and Heading enabled, while others, like the pistol, only have Pitch enabled.

And then there's agility and the Neuro-Reflex Dampening psi skill for reducing kickback. Agility reduces all kickback stats by multiplying them by (8 - Agility) / 7. Psi dampening zeros all kickback stats.

Well... not ALL stats. The Jolt Back stat is unaffected by both agility and dampening. So the dampening description "Eliminates all weapon kickback." is a damn lie. Though to be fair this stat is set at a negligibly low level in the vanilla gamesys.

But Jolt Back can be reduced by weapon modification! But only on the shotgun. None of the other vanilla weapons support reducing their kickback.

All of which leads to the question, how the heck does one boil all this down into a meaningful single number? Just add all the Jolt stats together? Average them? Average Jolt Pitch and Heading and then add Jolt Back? Display whichever is the highest? Omit Jolt Back entirely? Present Jolt Pitch/Heading and Jolt Back as separate stats?

673f89d869f44RoSoDude

673f89d869f93
Jolt Back is nearly irrelevant as a stat, to the point that no one ever noticed that it kicks you forward. I mean, I did actually notice this when I was looking over recoil stats, but I figured "eh, who cares."

Jolt heading and pitch should ideally be combined into one stat via the Euclidean norm, i.e. the square root of the sum of squares:
Code: [Select]
recoil = sqrt(heading*heading + pitch*pitch)
This measure tells the player the total amount that their view will be jerked after each shot. It's a better measure than the average since it properly accounts for the fact that 5 units of jolt pitch + 5 units of jolt heading is less total recoil than 10 units of jolt pitch (triangle inequality).
Acknowledged by: ZylonBane

673f89d86a0a1ZylonBane

673f89d86a0f0
Just discovered something interesting. While it's not possible to use PostMessage() in overlay handlers because that function doesn't exist in the IShockOverlayHandler class, it IS possible to use Networking.SendToProxy() to accomplish basically the same thing.

So instead of:
PostMessage(obj, "message", data);

You can do:
Networking.SendToProxy(Networking.Owner(obj), obj, "message", data);

Wrapped thusly...
Code: [Select]
function PostMessage(obj, msg, data=null) {
if (obj) {
Networking.SendToProxy(Networking.Owner(obj), obj, msg, data);
}
}
The only caveats seems to be a limit of a single data item, and message.from() always reading as 0.
Acknowledged by: RoSoDude

673f89d86a232ZylonBane

673f89d86a286
Download updated. Now pretty much functionally complete. Displays damage for current weapon/ammo. Calculates reload time properly, taking the animation time into account. Displays kickback and reliability (degradation rate). Bonus displayed for guns should now take into account all applicable stats, implants, OS upgrades, and psi powers.

In this version the stat requirements section displays an asterisk next to all stats that you've met the minimum requirement for. I'm not sure if I like this. It's informative, but I think it looks a bit odd.

Here's how it's looking currently:

673f89d86a3b6Nameless Voice

673f89d86a404
Would it be possible to make the ones you don't qualify for a different colour?

Though that would probably look awful even if it was possible.

673f89d86a516tiphares4

673f89d86a562
Teal or dark pink or critical-node colored, or some hue of red.. it doesn't have to look bad i think when adjusted properly to harmonize with the other colors (green).  : )


edit: ok, bad idea :/
« Last Edit: 25. September 2024, 13:45:06 by tiphares4 »

673f89d86a7ceZylonBane

673f89d86a822
Would it be possible to make the ones you don't qualify for a different colour?
It would not, since the font SS2 uses for all its small anti-aliased text is the "AA" type that can't have its color changed.

But even if it could, the overlay API doesn't support any sort of rich text encoding, so instead of rendering the entire scrolling text region with a single draw call, some much more complex scheme would have to be devised.

And even if all that was done, multiple body text colors would be inconsistent with SS2's design language. I'm trying to make this as visually consistent as possible with the vanilla UI so it doesn't feel out of place.

673f89d86ac2csarge945

673f89d86ac80
Here's how it's looking currently:


No wonder your shotgun doesn't work, some idiot filled it full of jam!

Actually seriously though, I feel like the "Modifications: 2" text should be moved from the top of the window to being the first item in the list. Especially since so many other stats (damage, reload, etc) are modified directly by the modification level. It's easy to miss. I know that it's supposed to be consistent with the vanilla weapon window, which has the modification level inside the display box, but here we are already showing all the other weapon stats in the main text display, so it really should be there alongside the others.

Are the numbers in brackets applied before or after the number next to them, it seems ambiguous? For example, does the shotgun do 10 damage (with a base damage increased by +25% to a total of 10), or does it do 12.5 damage (10 damage +25%).

For some reason, I seem to remember some weapons being able to break at 2 condition, rather than 1 condition. If this is the case, it should be documented somewhere, maybe a "Break Threshold" stat. Also, what about "Degrade Rate Per Shot", since IIRC different firemodes degrade at different rates (especially important for laser pistol overcharge, which is very damaging to the weapon). It might also be useful to have "Repair Amount Per Tool", which is the current calculated amount of condition the weapon will gain, per maintenance tool.

It would be nice to know the exact breakdown for our damage, how much of it is from the weapon's base damage, how much from weapon skills, how much from Strength (if relevant), how much from O/S Upgrades, how much from modifications.

Even some basic information for newer players, like a line saying "Gains damage from Strength and Standard Weapons Skill" somewhere.

Sorry this is a bit of a ramble, I have just appended stuff as I have thought of it.
« Last Edit: 26. September 2024, 04:09:32 by sarge945 »

673f89d86adb1Nameless Voice

673f89d86ae05
The modification level could be displayed in both places, both at the top of the description, and in the stats.

I'd say the fact that the percentages are in brackets should indicate that it means "damage: 10 (25% above base)".
It does look like there would be enough room for "damage: 10 (8 + 25%)" though - but maybe not for any large numbers?

For the requirements, maybe instead of the silly colours, it could add a line to the bottom saying something like "Strength requirement not met."

673f89d86b33eZylonBane

673f89d86b397
Are the numbers in brackets applied before or after the number next to them, it seems ambiguous?
Forcing players to grab a calculator to determine the actual current stat value would be sociopathic design. Of course the main number displayed is the current active value. The percent is the deviation from baseline.

For some reason, I seem to remember some weapons being able to break at 2 condition, rather than 1 condition.
The viral proliferator can break at 25% condition. All others break in the 10% - 20% range. It's such a minor distinction it hardly seems worth exposing. Players should basically assume that any weapon in the red is about to break.

Also, what about "Degrade Rate Per Shot", since IIRC different firemodes degrade at different rates
That's already in there, as the "Reliability" stat. A gun showing 99% reliability means it loses 1% condition per shot. Also, in vanilla all weapons degrade at the same rate regardless of fire mode. Mode-dependent degradation actually requires script fuckery; it's not natively supported by the engine.

It might also be useful to have "Repair Amount Per Tool", which is the current calculated amount of condition the weapon will gain, per maintenance tool.
Maintenance tools improve a gun's condition by a flat +10 * Maintenance skill. It's not a per-gun stat.

It would be nice to know the exact breakdown for our damage, how much of it is from the weapon's base damage, how much from weapon skills, how much from Strength (if relevant), how much from O/S Upgrades, how much from modifications.
I agree it would be nice to see all that, but the text window in SS2's MFD panels is only about 25 characters wide. Including all that information could very easily lead to a cluttered, hard-to-read display.

Even some basic information for newer players, like a line saying "Gains damage from Strength and Standard Weapons Skill" somewhere.
That information is already present in the weapon description text, which this mod provides a shortcut to via the [?] button, and explicitly stated in the combat stats MFD.

673f89d86b49bRoSoDude

673f89d86b4f7
My armor stat display window uses angle brackets to display changes to stats, so it's clear what the base > current value is.

https://i.imgur.com/Kf7xEou.png

Maybe I should make that a "->" though...

673f89d86b61eZylonBane

673f89d86b66b
That works too. For this I'm explicitly mimicking the equivalent panel in Deus Ex.



Deus Ex's UI has the advantage of more horizontal space, and a more advanced layout engine that can do columns, mix fonts, etc., so it can get away with being much more information-dense.

I briefly considered making my panel wider, but had to reject that idea because in UI resolutions 1024x768 or higher the MFD panels are placed at the top of the screen instead of the bottom, so a wider MFD would have conflicted with the inventory. Also it just would have looked weird.

Your name:
This box must be left blank:

Look at you, hacker: a pathetic creature of ____ and bone!  (Fill in the missing word):
4 Guests are here.
Looking Glass didn’t just want to move the needle, they wanted to break the scale.
Contact SMF 2.0.19 | SMF © 2016, Simple Machines | Terms and Policies
FEEP
673f89d86e717