Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
LatwPIAT
Jun 6, 2011

Managed to add gun that fires physical bullets instead of raytracing! Took some work to figure out how to get it to fire in the direction the gun was pointed (at first it fired off to the side, and when I'd fixed that I realised it was locked to the Z-plane), but now it fires giant chrome bowling balls at the shooting gallery!

Adbot
ADBOT LOVES YOU

LatwPIAT
Jun 6, 2011

New question:

The tutorial I've followed has a shooting gallery with Actors that serve as targets. Following the same tutorial I added a raycasting gun does LineTraceByChannel that, on a hit, goes into a Spawn Emitter At Location into an Apply Damage. The Out Hit output of LineTraceByChannel goes into Break Hit Result, with the Location output feeding into the Spawn Emitter At Location and the Hit Actor output feeding into the Apply Damage.

I also have a gun that spawns a moving bullet Actor. The bullet's Event ActorBeginOverlap goes into Apply Damage.

For the shooting gallery targets, raytracing and collision with a bullet makes their Event AnyDamage fire and execute its code as I expect. For the raytraces, a particle emitter momentarily appears on the surface of the shooting gallery target.

I also added an enemy Actor by following a tutorial. It also has an Event AnyDamage. When the enemy is collides with a bullet Actor, the Event AnyDamage clearly fires.

But when I use a raytrace weapon on the enemy, nothing happens: no particle emitter appears on the enemy and it never dies. Furthermore, shooting gallery targets beyond the enemy Actor do take damage (I can't see if the particle emitter happens). So clearly, for some reason, raytraces fire hits with shooting gallery target Actors, but completely ignore the enemy Actor: they're not even blocked.

What could I be doing wrong here?

12 rats tied together
Sep 7, 2006

I don't know UE4 but its fairly common, in my experience, for raycasters to have some "array of objects to consider". It seems like this is the "ByChannel" part of your raycast call, are the actors that aren't receiving damage part of the channel your raycaster is checking?

LatwPIAT
Jun 6, 2011

Good idea: I changed it from Trace Channel: Visibility to Trace Channel: Camera. That worked, thanks! (I just have no idea why, which terrifies me.)

dreamless
Dec 18, 2013



LatwPIAT posted:

Good idea: I changed it from Trace Channel: Visibility to Trace Channel: Camera. That worked, thanks! (I just have no idea why, which terrifies me.)

Collision stuff in unreal is a pain in the rear end. If you look at your actors' components, under collision there's a "collision presets" and if you open that up it'll show their response to each trace channel (and their object type; some kinds of collision use that instead). Eventually you'll probably want to make your own trace channel for bullets, in project settings > engine > collision, but in the spirit of learning one thing at a time I'd put it off for now.

12 rats tied together
Sep 7, 2006

I agree that seems weird. :)

These days I mostly use three.js, which despite being javascript, makes this behavior much more obvious IMO: https://threejs.org/docs/#api/en/core/Raycaster.intersectObjects

JavaScript code:
raycaster = new THREE.Raycaster();
const intersects = raycaster.intersectObjects( scene.children );

more falafel please
Feb 26, 2005

forums poster

LatwPIAT posted:

Good idea: I changed it from Trace Channel: Visibility to Trace Channel: Camera. That worked, thanks! (I just have no idea why, which terrifies me.)

It's been a while and I don't have an example UE4 project available, unfortunately -- the curse of contract work, but I do know some about this. You're on the right track in that there's something different about your shooting gallery Actors and your spawned enemy Actors that means they respond to different trace channels. If one of them is a Pawn subclass and the other isn't, that might explain it -- in general, Pawns are actors that have a controller, whether that's a PlayerController for a PlayerCharacter (which is a Pawn), an AIController for AI controlled pawns, or a custom one. Pawn is also one of the Object Types that can be included or excluded from a trace channel: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Physics/Collision/HowTo/AddCustomCollisionType/

I don't think you should need to add a custom collision type or a custom trace channel, but the question you need to answer is what's different about the two Actors that makes one of them respond to a Visibility trace and one of them not.

LatwPIAT
Jun 6, 2011

dreamless posted:

Collision stuff in unreal is a pain in the rear end. If you look at your actors' components, under collision there's a "collision presets" and if you open that up it'll show their response to each trace channel (and their object type; some kinds of collision use that instead). Eventually you'll probably want to make your own trace channel for bullets, in project settings > engine > collision, but in the spirit of learning one thing at a time I'd put it off for now.

more falafel please posted:

I don't think you should need to add a custom collision type or a custom trace channel, but the question you need to answer is what's different about the two Actors that makes one of them respond to a Visibility trace and one of them not.

Found that the shooting gallery targets's cube mesh were BlockAllDynamic (blocking Visibility) and the enemy's skeletal mesh was Pawn (ignoring Visibility). I've changed the enemy's skeletal mesh to BlockAllDynamic, and now the enemy properly die and spawn particle emitters when shot with raytrace guns. Thanks!

KillHour
Oct 28, 2007


PSA: You almost certainly don't want your UI set to "Constant Pixel Size." Setting it to "Scale With Screen Size" fixed my scaling issues.

KillHour
Oct 28, 2007


For these two images:

A:
B:

Which image shows the game in a state of "paused"?
Which image shows the game at a speed of "fast"?
which image shows the audio in a state of "mute"?

KillHour fucked around with this message at 08:18 on Mar 9, 2022

Bongo Bill
Jan 17, 2012

My answer might change depending on whether or not those icons are interactive, which in turn I might infer based on their resemblance to other interactive vs. informative UI elements, their location on the screen, and whether I've tried to interact with them.

KillHour
Oct 28, 2007


Bongo Bill posted:

My answer might change depending on whether or not those icons are interactive, which in turn I might infer based on their resemblance to other interactive vs. informative UI elements, their location on the screen, and whether I've tried to interact with them.

They are all the buttons you click to change that state. So clicking on whichever image you think is "paused" would unpause the game and change to the image for "unpaused." Ditto for mute and toggling speed between normal / fast. The button on the far right opens a help menu and doesn't change state.

Bongo Bill
Jan 17, 2012

In that case, my answers are B for all three , but weakly so since I can probably just look at or listen to the game to verify my intuition.

12 rats tied together
Sep 7, 2006

In the icon set for "B", the game is playing, it is muted, and it is going "fast" -- the icons represent the state of the game, and not the actions I want to take. I don't have anything to back this up except personal preference, but, I think it's a lot more intuitive if you have 3+ possible states (ex: normal, fast, veryfast). I would not choose to place the burden for figuring out what a button does on the user by having them consider their perception of actual state and reason about what the opposite would be.

KillHour
Oct 28, 2007


Bongo Bill posted:

In that case, my answers are B for all three , but weakly so since I can probably just look at or listen to the game to verify my intuition.

Those were my answers too, and I'm having a really hard time squaring that logically.


I originally had all three be "the image shows what the state will be when you click it" and that worked fine for pause, but for "fast speed" it felt wrong. My brain wanted the game to show the fast speed icon when the game was in fast speed, and not when it would make the speed fast on click. But it also feels weird to have one button that behaves the opposite of the other two. I blame playing Sim City a lot as a child.

Oddly enough, I feel completely ambivalent about mute - could go either way for me.


12 rats tied together posted:

In the icon set for "B", the game is playing, it is muted, and it is going "fast" -- the icons represent the state of the game, and not the actions I want to take. I don't have anything to back this up except personal preference, but, I think it's a lot more intuitive if you have 3+ possible states (ex: normal, fast, veryfast).

I know where you're coming from, but I really don't want to implement a completely different button type that isn't native to my UI package just to handle "the speed toggle from Sim City / The Sims." You'll have two speeds and you'll like it! :colbert:

12 rats tied together posted:

I would not choose to place the burden for figuring out what a button does on the user by having them consider their perception of actual state and reason about what the opposite would be.

Isn't that what you're doing when you have the button show current state though? The user would have to look at the button showing a play symbol and think "the game is playing right now so if I click it, it will do the opposite and pause it" whereas "this button is a pause symbol so it will pause the game" seems like less cognitive load.

KillHour fucked around with this message at 08:38 on Mar 9, 2022

12 rats tied together
Sep 7, 2006

Its what I was getting at when I mentioned 3 states, but phrased poorly. Imagine you do actually have sim city's 5 speed modes: what should the button look like when the speed is set to 3? It should just be 3 fast arrows, the user can click it and note that it is now 4 fast arrows and that the game is moving faster.

If the button always showed what the "next" speed would be, the fastest state of the game would appear in the UI as if it were the slowest, or vice versa.

KillHour
Oct 28, 2007


12 rats tied together posted:

Its what I was getting at when I mentioned 3 states, but phrased poorly. Imagine you do actually have sim city's 5 speed modes: what should the button look like when the speed is set to 3? It should just be 3 fast arrows, the user can click it and note that it is now 4 fast arrows and that the game is moving faster.

If the button always showed what the "next" speed would be, the fastest state of the game would appear in the UI as if it were the slowest, or vice versa.

I agree with this. But what about pause and mute? Is it more important that the button behavior is consistent, or that the pause button works like you would expect a pause button to (where it shows the pause symbol while playing and the play symbol while paused)? When I have it set so that the pause button shows the state the game is currently in, it feels weird to me.

Bongo Bill
Jan 17, 2012

Volume and speed icons are commonly used as indicators of more than just a binary state, even if it is a simple toggle in this particular case, so choosing anything but the current value seems arbitrary. Meanwhile, the pause/play icons are informed by the design of physical buttons that don't change in appearance when activated, so it gives the impression of being an instruction rather than an indicator.

One possible approach might be to unify the pause/play control with the speed control. Paused is just another speed, right? Then you can have the three settings - paused, slow, and fast - visible as separate icons, one of which is styled active while the other two are styled inactive.

KillHour
Oct 28, 2007


I could do that but it would be a lot of work for various reasons to do with the specific implementation. I might come back to it later.

TIP
Mar 21, 2006

Your move, creep.



I think the established patterns for those types of buttons are the following:
▶️ should show when something hasn't been started yet or has been paused
⏸️ should show when it's playing
⏩ should show no matter what and cycle through your speeds
🔇 should show when it's muted
🔊 should show when it's unmuted

I couldn't find any apps that use multistate playback speed buttons but if you really want that I think it should show the current state

if you want to further increase clarity you could add some text that displays above them temporarily on state change and says things like "playing", "paused", "2x speed", etc...

Phigs
Jan 23, 2019

For play/pause my preferred is a pause ( || ) button that appears raised/depressed or inactive/active depending on if the game is paused. Same for accelerated and muted. So by default you'd have a panel that is ABB with the icons inactivated, which expresses, respectively: not paused, not accelerated, not muted.

Otherwise yeah, if the buttons switch then it's a tossup in my mind whether an icon means it is active now or it's what I get when I press the icon. And I've definitely gotten them confused even in programs I've used. Especially if there's something could be a pause or mute like an especially long period of blackness or no sound... is it supposed to be playing right now or is it paused? Which way was it again?

LatwPIAT
Jun 6, 2011

If you absolutely have to keep the interface small, then one button that shows ▶️ when the program is paused and ⏸️ when the program is playing, and a single button showing 🔇 when muted and 🔊 when unmuted is fairly standard. However, since ▶️/⏸️ and 🔇/🔊 have different behaviour, they should not look the same: separate 🔇/🔊 off to the side and use a different button size/shape. (Generally, a small gap between buttons controlling playback and buttons controlling sound is a good thing anyway, since they're separate domains.)

Otherwise, as others have mentioned, full menu: ⏮️⏪▶️⏸️​⏩⏭️​—🔊🔇

(There's actually a dedicated icon for buttons that have both the function of play and pause: ⏯ Unlike a morphing button it doesn't show what pressing it will do, but it does show that this button does have both functionalities. Especially useful on physical devices that can't change what the button displays.)

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

KillHour posted:

which image shows the audio in a state of "mute"?
If it helps, the answer to this question is completely arbitrary and can't even be agreed upon within the products of a large company that are performing essentially the same task.

e.g. check out "Google Meet", which uses crossed-out microphone to signify you're muted, and Google's "smart displays" which, when interacting with a doorbell camera, use crossed-out microphone to signify that after you tap the button you will be muted, i.e. you are not currently muted.

The appearance of the crossed-out microphone icon is consistent but its meaning is inverted.

(Apparently this is because the smart display interface was from the Nest department - they bought a product that had the inverted meaning from other Google products, and didn't want to annoy existing customers by changing their interface, so instead they just have inconsistent interface across Google forever.)

D34THROW
Jan 29, 2012

RETAIL RETAIL LISTEN TO ME BITCH ABOUT RETAIL
:rant:

KillHour posted:

For these two images:

A:
B:

Which image shows the game in a state of "paused"?
Which image shows the game at a speed of "fast"?
which image shows the audio in a state of "mute"?

I am of the opinion that a button like that should display its state. That's what's intuitive to me and how I treat my UI design. Ideally, it would be A, B, B.

LatwPIAT posted:

If you absolutely have to keep the interface small, then one button that shows ▶️ when the program is paused and ⏸️ when the program is playing, and a single button showing 🔇 when muted and 🔊 when unmuted is fairly standard. However, since ▶️/⏸️ and 🔇/🔊 have different behaviour, they should not look the same: separate 🔇/🔊 off to the side and use a different button size/shape. (Generally, a small gap between buttons controlling playback and buttons controlling sound is a good thing anyway, since they're separate domains.)

Otherwise, as others have mentioned, full menu: ⏮️⏪▶️⏸️​⏩⏭️​—🔊🔇

(There's actually a dedicated icon for buttons that have both the function of play and pause: ⏯ Unlike a morphing button it doesn't show what pressing it will do, but it does show that this button does have both functionalities. Especially useful on physical devices that can't change what the button displays.)

These are also good points.

KillHour
Oct 28, 2007


Thanks for all the input. The good news is it's exceedingly obvious when the game is paused (thanks to a massive "PAUSED" in the center of the screen) and I expect players to rarely, if ever, interact with those controls, which is why they are so compact. Sounds like I can do whatever feels natural and people will generally figure it out.

zachol
Feb 13, 2009

Once per turn, you can Tribute 1 WATER monster you control (except this card) to Special Summon 1 WATER monster from your hand. The monster Special Summoned by this effect is destroyed if "Raging Eria" is removed from your side of the field.
Yeah for FF and mute I would have the displayed icon show the current state (B), and for play/pause I would distinguish it somehow (make it larger, offset, in a circle, something like that) and have it show what the button will do--the pause would be visible when the game is active, hitting it would pause, and the arrow would be shown while paused, hitting it would start the game.
Alternatively, I would have an "outlined" inactive pause and a "filled in" pause instead of an arrow, where the icon would fill in when pressed and paused.

LatwPIAT
Jun 6, 2011

I think for decent clarity with minimum buttons you can actually get it down to five buttons, all with pressed and depressed variants: ⏸️▶️⏩🔊🔇

⏸️▶️⏩ combines all the features of playback. Only one button can be pressed at any one time, denoting which speed playback is happening at: Stopped, Normal, and Fast.
🔊🔇 handles audio. Only one button can be pressed at any one time, denoting whether the audio is muted or not.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
When ships in my game get damaged, I dial up a "smudge" projector to make them look dirty:



This works okay, but it's not great, because I'm projecting a 2D texture onto a 3D object, causing the texture to get stretched wherever the surface it's projecting on is nearly parallel to the projection direction. I angle the projector at 45 degrees, like this, to minimize the effect:



but it's still pretty noticeable sometimes, especially if the ship has sharply inward-sloping side walls.

Is there a better solution available for this? I really don't want to have to modify every material on the ship to have them cross-blend to a smudged version. My ideal would be for the projector to sample from a 3D texture, I think, but I don't understand projector shaders well enough to try to hack one myself.

KillHour
Oct 28, 2007


Would a triplanar shader be an option?

commando in tophat
Sep 5, 2019
The easiest solution I think would be triplanar mapping. I guess you'll have to do it yourself in shader if unity doesn't support it by default, but it is just 3 planar projections with some interpolation between them based on normal.

e. beaten to it

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
I know about triplanar shaders; I use them for the paint jobs on the ship. The question is, how do I do an effect that doesn't require replacing or modifying all of the materials on the ship? The advantage of the projector is that it's a separate thing that draws on top of the regular materials. It's like casting shadows.

Basically I'm trying to avoid having to write a shader that does regular texture mapping, triplanar texture mapping for paint jobs, a separate triplanar texture mapping for battle smudges, a third triplanar texture mapping for VFX related to a specific special ability, as well as regular poo poo like casting and receiving shadows.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
I don't do a lot of shader programming. Do they not compose easily?

KillHour
Oct 28, 2007


leper khan posted:

I don't do a lot of shader programming. Do they not compose easily?

Like most other things in programming, only if you design them to from the ground up.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

leper khan posted:

I don't do a lot of shader programming. Do they not compose easily?

So far as I'm aware, they do not compose at all. The newer node-based shader graph tools make it easier to quickly build up basic shaders out of pre-defined components, but I don't have access to that stuff for this project. And frankly I generally want to edit the code anyway to achieve specific effects that I doubt the nodes account for (and editing auto-generated code is a pain). For example, my "standard" shader caps shadow intensity at 50%, which lets me make sure that stuff is easily visible without having to do a ton of lighting work or fiddling with ambient light settings (which invariably cause problems elsewhere).

KillHour
Oct 28, 2007


TooMuchAbstraction posted:

So far as I'm aware, they do not compose at all. The newer node-based shader graph tools make it easier to quickly build up basic shaders out of pre-defined components, but I don't have access to that stuff for this project. And frankly I generally want to edit the code anyway to achieve specific effects that I doubt the nodes account for (and editing auto-generated code is a pain). For example, my "standard" shader caps shadow intensity at 50%, which lets me make sure that stuff is easily visible without having to do a ton of lighting work or fiddling with ambient light settings (which invariably cause problems elsewhere).

The shader node thing makes it very trivial to insert HLSL wherever you want with custom nodes, but converting all your stuff would be a lot of work.

One option might be to rewrite the triplanar portions of your shaders to accept a texture array and blend them together before doing the triplanar mapping. That way, you can add arbitrary numbers of decal textures for whatever you want to do in the future.

I know, huge pain in the rear end, but I've learned that frequently rewriting small parts of your code as you see limitations is preferable to kludging a workaround and rewriting huge chunks of it when you inevitably paint yourself in a corner.


Edit for anyone curious how the custom function stuff works: https://docs.unity3d.com/Packages/com.unity.shadergraph@14.0/manual/Custom-Function-Node.html

KillHour fucked around with this message at 19:54 on Mar 10, 2022

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
Yeah...I don't think the minor improvement in visuals is worth that much work, unfortunately.

And, just to be clear: I have one material that does triplanar texture mapping, but doesn't do all the other fancy stuff I was talking about. You can have a paint job on your ship and regular Unity shadows, or you can have the default materials for the ship and 50% attenuation shadows. The triplanar shader is doing some sufficiently complicated color-remapping stuff that I really don't want to deal with mixing it with the other one.

KillHour
Oct 28, 2007


Yeah, there's definitely a "gently caress that it's not worth it" point. Maybe you'll be bored and looking for a project at some point :v:

LatwPIAT
Jun 6, 2011

Finished the tutorial I was following, implementing an enemy that chases the player if possible and tries to attack. On a successful attack, it damages the player, and if the player is damaged enough, the level resets. Very cool to have finished a tutorial adding all the components necessary for an actual FPS!

This has me wanting to go out and buy a notepad and a pen so I can just start jotting down ideas and outlines for how I think it can be implemented, and see if I can implement some of the ideas I have.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
Congrats! That feeling of accomplishment is one of the best things about the business, IMO. Have fun!

Adbot
ADBOT LOVES YOU

LatwPIAT
Jun 6, 2011

One of the weapons I've really wanted to see in a game is the AAI Rocket Submachine Gun firing the SCIMITR munition: basically it fires an entire shotgun shell out the front, and after a bit it detonates the shotgun shell, sending tiny razor blades out in a cone. It's the kind of weapon that I imagine would look great in something like FEAR, with the explosion going off in slow motion and sending 20-something shiny knives out and killing things.

Today, I made one. Just a rough implementation, and a projectile spawning other projectiles isn't exactly novel, but it felt so good to see my giant chrome ball bearing explode outwards in a cone of smaller ball bearings in mid-air.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply