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
leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Isometric Bacon posted:

One really nice pattern to look into is a EventBus, which several open source implementations are available.

In a strong event based system, I found it got quite unwieldy with how much code had to directly reference other classes. This meant if I wanted to grab code from one project and paste it into another, it would need a bunch of code as dependencies.

With an eventbus you can abstract events into enum types, or strings.

In unity you can just use scriptable objects to connect the subscriber and notifier sides.

Adbot
ADBOT LOVES YOU

Raenir Salazar
Nov 5, 2010

College Slice
Thanks y'all this is helpful!

Catgirl Al Capone
Dec 15, 2007

for disentangling input handling from other logic it's worth taking a look at the Command pattern too

Alterian
Jan 28, 2003

Hooray! The game I was an art lead on for a little more than a year is launching today! Lets see how many bugs pop up that we will have to patch this week.

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

Alterian posted:

Hooray! The game I was an art lead on for a little more than a year is launching today! Lets see how many bugs pop up that we will have to patch this week.

Congratulations! You're not going to tell us what the game is?

Alterian
Jan 28, 2003

I didn't know if that was allowed! I worked on the Colossal Cave remake. I was the level designer / lighting artist / environment art lead. It was a very surreal experience.

Edit: My background is mostly in mobile. We built the Quest 2 AND PC version at the same time. I am very tired.

RabbitWizard
Oct 21, 2008

Muldoon
Ok, so a thing must exist to do what I want and I guess I just haven't found it yet. I'm using GODOT if that's important. I don't need finished code, I just need the thing that usually gets used to do this. I tried something similar a while ago, but my solution was poo poo. I (think I) need a way to create variables from code.

Example: I have fruits. There's an amount of slices that fruits get cut into. Every fruit has a weight. I calculate the weight per fruit slice.

code:
	apple_slices = 2
	orange_slices = 3
	banana_slices = 5

	apple_weight = 100
	orange_weight = 120
	banana_weight = 150

	#calculate weight per slice
	apple_slice_weight = apple_weight / apple_slices
	orange_slice_weight = orange_weight / orange_slices
	banana_slice_weight = banana_weight / banana_slices

	print ("weight per apple slice: ", apple_slice_weight)
	print ("weight per orange slice: ", orange_slice_weight)
	print ("weight per banana slice: ", banana_slice_weight)
This is working fine. But if I want to add a new fruit or change calculations, this isn't workable long term.

I want something like this:
code:
	fruit_names = ["apple", "orange", "banana"]
	fruit_slices = [2,3,5]
	fruit_weight = [100,120,150]
	fruit_slice_weight = []

	for j in range (fruit_names.size()):
		
		#calculate weight per slice
		$'fruit_names[j]'_slice_weight = $'fruit_names[j]'_weight / $'fruit_names[j]'_slices
		
		#write weight per slice
		fruit_slice_weight[j] = $'fruit_names[j]'_slice_weight
		
		print ("weight per ",$'fruit_names[j]'," slice: ", fruit_slice_weight[j])
How would I do this?

Aaronicon
Oct 2, 2010

A BLOO BLOO ANYONE I DISAGREE WITH IS A "BAD PERSON" WHO DESERVES TO DIE PLEEEASE DONT FALL ALL OVER YOURSELF WHITEWASHING THEM A BLOO BLOO
I'm pretty new into my Godot journey, but that sounds like something perfect for turning into a Resource?

Tunicate
May 15, 2012

You probably want a dictionary, so you can lookup apple and from there get the weight and number of slices associated with it?

Catgirl Al Capone
Dec 15, 2007

you could do a godot-flavored object-oriented approach where you make “fruit” into a node script (basically a class) with export variables like “name”, “slices”, and “weight” and a function that can calculate slice weight

A LOVELY LAD
Feb 8, 2006

Hey man, wanna hear a secret?



College Slice

Catgirl Al Capone posted:

you could do a godot-flavored object-oriented approach where you make “fruit” into a node script (basically a class) with export variables like “name”, “slices”, and “weight” and a function that can calculate slice weight

Not a godot user but this sounded sensible to me in that the fruit class could have its own calculate_weight method which would return something like:

this.weight/this.slices

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

Catgirl Al Capone posted:

you could do a godot-flavored object-oriented approach where you make “fruit” into a node script (basically a class) with export variables like “name”, “slices”, and “weight” and a function that can calculate slice weight

This is what I'd do, honestly. Then in a hypothetical future, you could have a file that contains all of your fruit data, and build out a bunch of instances of the fruit class based on that data.

Raenir Salazar
Nov 5, 2010

College Slice
loving christ the source code version of Unreal is 200gb.

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!

Raenir Salazar posted:

loving christ the source code version of Unreal is 200gb.
The actual source code is probably like 1mb though, the other 199.999gb is gonna be uncompressed assets and poo poo.

Raenir Salazar
Nov 5, 2010

College Slice
Yeah. Still compiling as well (I had to stop/cancel a few times as I had to move where I was, and then overnight my laptop entered hibernation which further interrupted it :argh:).

RabbitWizard
Oct 21, 2008

Muldoon

Aaronicon posted:

I'm pretty new into my Godot journey, but that sounds like something perfect for turning into a Resource?
This is way too far above my skill level. Thinking about it, I'm not sure if I know much more than loops, arrays and functions :shobon:

Tunicate posted:

You probably want a dictionary, so you can lookup apple and from there get the weight and number of slices associated with it?
I should have mentioned I used a dictionary before. It worked for accessing the stuff I wanted with one function, but stitching variables together like this just feels wrong.
Let's calculate the weight per slice for selected fruits....
code:
var peelable_wps = ["orange", "banana"]

var fruitdic = {"apple_slices": 2, "apple_weight": 100, "apple_weight_per_slice" : 0,
"orange_slices": 3, "orange_weight": 120, "orange_weight_per_slice" : 0,
"banana_slices": 5, "banana_weight": 150, "banana_weight_per_slice": 0}

	for j in range (peelable_wps .size()):
		var current_fruit_weight = fruitdic[(peelable_wps [j]+"_weight")]
		var current_fruit_slices = fruitdic[(peelable_wps [j]+"_slices")]
		fruitdic[(peelable_wps [j]+"_weight_per_slice")] = current_fruit_weight / current_fruit_slices

Catgirl Al Capone posted:

you could do a godot-flavored object-oriented approach where you make “fruit” into a node script (basically a class) with export variables like “name”, “slices”, and “weight” and a function that can calculate slice weight

A LOVELY LAD posted:

Not a godot user but this sounded sensible to me in that the fruit class could have its own calculate_weight method which would return something like:

this.weight/this.slices
If I understood correctly, this should allow me to turn the code above into something like this? Going to give it a try over the week :)
code:
include fruit_class
var peelable_wps = ["orange", "banana"]
	for j in range (peelable_wps.size()):
		peelable_wps[j].weight_per_slice = peelable_wps[j].weight / peelable_wps[j].slices

Contentato
Jan 19, 2023

yay [short tooting]

Alterian posted:

I didn't know if that was allowed! I worked on the Colossal Cave remake. I was the level designer / lighting artist / environment art lead. It was a very surreal experience.

Edit: My background is mostly in mobile. We built the Quest 2 AND PC version at the same time. I am very tired.

I just found the Steam page. You worked for Roberta Williams who came out of ten years of retirement to design a 3D adaptation of the old text based game Colossal Cave?

I mean. I'm old so... that's pretty cool!

Alterian
Jan 28, 2003

Yeah! It was really surreal. Playing Kings Quest games and seeing a woman developer as a kid lead me into the field. It's an interesting game. I feel the quest 2 version is the real version. It was a challenge to work on both quest 2 and PC simultaneously with the team size I had. It's definitely meant to be a love letter to the original game.

lord funk
Feb 16, 2004

Raenir Salazar posted:

loving christ the source code version of Unreal is 200gb.

Yep. I have like two lines of the UE source code that I need to change to fix audio latency. Which means 25% of my hard drive is taken up to fix two lines of code.

Raenir Salazar
Nov 5, 2010

College Slice

lord funk posted:

Yep. I have like two lines of the UE source code that I need to change to fix audio latency. Which means 25% of my hard drive is taken up to fix two lines of code.

Yeah that sucks. Luckily it turns out I misinterpreted, turns out I don't need the Engine to have C++ projects, but oh my god 5.1 is still 95gb as just the binary.

At least until it turns out I DO need the Engine to fix some bug.

giogadi
Oct 27, 2009

lord funk posted:

Yep. I have like two lines of the UE source code that I need to change to fix audio latency. Which means 25% of my hard drive is taken up to fix two lines of code.

Just curious, what’s the deal here with audio? I work a fair bit with audio in my own engine and love commiserating over poo poo like this.

BabelFish
Jul 20, 2013

Fallen Rib

roomforthetuna posted:

The actual source code is probably like 1mb though, the other 199.999gb is gonna be uncompressed assets and poo poo.

I got curious and downloaded 5.1 from github:
PS D:\GitHub\UnrealEngine\Engine> "{0:N2} Mb" -f ((gci *.cs, *.h, *.cpp -Recurse | measure Length -s).sum / 1Mb)
943.40 Mb


Nearly a gig of pure text. This is before running the Setup.bat script, but I think that only downloads binaries.

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!

BabelFish posted:

Nearly a gig of pure text. This is before running the Setup.bat script, but I think that only downloads binaries.
Neat. I was being hyperbolic when I said 1Mb, but I genuinely did not expect over 900Mb. I would have more seriously thought maybe 50ish.

Contentato
Jan 19, 2023

yay [short tooting]

Alterian posted:

Yeah! It was really surreal. Playing Kings Quest games and seeing a woman developer as a kid lead me into the field. It's an interesting game. I feel the quest 2 version is the real version. It was a challenge to work on both quest 2 and PC simultaneously with the team size I had. It's definitely meant to be a love letter to the original game.

Well that's just awesome. The reel looks like someone time traveled from the 80s and designed a VR game using modern hardware - and I don't mean that in a bad way. Very cool. Thanks for sharing!

more falafel please
Feb 26, 2005

forums poster

roomforthetuna posted:

Neat. I was being hyperbolic when I said 1Mb, but I genuinely did not expect over 900Mb. I would have more seriously thought maybe 50ish.

That presumably includes stuff like Engine/Source/ThirdParty, which means it's also all the source of asio, libcurl, libpng, libjpeg, zlib, dlmalloc, jemalloc, ICU, Ogg, Python, Python3, OpenSSL, etc, etc, etc. UnrealEngine is more akin to an operating system than most game engines.

Alterian
Jan 28, 2003

Contentato posted:

Well that's just awesome. The reel looks like someone time traveled from the 80s and designed a VR game using modern hardware - and I don't mean that in a bad way. Very cool. Thanks for sharing!

We went for "charming". One really neat aspect of the project is all the artists under me were fresh out of school and this was their first industry job. I love being able to give people an opportunity and since my actual full time job is a professor teaching game development, it was fun to mentor in a more one on one role.

I stand by the Quest 2 being the "ultimate" version of it. Its an interesting VR experience, but the game play might not be for everyone. We kept as true to the original parser game from the 70's as we could. Our design docs was info ripped from the original fortran. With that said, while we tried to keep true to what WAS in it, we did come up with stuff that wasn't in it. Its fine for a parser game to say something is a dead end, but in a 3d game, that's not very interesting.

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

Alterian posted:

We went for "charming". One really neat aspect of the project is all the artists under me were fresh out of school and this was their first industry job. I love being able to give people an opportunity and since my actual full time job is a professor teaching game development, it was fun to mentor in a more one on one role.

I stand by the Quest 2 being the "ultimate" version of it. Its an interesting VR experience, but the game play might not be for everyone. We kept as true to the original parser game from the 70's as we could. Our design docs was info ripped from the original fortran. With that said, while we tried to keep true to what WAS in it, we did come up with stuff that wasn't in it. Its fine for a parser game to say something is a dead end, but in a 3d game, that's not very interesting.

Did you laser scan the actual cave? I know there was a web port somewhere that used images from the cave in each room.

Contentato
Jan 19, 2023

yay [short tooting]

Alterian posted:

We went for "charming". One really neat aspect of the project is all the artists under me were fresh out of school and this was their first industry job. I love being able to give people an opportunity and since my actual full time job is a professor teaching game development, it was fun to mentor in a more one on one role.

I stand by the Quest 2 being the "ultimate" version of it. Its an interesting VR experience, but the game play might not be for everyone. We kept as true to the original parser game from the 70's as we could. Our design docs was info ripped from the original fortran. With that said, while we tried to keep true to what WAS in it, we did come up with stuff that wasn't in it. Its fine for a parser game to say something is a dead end, but in a 3d game, that's not very interesting.

That sounds just fun to build - or at least to me, taking an ancient design spec and converting it into a modern structure. Giving me nostalgia for games that just kicked you out with a GAME OVER

I've never ran into a game dev prof in the wild, do you get bored of looking at amateur indie work all the time or do you take requests for reviews and feedback? (I published my first game last year, shared it in the making games thread here)

lord funk
Feb 16, 2004

giogadi posted:

Just curious, what’s the deal here with audio? I work a fair bit with audio in my own engine and love commiserating over poo poo like this.

Audio latency is *awful* in UE. From key press to sound, it's about 150-180ms depending on the frame rate and buffer settings. For comparison (if you're unfamiliar), a synth can get sound out of my Mac about 5ms after a key press.

Since I'm working on a rhythm game, this is insane. Even if I put the buffer size down to a reasonable 256 samples, it is still a 130ms delay. So I looked into it. Turns out, the audio engine completely ignores the setting you use in the Project Settings, instead defering to a macro constant that is set to 8192 samples. By changing that macro (and fixing a few lines where it ignores the user settings), I can lop off about 50ms of latency.

The latency is still garbage, and I truly do not understand why. This is coming from a guy who's entire life has been working with DSP / synth / audio engines, and I've poured over the complete mess of code that UE uses for audio. It is absolutely insane.

lord funk
Feb 16, 2004

If you want a few more specifics, I posted about it on the UE forums: https://forums.unrealengine.com/t/input-latency-lag-where-is-it-coming-from-how-to-reduce-it/531089/7

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
Good god, that's insanely unacceptable!

Jewel
May 2, 2009

Speaking of UE, does anyone know of a way to tie a component to some other components when you create it? Like, my goal is to have an Interactable component which has two collision components that you can manually move around, resize, etc; which dictate the range of showing an indicator and the range of actually being interactible. Is there any easy way to forcefully create and tie new components alongside it when added or do I have to expect users to manually add in the Interactable component and then two collision components and hook them up with the construction script or something

giogadi
Oct 27, 2009

lord funk posted:

Audio latency is *awful* in UE. From key press to sound, it's about 150-180ms depending on the frame rate and buffer settings. For comparison (if you're unfamiliar), a synth can get sound out of my Mac about 5ms after a key press.

Since I'm working on a rhythm game, this is insane. Even if I put the buffer size down to a reasonable 256 samples, it is still a 130ms delay. So I looked into it. Turns out, the audio engine completely ignores the setting you use in the Project Settings, instead defering to a macro constant that is set to 8192 samples. By changing that macro (and fixing a few lines where it ignores the user settings), I can lop off about 50ms of latency.

The latency is still garbage, and I truly do not understand why. This is coming from a guy who's entire life has been working with DSP / synth / audio engines, and I've poured over the complete mess of code that UE uses for audio. It is absolutely insane.

Yikes!!!! Yeah I’ve done a lot of fiddling with audio buffer sizes (in my own audio engine) to make things feel good in my music game. I work on a Mac usually, so when I tried my game out in windows for the first time; I had absolutely batshit latency. I was thinking that I would have to add asio driver support or something.

But nope, turned out that for some reason my audio api was defaulting to using some weird deprecated output device - but when I manually checked to only open WASAPI devices, suddenly the latency went away almost entirely! I was pleasantly surprised. Used to be in windows that you needed asio to do anything low-latency.

Alterian
Jan 28, 2003

leper khan posted:

Did you laser scan the actual cave? I know there was a web port somewhere that used images from the cave in each room.

No. I did A LOT of research into the original cave. There are similarities and I did VERY loosely base a little of the first part of the cave on the layout of the original. The original cave doesn have Dragons and Dwarves so we were able to take a lot of artistic freedom with some of the visuals. The funny thing is that photogrammetry is one of my better skills, but we didn't use it on this project.

Contentato posted:

That sounds just fun to build - or at least to me, taking an ancient design spec and converting it into a modern structure. Giving me nostalgia for games that just kicked you out with a GAME OVER

I've never ran into a game dev prof in the wild, do you get bored of looking at amateur indie work all the time or do you take requests for reviews and feedback? (I published my first game last year, shared it in the making games thread here)

One of the things I'm worried about is people playing it and not understanding that old games killed the gently caress out of you whenever it could and you needed to save often and iteratively! I had my 10 year old testing the Quest 2 and Switch versions and he was getting very frustrated until he started doing that.

I'm not sure if I am the greatest person for feedback haha. I have my special talents mostly in environment art and level design. Playing student work can get old, I admit it. I think our program is great. I teach at a community college so its super affordable and the only barrier for entry is graduating highscool / GED. We get a lot of people who might not have been accepted to a larger, more expensive college.

lord funk
Feb 16, 2004

giogadi posted:

Yikes!!!! Yeah I’ve done a lot of fiddling with audio buffer sizes (in my own audio engine) to make things feel good in my music game. I work on a Mac usually, so when I tried my game out in windows for the first time; I had absolutely batshit latency. I was thinking that I would have to add asio driver support or something.

But nope, turned out that for some reason my audio api was defaulting to using some weird deprecated output device - but when I manually checked to only open WASAPI devices, suddenly the latency went away almost entirely! I was pleasantly surprised. Used to be in windows that you needed asio to do anything low-latency.

I really need to learn more about this, because I'm new to the Windows platform. Because yeah -- even basic synth apps absolutely poo poo the bed when dropped down to low latency.

To be fair, I did load up my Unreal project on a Mac and it also had the same atrocious latency, so it's not entirely because of Windows.

more falafel please
Feb 26, 2005

forums poster

Nearly every Unreal game uses Wwise (and before Wwise became the standard, FMOD) so I'm sure it's just not a priority for Epic. Anything that doesn't ship in one of their games isn't going to be implemented in shippable quality, unfortunately.

Raenir Salazar
Nov 5, 2010

College Slice
Anyone have an idea what's happening here, my parameters for my C++ instance class aren't saving:



Whenever I reload my project these parameters become empty/none.

e to add, even worse, I can confirm that when loading the UE5 project using the .uproject file, it doesn't even load my code changes from my last session. I have to manually recompile and then seemingly redo all of my parameter changes!?

e2: Loading the editor from VS2019 seemed to keep my changes, I then tried clearing the Binaries & Intermediate folder which also seemed to work to keep my changes and force it to recompile; there's also a setting I turned on to "Force Recompilation at startup" and after saving and reloading it seemed to have kept all of my parameters, so I guess problem resolved? Really dumb though that this even happened.

Raenir Salazar fucked around with this message at 17:22 on Jan 26, 2023

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:
If you make changes to C++ code while the editor is open, weird things can happen. Especially changes to header files. Sometimes it fails to replace dlls when you rebuild and then you're stuck until you close the editor, recompile in visual studio and then restart the editor. In theory, changes to cpp files are safe, but basically don't use the hot reload stuff. I think in UE5 it's even disabled by default.

That would be my best guess at what's happening.

more falafel please
Feb 26, 2005

forums poster

ZombieApostate posted:

If you make changes to C++ code while the editor is open, weird things can happen. Especially changes to header files. Sometimes it fails to replace dlls when you rebuild and then you're stuck until you close the editor, recompile in visual studio and then restart the editor. In theory, changes to cpp files are safe, but basically don't use the hot reload stuff. I think in UE5 it's even disabled by default.

That would be my best guess at what's happening.

I had one project where I was doing a lot of gameplay code, so iterating running in PIE a lot. Hot Reload magically worked, the only time it's ever worked for anyone, apparently, and it was a godsend. I used it all the time -- as long as you're not changing layout of classes/etc, it was amazing.

Adbot
ADBOT LOVES YOU

Raenir Salazar
Nov 5, 2010

College Slice
As an aside, I'm using sourcetree and randomly some uassets have different hashes and appear in the list of modified/unstaged files. Assets I've not touched or used, a random audio file and a random architecture asset, I haven't used them, touched them but they appear modified and I think it's always the same two files, any ideas what gives?

ZombieApostate posted:

If you make changes to C++ code while the editor is open, weird things can happen. Especially changes to header files. Sometimes it fails to replace dlls when you rebuild and then you're stuck until you close the editor, recompile in visual studio and then restart the editor. In theory, changes to cpp files are safe, but basically don't use the hot reload stuff. I think in UE5 it's even disabled by default.

That would be my best guess at what's happening.

What is hot reload? My workflow is:

1. Open UProject via the shortcut/file.
2. Separately open VS.
3. Make some change in VS.
4. Tab back to Unreal and click the Compile button (Bottom right).

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