• Ever wanted an RSS feed of all your favorite gaming news sites? Go check out our new Gaming Headlines feed! Read more about it here.
Status
Not open for further replies.

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Is anyone in here well-versed in Unity's Profiler tool? I'm trying to learn it and am currently running it through my main menu for starters. On the rendering tab, it says I have 52 draw calls, 2000 tris and 3500 verts. I also have 9 batched draw calls and for some reason, it logs additional tris (726) and verts (1.5k) on another line. I don't understand these numbers, unless the 2D UI and/or particles are somehow also calculated with tris and verts. As some of you may know, our game is based on cubes, supposedly very efficient cubes no less. My main menu have 6 cubes, a plane for the floor, a slightly more detailed sword and a sheep. The cubes are 4 verts each, so 24, and the tri count should be 72. What makes Unity believe my try count is 10x to more than 20x that number? Sure, the sword and sheep are more detailed but they should be below 100 verts combined, rough estimate.

I just did an experiment on my 100% 2D, sprite-based game, and my results are as follows:
1) The profiler reports 1000 tris (1.0K) right off the bat.
2) Disabling stuff in my scene affects nothing... until I either disable the camera, or disable the last element that renders on the screen. When I do this, tris jump to 0.
3) There is no middle ground. Disabling everything except the camera and a single scene element still gives 1.0K. There's no way to get any other number.

Bottom line: I would disregard the profiler for triangles / geometry. Personally I only use it for figuring out bottlenecks and things that take a lot of time / generate a lot of garbage / drop the framerate.
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
Are you accounting for lighting?
I have not, you think that could explain it?
I just did an experiment on my 100% 2D, sprite-based game, and my results are as follows:
1) The profiler reports 1000 tris (1.0K) right off the bat.
2) Disabling stuff in my scene affects nothing... until I either disable the camera, or disable the last element that renders on the screen. When I do this, tris jump to 0.
3) There is no middle ground. Disabling everything except the camera and a single scene element still gives 1.0K. There's no way to get any other number.

Bottom line: I would disregard the profiler for triangles / geometry. Personally I only use it for figuring out bottlenecks and things that take a lot of time / generate a lot of garbage / drop the framerate.
I see, thanks for the experimentation :D I kinda need my camera, so I guess I'll have to deal with it haha. The numbers do seem a bit wack, I tried one of my more problematic levels and that level has around 35k+ verts according to the profiler which can't be true either. I wonder how reliable this tool really is. I noticed that a Photoshop noise filter is taking about 16MB of memory and a play button png is 2MB. But the actual file sizes in the explorer says 2119kB for the noise, and 15kB for the play button. Later, I noticed that the same play button was still in memory when I had loaded a level, but then it was registered as 1MB all of a sudden. I'm not sure if reporting this as an issue to my programmers is actually correct anymore.

My reason for checking this is the same old story of my fps dropping from an easy 60 to around 30 depending on where I look, but only sometimes, even though nothing has really changed in the frustum. I use fraps for the fps counter, but I've read that it, like the profiler itself, is a bit of a performance hog. I found out that it's possible to run the profiler through the editor but linked to a built version of the game, to get rid of the profiler's overhead, but it's not easy to look at a specific frame since the game keeps on running. I haven't seen anything too bad that could explain a 30 fps drop. I suspect it's a combination of an old (?) laptop and too many alpha particles, but I can't explain why looking in one direction, away from the particles give me 60 fps, but depending on mouse movement speed, seemingly, if I turn around and look at the particles, the framerate will or will not drop drastically. I could semi-replicate this multiple times just now, as if shocking the pc with fast movements was too much to draw the frames xD
 

Landford

Attempted to circumvent ban with alt account
Banned
Oct 25, 2017
4,678
Again, thanks for the tips, guys. I am learning a lot these past weeks, focusing on exactly what each function do and wrapping my head around grids and data structures. My plan is to have just a inventory and crop system, and a very simple battle system, real time or turn based, what will eventually be easier.

Something is on my mind lately, though. I am following youtube tutorials in game maker, so lots of things I end up copying from the teachers code, while i pause to analyze it and try to see exactly what line is doing what. My fear is that I end up not absorving it in a more permanent way. I am not really at the point of trying to come up with code on my own, although im reading a lot of the documentation to try to expand the tools I have.

I also seem to be the most beginner level coder here, So Ill try to refrain to ask these basic questions so often hahahah
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
Yes, lighting affects it. Lighting and shadows add extra drawcalls. You can read this post:

https://forum.unity.com/threads/doubling-the-triangles-of-models.139785/#post-953164
True, I've seen similar posts before. I'm in deferred though so it's not super accurate for my situation, but still. A quick google search suggests that in 2010, 400 draw calls in a pc game is really low, and 50-300~ that we have isn't so bad then. Makes the frame drops even more peculiar though :) Even more so, because I just checked via occlusion culling, and particles, just like light sources, aren't culled when outside either frustums. My hundreds of rain drops, fog, and rain clouds are drawn no matter where I look, probably because each particle system is ONE system, and not several smaller ones. I'm quickly gonna try to make 5 rain systems instead of one and see if those are culled. (fake edit) Huh, seems they are! That could very well explain a lot, especially since I have collision detection on all individual rain drops lol; how else to get them to not clip through the characters? ;)
 

DNAbro

Member
Oct 25, 2017
25,875
Again, thanks for the tips, guys. I am learning a lot these past weeks, focusing on exactly what each function do and wrapping my head around grids and data structures. My plan is to have just a inventory and crop system, and a very simple battle system, real time or turn based, what will eventually be easier.

Something is on my mind lately, though. I am following youtube tutorials in game maker, so lots of things I end up copying from the teachers code, while i pause to analyze it and try to see exactly what line is doing what. My fear is that I end up not absorving it in a more permanent way. I am not really at the point of trying to come up with code on my own, although im reading a lot of the documentation to try to expand the tools I have.

I also seem to be the most beginner level coder here, So Ill try to refrain to ask these basic questions so often hahahah

I don't think you should ever feel bad for asking those questions. What you are currently doing (trying to analyze the code) is good and should be helpful. If you were just copying code and not even looking that would be completely unhelpful lol. Figuring out how to code something yourself will probably help you retain more and build your problem solving skills but I get how that is a bit intimidating. Some things that may seem complex usually aren't nearly as bad when broken down into parts.
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
Just for curiosity and fun, how much time do you think that a experimented dev would need to make something like this (the gameplay core)? And a total beginner?

https://www.youtube.com/watch?v=4XINfYYlsuE

And, in your opinion, Unity or Game Maker? Which would be better for this kind of project?
Do you mean the complete package with graphics etc? Or maybe just the 2d football core game? The stats and everything looks the most challenging to me. But I'm neither experienced nor a beginner :)
 

Dusk Golem

Local Horror Enthusiast
Member
Oct 25, 2017
5,804
Thank you to those previously for the kind words on my little project.

Right now working hard to get it out by April 30th, thought I'd share a little soundtrack sample thing I uploaded with you guys:

 

Emergency & I

Banned
Oct 27, 2017
6,634
Learned some stuff in GML tonight.


My leveling system actually works. Well I think it does. Two hours of great results has me splendid.
 

OllyOllyBennett

BizDev & PR at Cardboard Sword
Verified
Nov 10, 2017
40
North East, UK
I remember spotting this for a post I put under my steam filtering project.https://twitter.com/NotableReleases/status/978688173319557120
Nice idea. Followed.

I just wanted to mention that I'm getting very excited for your game.
Thanks very much! We'll have a new newsletter coming out soon, with some exclusive screenshots, if you wanted to sign up or anything...

So today was my first time drawing pixel art ever and same with drawing sprite animations.. here's what I got!


Really great start. Some shading would improve it I reckon, but then the more detailed you get, the greater the risk of drifting ( ;) ) too far from the intended style. Still, I think there's a middle ground that can be met and would improve this.

I'm writing a pitch for the Nintendo Switch. Any tips on what might go into one of those? I'm leaning towards formal, but I don't know how extensive I need to be with details. I'm told to not write a design document.
What scenario are you pitching in? (Face-to-face presentation, sending in a deck, Skype meeting, phone call, etc.) Regardless, I would suggest that you make it quick and exciting, highlight a Switch-specific feature for huge bonus points, and be sure to show pretty pictures.

It's a social simulator based in Japan, you can learn some basic japanese, meet people, visit famous places of Japan and even play at the arcades!

9l5vG9u.jpg
Looks swell! I'm looking forward to seeing those gifs.
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
I see, thanks for the experimentation :D I kinda need my camera, so I guess I'll have to deal with it haha. The numbers do seem a bit wack, I tried one of my more problematic levels and that level has around 35k+ verts according to the profiler which can't be true either. I wonder how reliable this tool really is. I noticed that a Photoshop noise filter is taking about 16MB of memory and a play button png is 2MB. But the actual file sizes in the explorer says 2119kB for the noise, and 15kB for the play button.

Rememeber that the files are compressed in the file system, while they are uncompressed in memory. Unity has a per-file compress option but I don't know if it affects how the file is stored in memory (I have a feeling it doesn't) or just how much it takes when it builds the game / executable. I turn it off as it destroys pixel art, but if your sprites are not pixel art it may help giving it a try.

Later, I noticed that the same play button was still in memory when I had loaded a level, but then it was registered as 1MB all of a sudden. I'm not sure if reporting this as an issue to my programmers is actually correct anymore.

I frankly wouldn't worry about memory if your issue is FPS. Focus on the profiler and what it says is taking most time (drill down to the calls).

My reason for checking this is the same old story of my fps dropping from an easy 60 to around 30 depending on where I look, but only sometimes, even though nothing has really changed in the frustum. I use fraps for the fps counter, but I've read that it, like the profiler itself, is a bit of a performance hog. I found out that it's possible to run the profiler through the editor but linked to a built version of the game, to get rid of the profiler's overhead, but it's not easy to look at a specific frame since the game keeps on running. I haven't seen anything too bad that could explain a 30 fps drop. I suspect it's a combination of an old (?) laptop and too many alpha particles, but I can't explain why looking in one direction, away from the particles give me 60 fps, but depending on mouse movement speed, seemingly, if I turn around and look at the particles, the framerate will or will not drop drastically. I could semi-replicate this multiple times just now, as if shocking the pc with fast movements was too much to draw the frames xD

There's a lot of stuff that could be going on, and turning the camera is one of the most taxing operations as geometry and particle systems may be loaded, unloaded, etc. Besides dividing up your particle systems as you mention later on, try to find an option that keeps them "always on" independent of view frustrum.

Again, thanks for the tips, guys. I am learning a lot these past weeks, focusing on exactly what each function do and wrapping my head around grids and data structures. My plan is to have just a inventory and crop system, and a very simple battle system, real time or turn based, what will eventually be easier.

Something is on my mind lately, though. I am following youtube tutorials in game maker, so lots of things I end up copying from the teachers code, while i pause to analyze it and try to see exactly what line is doing what. My fear is that I end up not absorving it in a more permanent way. I am not really at the point of trying to come up with code on my own, although im reading a lot of the documentation to try to expand the tools I have.

I would try to do some simple coding yourself as exercises. I understand what you feel because even though I have decades of experience of "normal" coding, pixel shaders are an entirely new territory for me and at the beginning I did quite a bit of "copy-paste-tweak coding". The important thing is going over and over what everything does and why.

I also seem to be the most beginner level coder here, So Ill try to refrain to ask these basic questions so often hahahah

Absolutely do not refrain, we're here for that!
 

trugs26

Member
Jan 6, 2018
2,025
I've been hard at work on a couple things over the last week. Firstly a transitional cutscene that plays when going from a level to the hub world:



Secondly, an update the Baroness Samedice's boss battle with a new phase and some tweaking to the amount of screenshake:


This is the first time I've seen your game. It looks really cool! It's very exciting and I love the look of this boss. This boss fight alone has made me want to sub to your feed. By the way, judging by the look of it, is this game a N64 (specifically, Banjo-Kazooie) style platformer?
 
Oct 29, 2017
5,294
Minnesota
What scenario are you pitching in? (Face-to-face presentation, sending in a deck, Skype meeting, phone call, etc.) Regardless, I would suggest that you make it quick and exciting, highlight a Switch-specific feature for huge bonus points, and be sure to show pretty pictures
Just using the email I've been told to use. I figure it's all pretty email-extensive since we're a small team. I'm sure it'll wind up like GoG, which we got denied entry to because our game is too niche and the production values aren't there.

First one's true. Last one kinda hurts :X
 

funkygallo

Member
Oct 27, 2017
249
Ok I'll add also my little game :)

Days After The Storm
is the first title developed by Strange Beat Games, the game pays tribute to some of the most memorable games from Lucas Arts such as Monkey Island and Indiana Jones but also first person adventure such as RAMA or The 7th Guest.

Days After The Storm will have the player moving about a post nuclear setting as survivor of a nuclear blast, the main objective for him/her will be reuniting with his/her own family and survive in a devastated and dangerous post nuclear land using both physical and mental skills.

Days After The Storm will be released in 2018 for Xbox One (via id@xbox), Windows 10, PC/Mac/Ubuntu (Steam) and Wii U. (Hopefully also for Nintendo Switch and PS4)

 

_Rob_

Member
Oct 26, 2017
606
This is the first time I've seen your game. It looks really cool! It's very exciting and I love the look of this boss. This boss fight alone has made me want to sub to your feed. By the way, judging by the look of it, is this game a N64 (specifically, Banjo-Kazooie) style platformer?

Hey, thanks! I guess so yeah, although I draw more inspiration from games like Spyro and Jak & Daxter than Banjo these days!
 

K Monkey

Member
Oct 25, 2017
278
started to hook up the music back in the game and get it all dynamic and stuff based on the situation.

 

Mike Armbrust

Member
Oct 25, 2017
528
vcrlogofinal.png


The more or less final logo for my game. I'm hoping to re-reveal it soon since I've been stuck in development for a lot longer than I expected.
 

_Rob_

Member
Oct 26, 2017
606
I've been working on updating Clive'N' Wrench's graveyard themed level, A Grave Mistake. After a few days work it feels like I've solidified the right look in my head now.

AGraveMistake.png

AGraveMistakeMoon.png
 

_Rob_

Member
Oct 26, 2017
606


I'm really liking how this level is turning out, the screen droplets and shadow casting lights on the pumpkins do a lot for atmosphere I reckon.
 

Deleted member 4353

User-requested account closure
Banned
Oct 25, 2017
5,559
Thought I'll get in on screenshot saturday for the first time. My game is a small adventure rpg like game. Still a major WIP but was playing around with post processing to try and get that summertime feel... i think.

 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Beautiful!

i feel like something missing

These are my negative / jarring observations:
1- The mountains in the background look "polygonal" and simpistic in a way that clashes with the organic and detailed look of the foreground elements. Try to add more details / textures to them, and avoid the straight lines in the snow edges.
2- There are tile artifacts / vertical straight lines in them too, as if tiles weren't wrapping around properly or something?
3- You may want to look into reducing your color palette, e.g. picking a popular 32 / 64-bit color palette like DB32 or Endesga32 and seeing how the game translates.

Quick and dirty comparison edit:
efCdr0N.gif
 

Chris Murphy

Member
Oct 27, 2017
18
I've been making some progress in the FX department.

Beamenemy.gif


I feel like this gun is going to have to be something you only use occasionally. I will probably make it use a shit load of energy which in turn makes your defences weaker.
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
I have a programming conundrum. I'm trying to make my music volume settings behave in a certain way. Regularly, changing the music volume will change the 2d background music as always. But in our game, once a player grabs a sword, the regular background music fades to zero volume, regardless of options settings, and the sword itself plays a 3d positional music track. During this state, if you change the music volume, only the sword's music should be affected. But right now the background music still listens to any options changes, making two tracks play at the same time, which isn't right :/ I can't figure out a good set of conditionals that allows this to work both during network gaming, and in the main menu where there are no active players, pre-game so to speak. I've tried checking the localGamePlayer's gameState and that works too good, since that stop any and all AudioSources from listening to any changes. I could probably do a hacky solution where the active AudioSource is put on mute, then any volume changes would be irrelevant, and then I could reset the volume to zero for the new fade in, but there's gotta be a less hacky way of accomplish this, yeah? This solution would most likely bug out if someone tried changing the music volume mid-fade though, since the mute option would only kick in when the coroutine has reached zero, which it might never do if someone is messing with the values in realtime.
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
I've been making some progress in the FX department.

Beamenemy.gif


I feel like this gun is going to have to be something you only use occasionally. I will probably make it use a shit load of energy which in turn makes your defences weaker.

That looks positively beautiful. Do you have a lot of other weapons? Have you already balanced the game's difficulty around them? If not, and it's an option, consider buffing them up instead (or in addition to) nerfing this one. It's an old game balancing adage that in my experience works quite well!

I have a programming conundrum. I'm trying to make my music volume settings behave in a certain way. Regularly, changing the music volume will change the 2d background music as always. But in our game, once a player grabs a sword, the regular background music fades to zero volume, regardless of options settings, and the sword itself plays a 3d positional music track. During this state, if you change the music volume, only the sword's music should be affected. But right now the background music still listens to any options changes, making two tracks play at the same time, which isn't right :/ I can't figure out a good set of conditionals that allows this to work both during network gaming, and in the main menu where there are no active players, pre-game so to speak. I've tried checking the localGamePlayer's gameState and that works too good, since that stop any and all AudioSources from listening to any changes. I could probably do a hacky solution where the active AudioSource is put on mute, then any volume changes would be irrelevant, and then I could reset the volume to zero for the new fade in, but there's gotta be a less hacky way of accomplish this, yeah? This solution would most likely bug out if someone tried changing the music volume mid-fade though, since the mute option would only kick in when the coroutine has reached zero, which it might never do if someone is messing with the values in realtime.

The immediate solution that came to mind (and I might be missing something obvious so forgive me if so) is:
1) Store the global "music volume" as a variable somewhere (a singleton object would seem to be the most obvious choice).
2) Store both of the music sources' relative volumes as separate variables somewhere else (say, a custom BGM script on each AudioSource object).
3) Whenever either changes, set each actual AudioSource's volume as the product of the global volume by the corresponding music source volume.

Say the player has set volume to .75 (75%), and the level BGM is playing normally (1); its AudioSource volume would be .75 (1 x .75). When you pick the sword, the level BGM is dialed from 1 to 0, while the sword BGM has its volume set to 1; their respective AudioSources would play at 0 (0 x .75) and .75 (1 x .75). If the player then changes the music volume to, say, .5, you would set the AudioSource volumes to 0 (0 x .5) and .5 (1 x .5) respectively.

Does the above make sense? I'm not sure if I'm explaining myself too well. The only tricky thing is updating each BGM object when the player changes the volume settings: I would use events for that (have each BGM object register somewhere the options menu can reach, like a singleton BGMManager object). Of course, you could also get all the BGM components in the scene, but that's best avoided for efficiency.
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
The immediate solution that came to mind (and I might be missing something obvious so forgive me if so) is:
1) Store the global "music volume" as a variable somewhere (a singleton object would seem to be the most obvious choice).
2) Store both of the music sources' relative volumes as separate variables somewhere else (say, a custom BGM script on each AudioSource object).
3) Whenever either changes, set each actual AudioSource's volume as the product of the global volume by the corresponding music source volume.

Say the player has set volume to .75 (75%), and the level BGM is playing normally (1); its AudioSource volume would be .75 (1 x .75). When you pick the sword, the level BGM is dialed from 1 to 0, while the sword BGM has its volume set to 1; their respective AudioSources would play at 0 (0 x .75) and .75 (1 x .75). If the player then changes the music volume to, say, .5, you would set the AudioSource volumes to 0 (0 x .5) and .5 (1 x .5) respectively.

Does the above make sense? I'm not sure if I'm explaining myself too well. The only tricky thing is updating each BGM object when the player changes the volume settings: I would use events for that (have each BGM object register somewhere the options menu can reach, like a singleton BGMManager object). Of course, you could also get all the BGM components in the scene, but that's best avoided for efficiency.
Thanks, yeah I think we're on the same page here. I have an AudioManager singleton with two children created via script so I can have two music tracks crossfade between scenes. The same AudioManager script also contains all the "PlaySound" etc functions I've made/borrowed. A separate MusicManager keeps track of which level should play which music file and at which individual initial volume, but that's pretty much it. The OptionsManager can individually change Master, Music and SFX volumes via AudioManager functions, and all audiosources, be it effects or music, take a combination of these three volumes into consideration with the set value in the actual audiosource.

These OptionsManager volumes are also stored in the PlayerPrefs so they're saved between sessions so I guess that's what you could call a global volume :) The sword should have its volume stored in its own script iirc. I have a variable that binds itself to the volume value on the actual AudioSource, so I don't have to set the value with code. Your example is pretty much what the current code is doing. The sword's music takes the current Master and Music volumes from the OptionsManager in account in the "PlayMusic" function when the sword is picked up, while the background music fades out to 0 from whatever value it had before.

Before, I had wanted to have the sword music play at a certain volume regardless of volume settings in Options, it's a fundamental gameplay feature so turning it off would be like shooting yourself in the foot haha, but I've changed my mind and want the player to have the option to do whatever he wants.

The problem is that any Music volume changes in Options revert the faded music's settings. So if the Music is set to 0, no background music would obviously play as intended, and the picked up sword wouldn't play either. Now up the Music value again, and depending on where I left the code last night, the sword either begins playing, or not, and the faded music begins playing as well, even though it shouldn't, not until the sword is no longer in use by a player. Then it should fade in from 0 to whatever the Music value deems correct.

Rereading your step by step solution at the top before posting this, I think I might not be using the MusicManager's stored volumes more than once, at the initial PlayMusic function call. I'll have to take another look at this tonight :)
 
Oct 25, 2017
653
I have a programming conundrum. I'm trying to make my music volume settings behave in a certain way. Regularly, changing the music volume will change the 2d background music as always. But in our game, once a player grabs a sword, the regular background music fades to zero volume, regardless of options settings, and the sword itself plays a 3d positional music track. During this state, if you change the music volume, only the sword's music should be affected. But right now the background music still listens to any options changes, making two tracks play at the same time, which isn't right :/ I can't figure out a good set of conditionals that allows this to work both during network gaming, and in the main menu where there are no active players, pre-game so to speak. I've tried checking the localGamePlayer's gameState and that works too good, since that stop any and all AudioSources from listening to any changes. I could probably do a hacky solution where the active AudioSource is put on mute, then any volume changes would be irrelevant, and then I could reset the volume to zero for the new fade in, but there's gotta be a less hacky way of accomplish this, yeah? This solution would most likely bug out if someone tried changing the music volume mid-fade though, since the mute option would only kick in when the coroutine has reached zero, which it might never do if someone is messing with the values in realtime.

You're in unity right? Use the mixer and groups to do stuff like that easily
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Your example is pretty much what the current code is doing. The sword's music takes the current Master and Music volumes from the OptionsManager in account in the "PlayMusic" function when the sword is picked up, while the background music fades out to 0 from whatever value it had before.

Nope, that's not what I'm saying. Let me see if I can explain this, starting from what I think you're doing.

- You currently have two variables, masterVolume and musicVolume, both of which can be separately set by the player.
- You set the AudioSource's volume to the product of both of these variables.
- When the sword is picked up, you set the AudioSource's volume to 0.
- If the player changes the music volume, you set the AudioSource's value as the product of the two variables (here lies the error).

Correct me if the above is wrong. In any case my solution is:
- You have four variables: masterVolume, musicVolume (both changeable via options), bgmVolume (1 by default) and swordVolume (0).
- You set the bgm AudioSource's volume as masterVolume * musicVolume * bgmVolume. Sword's AudioSource is masterVolume * musicVolume * swordVolume.
- When you pick up the sword, you slide down bgmVolume to 0 and up swordVolume to 1, and recalculate each AudioSource's volume as above. Then, obviously, you revert it to play the normal BGM.
- When the player changes either masterVolume or musicVolume, you also recalculate each AudioSource's volume.

Let me know if I got what you're doing right, and if my solution makes sense. :D
 

Aki-at

Member
Oct 25, 2017
336


Yep properly back into the group of game dev now, showing off the map screen and an entire track too! Made running it through a Mega Drive for that 100% authenticity. I'm really happy to see how both these turned out, now to think about how to animate parts of it...
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
Nope, that's not what I'm saying. Let me see if I can explain this, starting from what I think you're doing.

- You currently have two variables, masterVolume and musicVolume, both of which can be separately set by the player.
- You set the AudioSource's volume to the product of both of these variables.
- When the sword is picked up, you set the AudioSource's volume to 0.
- If the player changes the music volume, you set the AudioSource's value as the product of the two variables (here lies the error).

Correct me if the above is wrong. In any case my solution is:
- You have four variables: masterVolume, musicVolume (both changeable via options), bgmVolume (1 by default) and swordVolume (0).
- You set the bgm AudioSource's volume as masterVolume * musicVolume * bgmVolume. Sword's AudioSource is masterVolume * musicVolume * swordVolume.
- When you pick up the sword, you slide down bgmVolume to 0 and up swordVolume to 1, and recalculate each AudioSource's volume as above. Then, obviously, you revert it to play the normal BGM.
- When the player changes either masterVolume or musicVolume, you also recalculate each AudioSource's volume.

Let me know if I got what you're doing right, and if my solution makes sense. :D
Hmm, this looks at first glance like exactly what I'm already doing with one exception: I never *directly* change the actual volume for each audioclip. The slider on the audiosources change between 0 and my own unique max value (which isn't the default 1) depending on what clip it's currently holding. The audioclip.volume value is only indirectly changed by temping with the masterVolume * musicVolume, along with my maxVolume, like step 2 in your solution. You're suggesting manually lowering the maxVolume directly, yes? I think I figured out a solution that seems to work though. I simply created a boolean isSwordHeld that needs to be false for the musicVolume to be allowed to change xD I set this bool to true (default false) when the sword is picked up, and reset to false when dropped. And I already had a check in place for if the sword's AudioSource isn't null, its volume gets altered with the same function :) This seems to work perfectly, across several sword pickups and scene changes, I just needed to find where to reset it. Thanks for the assist, it helped to talk about it for sure.
You're in unity right? Use the mixer and groups to do stuff like that easily
Yes, I'm in Unity 5.6, and I have no idea what you're talking about haha :D
 
Oct 25, 2017
653
Hmm, this looks at first glance like exactly what I'm already doing with one exception: I never *directly* change the actual volume for each audioclip. The slider on the audiosources change between 0 and my own unique max value (which isn't the default 1) depending on what clip it's currently holding. The audioclip.volume value is only indirectly changed by temping with the masterVolume * musicVolume, along with my maxVolume, like step 2 in your solution. You're suggesting manually lowering the maxVolume directly, yes? I think I figured out a solution that seems to work though. I simply created a boolean isSwordHeld that needs to be false for the musicVolume to be allowed to change xD I set this bool to true (default false) when the sword is picked up, and reset to false when dropped. And I already had a check in place for if the sword's AudioSource isn't null, its volume gets altered with the same function :) This seems to work perfectly, across several sword pickups and scene changes, I just needed to find where to reset it. Thanks for the assist, it helped to talk about it for sure.
Yes, I'm in Unity 5.6, and I have no idea what you're talking about haha :D

Watch this:

https://unity3d.com/learn/tutorials...e-order-beta/audiomixer-and-audiomixer-groups
 

K Monkey

Member
Oct 25, 2017
278
Yes, I'm in Unity 5.6, and I have no idea what you're talking about haha :D

Yeah u need mixer groups. You are doing way too much work for something simple from what i can understand about what you want.

Music Group
- Master
- Background
- Sword

Your global music volume setting should be linked to Master which will affect both Background and Sword. Then you are free to change the volume of Background to -80db for example and raise Sword to 0db when you get the item.
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Hmm, this looks at first glance like exactly what I'm already doing with one exception: I never *directly* change the actual volume for each audioclip. The slider on the audiosources change between 0 and my own unique max value (which isn't the default 1) depending on what clip it's currently holding.

It's 2 AM and I was going to go to bed, so very quickly:
- Do not use "max volume" values. The values you change when you get the sword should be multipliers, not caps.
- Please describe in more detail the bit about this "max value" changing its value depending on the clip.
- I was under the assumption you had different AudioSources for both the bgm and sword music. Please correct me if this is wrong.
- If by "directly" you mean "actually moving the slider in the Unity editor", then the answer is no. Everything I proposed is programmatical. It has to be, since all of these values change while the game is playing. The "sliders" are irrelevant as you'll be overwriting their values anyway with "audioSource.volume = x".
- The AudioSource.volume values are only set as a result of calculations involving the other four variables. Don't think of them as variables, or if you do, think of them as two additional variables that you will be setting according to the multiplications described above.
- The solution you propose later on seems like a workaround rather than a general solution for your issue. You will run into problems again whenever a case like this arises again.
- I had no knowledge of Music Groups so you might want to try these instead (indeed, they are the exact same solution I proposed, abstracted into a general Unity system).
 

DNAbro

Member
Oct 25, 2017
25,875


Yep properly back into the group of game dev now, showing off the map screen and an entire track too! Made running it through a Mega Drive for that 100% authenticity. I'm really happy to see how both these turned out, now to think about how to animate parts of it...


that music is real good.
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
Yeah u need mixer groups. You are doing way too much work for something simple from what i can understand about what you want.

Music Group
- Master
- Background
- Sword

Your global music volume setting should be linked to Master which will affect both Background and Sword. Then you are free to change the volume of Background to -80db for example and raise Sword to 0db when you get the item.
Whoa, well this would've been nice to have known about two years ago lol. Thanks, I watched the video and it seemed to be doing pretty much exactly what I've coded so far.
It's 2 AM and I was going to go to bed, so very quickly:
- Do not use "max volume" values. The values you change when you get the sword should be multipliers, not caps.
- Please describe in more detail the bit about this "max value" changing its value depending on the clip.
- I was under the assumption you had different AudioSources for both the bgm and sword music. Please correct me if this is wrong.
- If by "directly" you mean "actually moving the slider in the Unity editor", then the answer is no. Everything I proposed is programmatical. It has to be, since all of these values change while the game is playing. The "sliders" are irrelevant as you'll be overwriting their values anyway with "audioSource.volume = x".
- The AudioSource.volume values are only set as a result of calculations involving the other four variables. Don't think of them as variables, or if you do, think of them as two additional variables that you will be setting according to the multiplications described above.
- The solution you propose later on seems like a workaround rather than a general solution for your issue. You will run into problems again whenever a case like this arises again.
- I had no knowledge of Music Groups so you might want to try these instead (indeed, they are the exact same solution I proposed, abstracted into a general Unity system).
That's okay, it's 3am here, so maybe I'm not explaining it very well either :)

By max volume, I mean the actual volume on the AudioSource component; the AudioManager has two of these on a couple of children, so I can crossfade two tracks at the same time, while the sword has its own AudioSource. The min/max volume values on each AudioSource is of course set to be between 0 and 1 by engine defaults, I'm NOT touching that value. What I mean is that I manually set each AudioSource to be playing at for instance 0.15 (out of those 0 to 1) on most tracks because otherwise the tracks are way too loud, because they are random audioclips from Google basically, so there's no common ground between their inherent audio levels. I don't know how to remaster them (normalize?) nor do I think I have legal permission to do so.

I'm not touching the components' volume caps, the values are changed by changing the musicVolume multiplier etc, yeah. The initial volume value I set technically stays the same regardless. My code looks pretty much exactly as your previous multiplication example. I think we might be talking around each other here haha. My code is basically this:

Step 1: Bind the correct AudioClip to the correct AudioSource on the AudioManager, depending on what level has been loaded.
Step 2: Each music track has a predetermined float value set to 0.15, intended to be used as the target maxVolume allowed.
Step 3: Run the function PlayMusic(AudioCliptoPlay, ThePredeterminedAudioSource.volumeValue, AFadeDurationValue).
Step 4: This function binds the clip mentioned to the correct AudioSource child, and starts a CoroutineCrossfader(float maxMusicVolume, float duration).

For maxMusicVolume I use ThePredeterminedAudioSource.volumeValue (the 0.15 from above) * musicVolume (the global music volume from the options menu, a regular 1.0f) * masterVolume (which is just really AudioListener.volume).

Since I don't modify the 0.15 value, it's just a float value set in the MusicManager, any music playing can never be louder than 0.15 (out of 1.0 which is Unity's max value) regardless of musicVolume * masterVolume, which is exactly as it should be :) Assuming the currently playing AudioSource has a maxVolume of 0.15 when at full music and master volumes, if I want the volume to be half of that in the end, I lower either the master or music multiplier by 50%, nothing else.

I interpreted your solution as I should be modifying the 0.15 value in some cases.
 
Last edited:

Rolento

Member
Oct 25, 2017
2,522
Loving all the #screenshotsaturday progress!

I'm a little late but here is my all placeholder art, and too confusing interface, but functions working where needed ^_^

It will flow and look different when done, but it's at a decent place right now

CXQRuT6.gif
 

Chris Murphy

Member
Oct 27, 2017
18
That looks positively beautiful. Do you have a lot of other weapons? Have you already balanced the game's difficulty around them? If not, and it's an option, consider buffing them up instead (or in addition to) nerfing this one. It's an old game balancing adage that in my experience works quite well!

Well it's the kind of game where you upgrade everything over time. So at the start you'd only have a weak standard machine gun type weapon but by the end you'd have stuff like this. There will be a suit energy system, kinda like a stamina bar, so certain actions will drain it. This weapon being one of them because it's really powerful and it's easy to use as it locks on to enemies. Other powerful weapons wouldn't drain it as much if at all because they are much harder to use. Such as slow reloading sniper or an arcing bow type weapon.

Look pretty.
Does your game have a name and a site?

Yeah the name is Cozen Servo and the site is CozenServo.com or Monobraingames.com

They aren't updated all that much as I've been concentrating on the game itself and haven't even done a game announcement press release yet. Once I have I'll be updating them regularly. For now I tend just to post updates on my twitter @monobrainchris
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
By max volume, I mean the actual volume on the AudioSource component; the AudioManager has two of these on a couple of children, so I can crossfade two tracks at the same time, while the sword has its own AudioSource. The min/max volume values on each AudioSource is of course set to be between 0 and 1 by engine defaults, I'm NOT touching that value. What I mean is that I manually set each AudioSource to be playing at for instance 0.15 (out of those 0 to 1) on most tracks because otherwise the tracks are way too loud, because they are random audioclips from Google basically, so there's no common ground between their inherent audio levels. I don't know how to remaster them (normalize?) nor do I think I have legal permission to do so.

OK, there's several things here:
1- All your clips should indeed be normalized; setting a different value manually by clip is, not to put a fine point, the path to madness. :D
2- You say you got your clips from Google. I'm assuming you are explicitly using clips with "free to use commercially" licenses like CC0 or similar? If so, you're free to transform them as you want, including changing their volume. If not... you're in a whole different problem. :D
3- To edit your audio files (including changing volume, but you'll also want to edit sound effects to change their tempo, clip the parts you want, etc) use Audacity. It's free and open source, and has everything you would need in a very easy to use interface. To change volume, use "Amplify"; despite the name, you can use a negative value to decrement loudness. By default Amplify has a safety measure that doesn't allow to amplify over a volume that would clip the waveform, but you can disable it if you really need it.
4- BTW, I personally save my audio files as .ogg: they're quite small, high quality, and Unity recognizes them just fine.

I'm not touching the components' volume caps, the values are changed by changing the musicVolume multiplier etc, yeah. The initial volume value I set technically stays the same regardless. My code looks pretty much exactly as your previous multiplication example. I think we might be talking around each other here haha. My code is basically this:

Step 1: Bind the correct AudioClip to the correct AudioSource on the AudioManager, depending on what level has been loaded.
Step 2: Each music track has a predetermined float value set to 0.15, intended to be used as the target maxVolume allowed.
Step 3: Run the function PlayMusic(AudioCliptoPlay, ThePredeterminedAudioSource.volumeValue, AFadeDurationValue).
Step 4: This function binds the clip mentioned to the correct AudioSource child, and starts a CoroutineCrossfader(float maxMusicVolume, float duration).

For maxMusicVolume I use ThePredeterminedAudioSource.volumeValue (the 0.15 from above) * musicVolume (the global music volume from the options menu, a regular 1.0f) * masterVolume (which is just really AudioListener.volume).

Since I don't modify the 0.15 value, it's just a float value set in the MusicManager, any music playing can never be louder than 0.15 (out of 1.0 which is Unity's max value) regardless of musicVolume * masterVolume, which is exactly as it should be :) Assuming the currently playing AudioSource has a maxVolume of 0.15 when at full music and master volumes, if I want the volume to be half of that in the end, I lower either the master or music multiplier by 50%, nothing else.

I interpreted your solution as I should be modifying the 0.15 value in some cases.

OK, several things:
1- Get rid of the .15 multiplier and just manually normalize your tracks with Audacity, this will cut down on complexity.
2- Try not to think in terms of "max values" because they're really not, they're multipliers. If you have a volume of .5 and a "maxValue" of .5, since you're multiplying, you'd get .25, not .5 as would be expected if it was really a "maxValue".
3- I think an issue may be with your CoroutineCrossfader coroutine. Is it taking into account the current values of bgmVolume and globalVolume in each step? My intuition is no, since you're passing a volume value to it, which I assume is already calculated from those. So if it's fading the volume from its current value to the value you passed, it's ignoring the option changes made by the user.

In any case I think I would understand it better if I had the actual code in front of me. :D Try the MusicGroups solution and see if they help. If they don't, feel fre to PM me your code.

Well it's the kind of game where you upgrade everything over time. So at the start you'd only have a weak standard machine gun type weapon but by the end you'd have stuff like this. There will be a suit energy system, kinda like a stamina bar, so certain actions will drain it. This weapon being one of them because it's really powerful and it's easy to use as it locks on to enemies. Other powerful weapons wouldn't drain it as much if at all because they are much harder to use. Such as slow reloading sniper or an arcing bow type weapon.

Sounds perfect! I thought you meant actually nerfing the gun's power but limiting it like this is cool; it allows for strategic choice as you switch from more powerful weapons to weaker weapons to let energy recharge.
 

Chris Murphy

Member
Oct 27, 2017
18
So today I got the dash/teleport mechanics working along with the effects. Been meaning to do this for a while. It'll open up some nice jumping sections that are only do-able with the ability. I also want the holo model to change based on where you put it. So if it's on the ground it's a running animation and if it's on an enemy it's an attack animation, because I want to dash to double as an offensive move.

Dash.gif
 
Status
Not open for further replies.