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
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!

Rocko Bonaparte posted:

Thankfully, they got a new guy with a lot of good experience with subscription pricing!
This is a delightful circular joke too because when Red Hat hosed up with subscription pricing it drove everyone to use Ubuntu, and Ubuntu means Unity!

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
drat. The similarities are unreal.

Hughlander
May 11, 2005

Rocko Bonaparte posted:

drat. The similarities are unreal.

I see what you did there, it was epic.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Well I'll crawl back from pun time to ask some more UE5 questions:

1. Is there some way to dissociate actual input controls from the actions you want to do with them? Right now, I'm just getting events on this-or-that specific key, but I figure there's a way to decouple that from the thing I'm trying to do. Like, instead of having an event specifically trigger on space bar to make the player jump, I should be able to define jump as a thing and then map it to whatever-what-the-heck. I don't remember what Unity had stock to do this because I was just using InControl, and that had this under a concept of "Actions."

2. Does UE5 have some logic already to handle stacking of menus? I had to create a stack of controller contexts to do this in Unity. Say, normally the stack is just one element and it's the main game that's going on. Then the player triggers a menu, which transfers control inputs to that UI. They then do something that prompts a dialog, which transfers control to that UI. They make their choice, which "pops" that UI's control back to the menu. They close the menu, which pops it back to the main game.

jizzy sillage
Aug 13, 2006

Rocko Bonaparte posted:

Well I'll crawl back from pun time to ask some more UE5 questions:

1. Is there some way to dissociate actual input controls from the actions you want to do with them?

This is the Enhanced Input System, it's exceptionally good.

https://docs.unrealengine.com/5.3/en-US/enhanced-input-in-unreal-engine/

jizzy sillage fucked around with this message at 10:02 on Oct 16, 2023

Raenir Salazar
Nov 5, 2010

College Slice
Yup basically any actor blueprint can listen to the "jump" key being Pressed. Maybe you want another mediator to act as the go between though, like for touch controls they're not normalized and it's stupid. So this depends on how you want to handle any filtering on a per actor basis or via a manager.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
If my target is PC and (at-best/worst) console, would I worry about touch control for joystick and button-press-like inputs? I'm assuming that's only a phone thing unless I wanted to, hmmm, do something on a Switch?

more falafel please
Feb 26, 2005

forums poster

Rocko Bonaparte posted:

If my target is PC and (at-best/worst) console, would I worry about touch control for joystick and button-press-like inputs? I'm assuming that's only a phone thing unless I wanted to, hmmm, do something on a Switch?

Worry about that later. There can be touch controls on PC (and console, the PS4's touchpad for instance), but you shouldn't need to worry about it for now.

Chillmatic
Jul 25, 2003

always seeking to survive and flourish

Rocko Bonaparte posted:

2. Does UE5 have some logic already to handle stacking of menus? I had to create a stack of controller contexts to do this in Unity. Say, normally the stack is just one element and it's the main game that's going on. Then the player triggers a menu, which transfers control inputs to that UI. They then do something that prompts a dialog, which transfers control to that UI. They make their choice, which "pops" that UI's control back to the menu. They close the menu, which pops it back to the main game.

It's hard to understand what you're actually asking.

Stacking of menus in UI--as in, displaying multiple UI elements at a time and deciding which one gets input priority--is done by adjusting the z-order in the widget class itself.

If you're asking how the engine handles consuming input for UI vs. game purposes, there are built-in functions that you can call on the widget class itself that handle this.

Only registered members can see post attachments!

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Chillmatic posted:

It's hard to understand what you're actually asking.

Stacking of menus in UI--as in, displaying multiple UI elements at a time and deciding which one gets input priority--is done by adjusting the z-order in the widget class itself.

If you're asking how the engine handles consuming input for UI vs. game purposes, there are built-in functions that you can call on the widget class itself that handle this.



It's more like making sure any previous game or UI stuff gets no inputs at all until the current active one is satisfied and closed. Consider something like a game going on where the direction buttons would move the character, then the main menu on top of that, then the save menu on top of that, and then a dialog prompt about deleting a save. You don't want any buttons going to the character, nor do you want anything to even go to the save menu. It's all on the confirmation dialog.

When that confirmation closes, it cedes control back to the save menu, and when that closes, it cedes control back to the main menu, and when that closes, it cedes control back to the main game.

If you happy to just know linearly all the paths these GUIs can take, you can manage it globally, but having a "control stack" is a lot more graceful generally and specifically necessary if you have common dialogs that can come up from different parent contexts.

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 implemented a whole input abstraction layer for Waves of Steel to handle this problem. Different components, when activated, would say "Hey input director, push me onto the stack as a [non-]blocking input listener". Then in their update/tick calls, they would say "Hey input director, is this button pressed?" and the director would check if they were allowed to receive input before responding with anything other than "no". Very useful, graceful, and hard to make bugs with, but it requires a different philosophy for input handling than the usual event-based approach.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I was able to do events just fine, it's just that everything had to listen to the controller subsystem's version of the events, and each would get those events when they deserved them.

jizzy sillage
Aug 13, 2006

Rocko Bonaparte posted:

It's more like making sure any previous game or UI stuff gets no inputs at all until the current active one is satisfied and closed.

This should just be Add Widget, Set Widget to Focused, Widget now consumes input until it's closed or another Widget is Focused.

Game gets input until a Menu is opened and the menu widget is focused.

Main menu widget is focused until the player opens a save dialogue, and the dialogue is then focused.

Dialogue finished, focus returns to main menu.

Main menu closed, focus lost and input now routes to game.

Chillmatic
Jul 25, 2003

always seeking to survive and flourish

Rocko Bonaparte posted:

It's more like making sure any previous game or UI stuff gets no inputs at all until the current active one is satisfied and closed. Consider something like a game going on where the direction buttons would move the character, then the main menu on top of that, then the save menu on top of that, and then a dialog prompt about deleting a save. You don't want any buttons going to the character, nor do you want anything to even go to the save menu. It's all on the confirmation dialog.

When that confirmation closes, it cedes control back to the save menu, and when that closes, it cedes control back to the main menu, and when that closes, it cedes control back to the main game.

If you happy to just know linearly all the paths these GUIs can take, you can manage it globally, but having a "control stack" is a lot more graceful generally and specifically necessary if you have common dialogs that can come up from different parent contexts.

Yes, I explained all of this in my response to you.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm going to just take it that ordering is a little different in Unreal and implementing some kind of stacking like that isn't necessary. Well, more like I'm going to do a little bit of random UI crap and see if I get painted into a corner when going widget-to-widget.

sailormoon
Jun 28, 2014

fighting evil by moonlight
winning love by daylight


Looking to create a simple turn based 3D game, but all of my expertise is in C++. Should I roll with Unreal, Godot, or a hidden third alternative? I'd also consider other type-safe languages but would like to avoid GDScript or anything similar if possible.

Alterian
Jan 28, 2003

If you don't have any game development experience, despite all the drama, I would recommend Unity for that. If you know C++, C# is much more fun.

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
Do some shopping around to try out different engines and see what works for you. Godot, Unity, and Unreal can all do what you want.

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!

Alterian posted:

If you don't have any game development experience, despite all the drama, I would recommend Unity for that. If you know C++, C# is much more fun.
Counterpoint, I do a lot of C++, and I hate C#, it's like Java. I'm not a big fan of Python, but I prefer Godot's Python-like language over Unity's C#.

I think possibly a big part of why I feel that way might boil down to: if you're "functional", Godot, if you're "object oriented", Unity.

(C++ is only as object-oriented as you make it, and once you're outside of the university environment, in my experience, that's not very.)

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

roomforthetuna posted:

Counterpoint, I do a lot of C++, and I hate C#, it's like Java. I'm not a big fan of Python, but I prefer Godot's Python-like language over Unity's C#.

I think possibly a big part of why I feel that way might boil down to: if you're "functional", Godot, if you're "object oriented", Unity.

(C++ is only as object-oriented as you make it, and once you're outside of the university environment, in my experience, that's not very.)

I've seen towers to God in c++ and c#

Both are bad, but the c# ones just undulated ineffectually in circles. The c++ ones unfurl the canvas of reality to enable forgotten nightmares to inhabit the machine and whisper gently from the compiler, "what the gently caress is this poo poo"

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 like C#. It's expressive without losing type safety. It lets you quickly and elegantly (i.e. without loss of clarity) express moderately complicated concepts. The "everything must be an object" stuff is a *little* silly, but ultimately it's just an extra layer of namespaces, and that's far from a bad thing.

I've been having to re-learn my C++ lately, and man, it's super obvious that it's a 50-year-old language in a toupee, trying to hang out with its 30-year-old, much cooler relations.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

TooMuchAbstraction posted:

I like C#. It's expressive without losing type safety. It lets you quickly and elegantly (i.e. without loss of clarity) express moderately complicated concepts. The "everything must be an object" stuff is a *little* silly, but ultimately it's just an extra layer of namespaces, and that's far from a bad thing.

I've been having to re-learn my C++ lately, and man, it's super obvious that it's a 50-year-old language in a toupee, trying to hang out with its 30-year-old, much cooler relations.

I like C more than C++ but few people agree with me

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!

TooMuchAbstraction posted:

I like C#. It's expressive without losing type safety. It lets you quickly and elegantly (i.e. without loss of clarity) express moderately complicated concepts.
The thing that very quickly turned me off C# was having to implement my own red-black tree because the library ordered-map implementation doesn't have a method for "find the item *nearest* a value", and the commonly suggested way to do that is to transform it into a different kind of list which would make the whole thing hilariously inefficient.

Not that this would necessarily be better in Godot-script, but I wouldn't feel let down there because I wouldn't *expect* a mature language with interfaces that actually work.

giogadi
Oct 27, 2009

leper khan posted:

I like C more than C++ but few people agree with me

This is actually a very hip opinion right now

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

giogadi posted:

This is actually a very hip opinion right now

Where are these people and how do I work with them

xzzy
Mar 5, 2009

mallocs and garbage collection is the computers job, not mine.

Bongo Bill
Jan 17, 2012

Game development is one of the domains in which manual memory management is very desirable, because most garbage collectors pause execution of the program when collecting garbage, which can impact the perceived smoothness of the program, which is tolerable in some applications but much less so in a game. There are techniques you can use to mitigate it, but my own preference is to just categorically exclude GC pauses by not having a GC.

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
My preference is to get memory allocations down to the point that an incremental GC can handle them between frames without creating lag. That's kind of like manual memory management, except that you don't have to worry about it 90% of the time because most code isn't doing enough allocations to matter.

more falafel please
Feb 26, 2005

forums poster

TooMuchAbstraction posted:

My preference is to get memory allocations down to the point that an incremental GC can handle them between frames without creating lag. That's kind of like manual memory management, except that you don't have to worry about it 90% of the time because most code isn't doing enough allocations to matter.

I've worked on porting two different Unity games to console. On both of them, we had a senior engineer dedicated, for the entire 2 year project, to reducing mid-frame allocations (mostly strings). It's so, so, so much harder than manual memory management, because the environment is actively fighting you.

In UE3, we had the same problem. Eventually the engine tried to moved to reference counting for resources, but you had years of legacy code creating UObjects willy-nilly because it "you don't have to worry about it", and every UE3 project I worked on had a massive effort to remove allocations so that GC wouldn't run except on level load.

Using a GC language or environment for AAA games on anything but PC is a nonstarter.

Charles Ford
Nov 27, 2004

The Earth is a farm. We are someone else’s Ford Focus.

leper khan posted:

Where are these people and how do I work with them

Just get a job working on embedded software, they're all mental for C, sometimes even for reasons that are objectively wrong. I've seen all sorts of bonkers coding standards justify bad ideas for "safety" (of the literal "someone might be injured" sense). Some are more sane than others, of course, so it's not all bad.

e: I will admit that embedded-style game development is probably out the window since the 3DS was discontinued, though for small scale the PlayDate still assumes you want C if you don't want to use Lua (though personally I immediately did the stuff you need to do to just make C++ work, which was very standard for "making C++ work in embedded", though I think there's some people actually using RTTI and exceptions on the PlayDate which is extremely unusual for embedded C++).

Charles Ford fucked around with this message at 20:16 on Oct 19, 2023

Hughlander
May 11, 2005

more falafel please posted:

I've worked on porting two different Unity games to console. On both of them, we had a senior engineer dedicated, for the entire 2 year project, to reducing mid-frame allocations (mostly strings). It's so, so, so much harder than manual memory management, because the environment is actively fighting you.

In UE3, we had the same problem. Eventually the engine tried to moved to reference counting for resources, but you had years of legacy code creating UObjects willy-nilly because it "you don't have to worry about it", and every UE3 project I worked on had a massive effort to remove allocations so that GC wouldn't run except on level load.

Using a GC language or environment for AAA games on anything but PC is a nonstarter.

This reminded me of Profiling the new animation system for a huge game and finding that 60% of the CPU time was spent in std::string c'tor because the animation system call stack was about 60 deep of:
FunctionA(std::string str1, std::string str2)
{
auto thing = FunctionB(str1, str2);
...
}

So much efficiency just by doing a search and replace of std::string to const std::string&

Lucid Dream
Feb 4, 2003

That boy ain't right.

TooMuchAbstraction posted:

My preference is to get memory allocations down to the point that an incremental GC can handle them between frames without creating lag. That's kind of like manual memory management, except that you don't have to worry about it 90% of the time because most code isn't doing enough allocations to matter.

Yeah this is how I feel too. With C# I can manage the memory as much as I need to, but if something slips through the cracks it's swept under the rug by the GC with minimal impact on performance. It feels like the right balance for me.

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

more falafel please posted:

I've worked on porting two different Unity games to console. On both of them, we had a senior engineer dedicated, for the entire 2 year project, to reducing mid-frame allocations (mostly strings). It's so, so, so much harder than manual memory management, because the environment is actively fighting you.

In UE3, we had the same problem. Eventually the engine tried to moved to reference counting for resources, but you had years of legacy code creating UObjects willy-nilly because it "you don't have to worry about it", and every UE3 project I worked on had a massive effort to remove allocations so that GC wouldn't run except on level load.

Using a GC language or environment for AAA games on anything but PC is a nonstarter.

Obviously I can't contest your lived experience, but by the same token, it doesn't match my lived experience, so either one of us is wrong or there's not a simple "GC is good/GC is bad" declaration to be made here (hint, it's the latter).

Like, my game is obviously substantially simpler than a AAA game, e.g. no need to stream assets in because it's not open-world. But it is also very, very far from a simple game. And yet I was able to get allocations down to 1-2kB/frame, even during hectic combat, with, I would guess, about two weeks worth of dev effort: running the memory profiler, identifying hotspots, and fixing specifically those bits. The vast majority of my game did not need to care about how exactly memory was being used.

Now in fairness, Unity added the incremental GC shortly after I started development, which may well postdate your own Unity experience. And maybe the games you were porting were more complicated, or at least, harder to optimize, than mine was. Not to toot my own horn, but I'm good at software development, and I was the only person contributing code to the project. That does simplify things a lot.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Resource cleanup in destructors alone is a enough reason to be using C++ over C. Ask someone to write code where there are error conditions and multiple resources that need to be released on error and there is a 99% chance they will gently caress it up.

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!

OneEightHundred posted:

Resource cleanup in destructors alone is a enough reason to be using C++ over C. Ask someone to write code where there are error conditions and multiple resources that need to be released on error and there is a 99% chance they will gently caress it up.
And it's also reason to be using C++ over a garbage collected language!

Raenir Salazar
Nov 5, 2010

College Slice
I'm trying to create a plugin in Unreal to include a third party library but I'm getting unresolved external symbol errors, the library works when compiled basically on its own in an example c++ project provided with it from github, but there's no .lib or dll files, its just .hpp and .cpp files.

Do I need to compile a dll in order to include it? Or is there some extra secret sauce I need? I already specified in the Build.cs the include folder, which gives no syntax errors, the error is just on the linking and this as C++ code compiles fine on its own, Unreal just doesn't like it or I am not providing Unreal enough info yet?

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

roomforthetuna posted:

The thing that very quickly turned me off C# was having to implement my own red-black tree because the library ordered-map implementation doesn't have a method for "find the item *nearest* a value", and the commonly suggested way to do that is to transform it into a different kind of list which would make the whole thing hilariously inefficient.

Not that this would necessarily be better in Godot-script, but I wouldn't feel let down there because I wouldn't *expect* a mature language with interfaces that actually work.

IMO one of the big upsides of C# over godot script is you really only did this because you wanted, as there are a jillion good red black tree inplementations for C# and maybe there is a particular implementation for a dsl but probably not.

https://www.nuget.org/packages/System.Collections.Generic.RedBlack etc

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!

Unormal posted:

IMO one of the big upsides of C# over godot script is you really only did this because you wanted, as there are a jillion good red black tree inplementations for C# and maybe there is a particular implementation for a dsl but probably not.

https://www.nuget.org/packages/System.Collections.Generic.RedBlack etc
That one, like the generic ones, doesn't have the "find the entry adjacent to a key that isn't set" behavior that I already mentioned I was looking for. C++ std::map has upper_bound and lower_bound for this. I'm sure there's some C# implementation somewhere that does have it, but finding it, and verifying that it's actually a good implementation not a poo poo one that gives incorrect results or has an O(n) or worse implementation for that behavior (which, again, *is the recommended method* I found repeatedly for C#) would take longer than writing one.

mmkay
Oct 21, 2010

Raenir Salazar posted:

I'm trying to create a plugin in Unreal to include a third party library but I'm getting unresolved external symbol errors, the library works when compiled basically on its own in an example c++ project provided with it from github, but there's no .lib or dll files, its just .hpp and .cpp files.

Do I need to compile a dll in order to include it? Or is there some extra secret sauce I need? I already specified in the Build.cs the include folder, which gives no syntax errors, the error is just on the linking and this as C++ code compiles fine on its own, Unreal just doesn't like it or I am not providing Unreal enough info yet?

So when you build the library on its own, what binary file does it compile into? The linker errors tell you that the compiler knows how the function calls look like (since you provided the header files), but it doesn't know where the built objects are (part of a dll/static library/other .o files) - you need to provide that.

Adbot
ADBOT LOVES YOU

Raenir Salazar
Nov 5, 2010

College Slice

mmkay posted:

So when you build the library on its own, what binary file does it compile into? The linker errors tell you that the compiler knows how the function calls look like (since you provided the header files), but it doesn't know where the built objects are (part of a dll/static library/other .o files) - you need to provide that.

So how do we build the library on its own, I can build the example project which has a Example.cpp with a Main function, I assume we don't want that, so how do I build without it so I can provide just the dll/lib?

I've tried googling "converting stand alone library to a dll/lib" but what I mostly found seemed like an agonizing amount of work and I think mainly for use for other languages?

Do I just remove the main file, switch the project configuration to dll, and just hit the build button would that work in theory?

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