• 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.
  • We have made minor adjustments to how the search bar works on ResetEra. You can read about the changes here.
Status
Not open for further replies.

Minamu

Member
Nov 18, 2017
1,900
Sweden
Can anyone tell me what's wrong with this countdown code in Unity 5?

Code:
IEnumerator CountdownTimer()
{
    Hud.Instance.respawnTimerText.text = "Respawning in " + Mathf.CeilToInt(countdownTimer) + "...";

    while(countdownTimer > 0)
    {
         countdownTimer -= Time.deltaTime; //countdownTimer is a float set to 5f elsewhere
         yield return new WaitForSeconds(5);
    }
}

I'm running this as a coroutine inside an OnTriggerStay if Collider other is a localplayer. It works fine except for the WaitforSeconds part. It doesn't seem to be yielding the correct amount of time for some reason. Do I need more yields or something? I want the 5 second countdown to only update every 1 second of course down to 1 or 0 but without a 5 inside the WaitForSeconds, the float timer reaches 0 in like 1 second instead of the 5 I want it to take. It also seems to be speeding up randomly as the value gets smaller when I exit and reenter the trigger multiple times. I'm lost haha. Maybe the CeilToInt is wrong too, I'm not used to math functions.
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
dang.

yeah i've spent about 3 hours now trying to get my UI to work the way i want with absolutely no success and basically the same errors. these are the low points of it all...
Yeah, I've been working on my game for about 5-6 hours now on and off while at work xD Funny thing is, we already have a countdown timer in the game's lobby and for each and every ability in the game, so I'm really curious as to why this isn't working...
 

Wulfric

Member
Oct 25, 2017
5,965
Hi everyone, got a question about how you obtain concept art for your games. Is the person who creates it a permanent part of your team, or are they a freelancer?

I'm an aspiring artist with an interest in 2D illustrative work, although I'm aware of how few of those positions exist in the industry. Is there an advantage to learning a little bit of Zbrush to prove my designs translate into 3D space? On the other hand, I don't want to be pigeonholed into a modeling job I have no real interest in. I'm a big fan of Kekai Kotaki's Guild Wars work and Samwise Didier if that helps any.
 

HellBlazer

▲ Legend ▲
Member
Oct 26, 2017
1,030
Can anyone tell me what's wrong with this countdown code in Unity 5?

Code:
IEnumerator CountdownTimer()
{
    Hud.Instance.respawnTimerText.text = "Respawning in " + Mathf.CeilToInt(countdownTimer) + "...";

    while(countdownTimer > 0)
    {
         countdownTimer -= Time.deltaTime; //countdownTimer is a float set to 5f elsewhere
         yield return new WaitForSeconds(5);
    }
}

I'm running this as a coroutine inside an OnTriggerStay if Collider other is a localplayer. It works fine except for the WaitforSeconds part. It doesn't seem to be yielding the correct amount of time for some reason. Do I need more yields or something? I want the 5 second countdown to only update every 1 second of course down to 1 or 0 but without a 5 inside the WaitForSeconds, the float timer reaches 0 in like 1 second instead of the 5 I want it to take. It also seems to be speeding up randomly as the value gets smaller when I exit and reenter the trigger multiple times. I'm lost haha. Maybe the CeilToInt is wrong too, I'm not used to math functions.

I think the issue is that you're mixing Time.deltaTime and WaitForSeconds. Time.deltaTime is the time since the last frame, so if you want your countdownTimer to be accurate, you'd need to subtract the deltaTime every frame, right? But if you wait for a number of seconds between each iteration of your loop, that's not what you're doing. Instead, you're removing one frame's timing every X seconds. So you could just "yield return null" instead to only wait until the next frame, which should work since your timer should now be accurate -- it might not be optimal to do the calculation every frame, but with a tiny operation like that the effect should be negligible. Or you could trust Unity to measure your seconds, and just subtract 1 on each loop iteration, and "yield return new WaitForSeconds(1)", which might not be precisely accurate down to the millisecond, but would probably not be noticeable. Or you could ditch the coroutine, and put that code in some script's update function instead, and then you don't need a loop or a yield statement at all.

Note: I haven't tested any of this but I think any of those options should work. :D Hopefully this is of some help to you.
 

K Monkey

Member
Oct 25, 2017
278
Can anyone tell me what's wrong with this countdown code in Unity 5?

Code:
IEnumerator CountdownTimer()
{
    Hud.Instance.respawnTimerText.text = "Respawning in " + Mathf.CeilToInt(countdownTimer) + "...";

    while(countdownTimer > 0)
    {
         countdownTimer -= Time.deltaTime; //countdownTimer is a float set to 5f elsewhere
         yield return new WaitForSeconds(5);
    }
}

I'm running this as a coroutine inside an OnTriggerStay if Collider other is a localplayer. It works fine except for the WaitforSeconds part. It doesn't seem to be yielding the correct amount of time for some reason. Do I need more yields or something? I want the 5 second countdown to only update every 1 second of course down to 1 or 0 but without a 5 inside the WaitForSeconds, the float timer reaches 0 in like 1 second instead of the 5 I want it to take. It also seems to be speeding up randomly as the value gets smaller when I exit and reenter the trigger multiple times. I'm lost haha. Maybe the CeilToInt is wrong too, I'm not used to math functions.


I think the issue is that you're mixing Time.deltaTime and WaitForSeconds. Time.deltaTime is the time since the last frame, so if you want your countdownTimer to be accurate, you'd need to subtract the deltaTime every frame, right? But if you wait for a number of seconds between each iteration of your loop, that's not what you're doing. Instead, you're removing one frame's timing every X seconds. So you could just "yield return null" instead to only wait until the next frame, which should work since your timer should now be accurate -- it might not be optimal to do the calculation every frame, but with a tiny operation like that the effect should be negligible. Or you could trust Unity to measure your seconds, and just subtract 1 on each loop iteration, and "yield return new WaitForSeconds(1)", which might not be precisely accurate down to the millisecond, but would probably not be noticeable. Or you could ditch the coroutine, and put that code in some script's update function instead, and then you don't need a loop or a yield statement at all.

Note: I haven't tested any of this but I think any of those options should work. :D Hopefully this is of some help to you.

If that doesn't work, I'm wondering if its because of OnTriggerStay is being fired off multiple times hence starting several coroutines and spamming the countdownTimer.

Anyway, heres my last screenshot for 2017. May 2018 bring all of you great game dev days ahead.

RHl23r9.png
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
Thanks for the replies, I'll check it out tonight. It could very well be the OnTriggerStay that is the problem, indeed. Same thing would likely happen if you start a coroutine in update :) But it could possibly be booled to stop this!
 

Deleted member 5167

User requested account closure
Banned
Oct 25, 2017
3,114
Thanks for the replies, I'll check it out tonight. It could very well be the OnTriggerStay that is the problem, indeed. Same thing would likely happen if you start a coroutine in update :) But it could possibly be booled to stop this!

If you're using mathf rounding to ints anyway, I'd say you probably don't even need to be using Time functions, or using a float for your time counter unless you ned that granularity.
Something like

Code:
Ienumerator Time()
{
     text.text = "Time is " + time;
     time -= 1;
     yield return new waitforseconds(1);
}

will just count down at a constant pace.

Unless you really need your time function to be framerate dependent....?
 

sabrina

Banned
Oct 25, 2017
5,174
newport beach, CA
Hi everyone, got a question about how you obtain concept art for your games. Is the person who creates it a permanent part of your team, or are they a freelancer?

I'm an aspiring artist with an interest in 2D illustrative work, although I'm aware of how few of those positions exist in the industry. Is there an advantage to learning a little bit of Zbrush to prove my designs translate into 3D space? On the other hand, I don't want to be pigeonholed into a modeling job I have no real interest in. I'm a big fan of Kekai Kotaki's Guild Wars work and Samwise Didier if that helps any.
With a small team size the concept artist either doesn't exist, or is just one of the regular artists. I'm the only person working on my game, as are many of the people in this thread, and I don't really do concepts for stuff. I know first-hand that Jobbs does a lot of concept art for his characters especially, but it's very important to him that he be the one doing that. Because as much fun as it must seem to "come up with new concepts", it's more useful as a tool for getting people of different disciplines on the same page that you need in larger teams.

Anyway, heres my last screenshot for 2017. May 2018 bring all of you great game dev days ahead.
Whoa, I love this. The color work is phenomenal. Great atmosphere.
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
If you're using mathf rounding to ints anyway, I'd say you probably don't even need to be using Time functions, or using a float for your time counter unless you ned that granularity.
Something like

Code:
Ienumerator Time()
{
     text.text = "Time is " + time;
     time -= 1;
     yield return new waitforseconds(1);
}

will just count down at a constant pace.

Unless you really need your time function to be framerate dependent....?
Well no I guess you're right :) I *think* I tried this last night with no success but I'll try again in a few hours. I don't want it to be framerate dependent, no :) Good catch though, I'll need to check with my team if they've thought of that on our ability cooldowns etc too.

Edit: I tried the code above, both with and without a while loop in the coroutine. It counts down to 0 immediately, regardless of the WaitForSeconds value (currently at 300).
 
Last edited:

K Monkey

Member
Oct 25, 2017
278
Well no I guess you're right :) I *think* I tried this last night with no success but I'll try again in a few hours. I don't want it to be framerate dependent, no :) Good catch though, I'll need to check with my team if they've thought of that on our ability cooldowns etc too.

Edit: I tried the code above, both with and without a while loop in the coroutine. It counts down to 0 immediately, regardless of the WaitForSeconds value (currently at 300).

have u tried not putting it in triggerstay? :)

Whoa, I love this. The color work is phenomenal. Great atmosphere.

Thanks :D that big guy wasn't suppose to be in this level (outside) but I was testing out different things and this view was too good to pass on
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
have u tried not putting it in triggerstay? :)



Thanks :D that big guy wasn't suppose to be in this level (outside) but I was testing out different things and this view was too good to pass on
Haha yeah, I've tried starting it in OnTriggerEnter but then it stops after 1 second for some reason. I've also tried simply setting a bool and then running the coroutine through Update but the behavior remains the same.

It works slightly better if I run it through OnTriggerStay (which as mentioned will start numerous coroutines) and then I stop ALL in one fell swoop. Doesn't look right though.

Edit: Well, I finally fixed it. I don't think I've ever deep dived so far into Google to find a solution and explanation for the problem than this time xD In the end, I did manage to start the coroutine in OnTriggerEnter, but it turns out that for some obscure reason, not found in official documentation, you can't do this:

Code:
StartCoroutine(MyRoutine());
StopCoroutine(MyRoutine());

The code above doesn't actually refer to the same coroutine! These two "MyRoutine" are two completely separate instantiated objects, meaning I've been trying to turn off an object that doesn't exist if I understand this correctly. This is a very hidden quirk in the IEnumerator class that I only found out about by finding a similar question from 2012 with an updated answer from 2015 lol.

So I instead created a private Coroutine respawnTimer; and in OnTriggerEnter, I wrote respawnTimer = StartCoroutine(CountdownTimer(myParameter)); and I stop it by writing StopCoroutine(respawnTimer) instead of CountdownTimer(). Doing it this way seems to kill the coroutine instantly, while the old way takes a few moments longer, maybe because it needs to finish or reach a certain frame, I don't know. That's probably part of what was causing my issues in the first place as hundreds of coroutines weren't terminating properly and all writing to the same text field xD
 
Last edited:

Wulfric

Member
Oct 25, 2017
5,965
With a small team size the concept artist either doesn't exist, or is just one of the regular artists. I'm the only person working on my game, as are many of the people in this thread, and I don't really do concepts for stuff. I know first-hand that Jobbs does a lot of concept art for his characters especially, but it's very important to him that he be the one doing that. Because as much fun as it must seem to "come up with new concepts", it's more useful as a tool for getting people of different disciplines on the same page that you need in larger teams.

Ah, that's as shame, but understandable. At what point do you think it becomes necessary to have one? From my perspective, it feels like jumping straight into creating 2D/3D assets is a mistake if you don't have a solid concept to start with.
 

_Rob_

Member
Oct 26, 2017
606
Ah, that's as shame, but understandable. At what point do you think it becomes necessary to have one? From my perspective, it feels like jumping straight into creating 2D/3D assets is a mistake if you don't have a solid concept to start with.

I think it depends how clear the vision is inside your head. For example, I work with a concept/character artist for all of the main characters in my game, but haven't done so for environmental stuff. I tend to "mood board" by gathering hundreds of reference photos to get a clearer idea of what I'm actually after. I do think it'd depend on the person as well as the intended art style though.


Speaking of which, I've been working on filling in The Great Wen's gaps, including some "set dressing" buildings outside of the traversable areas of the world. Also making sure to squeeze in a London landmark or two to further help set the stage!

GreatWenCrumpett.png

GreatWenBen.png
 

WishyWaters

Member
Oct 26, 2017
94
For the past 7 years or so I have pretty much abandoned all of my social media. Over the next few months I will start breathing life back into the ancient accounts that have gathered dust. I plan to use them to do more than just share game development. I think it's important to show yourself as a person, which means making parts of your life visible to the public.

So my question to you all, what do you share? What parts of your life are you posting on twitter or blogs and what do you leave offline? Is this something you think about or do you just post and move on?

I am going to start including my new baking attempts. Since I often let my daughter help this means my immediately family is going to be wrangled into my posts.
 

Pooh

Member
Oct 25, 2017
8,849
The Hundred Acre Wood
For my New Year's Resolution this year, I've decided that I will make at least one asset a day for my game, no matter how basic or shitty it is, and no matter if I have to redo it later. At least one asset.

I made a crummy dirt block yesterday because I had a headache and went to bed early. I'll post it when I get home!
 

J-Tier

The Fallen
Oct 25, 2017
3,735
Southern California
For the past 7 years or so I have pretty much abandoned all of my social media. Over the next few months I will start breathing life back into the ancient accounts that have gathered dust. I plan to use them to do more than just share game development. I think it's important to show yourself as a person, which means making parts of your life visible to the public.

So my question to you all, what do you share? What parts of your life are you posting on twitter or blogs and what do you leave offline? Is this something you think about or do you just post and move on?

I am going to start including my new baking attempts. Since I often let my daughter help this means my immediately family is going to be wrangled into my posts.
Part of my job is managing the social media for a company that I work for... just a suggestion, do whatever's most convenient for you...but I'd keep a separate account for personal stuff and cross-pollinate when appropriate. Keep game development stuff on the game dev account, and personal stuff on the personal account. Then share over a few personal things now and then (i.e. things that are interesting, funny, emotional, relevant like video game character shaped cookies etc). If you mix them, it may work, but more often than not--some of the irrelevant content may alienate the followers that have an expectation of just game content or just your personal life.
 

Deleted member 35011

User requested account closure
Banned
Dec 1, 2017
2,185
At the risk of being really dumb, I don't really understand Unity 5's shaders. (I was working with Unity 4, decided to switch because I'm evidently an idiot)

I can't seem to get any textures to be actually transparent. Like, the texture appears perfectly transparent when I import it, but once I try putting it in a material it just doesn't work. It either just makes the entire image black(under opaque) or the whole thing goes transparent/invisible, not just the parts meant to be transparent(when using fade/transparent). I tried googling this but I got like no results, which leads me to believe I'm one of the few people dumb enough not to figure it out. I'd appreciate some advice here because I spent way longer than I care to admit trying to figure it out haha.

EDIT: Nevermind, got it. As it often the case with asking for help, the moment you do it you happen to get it right :P turns out Unity had glitched out and the color popup wasn't...well, working, so I assumed there was some other way to set the transparency. There was not. I just had to restart it.
 
Last edited:

_Rob_

Member
Oct 26, 2017
606
For the past 7 years or so I have pretty much abandoned all of my social media. Over the next few months I will start breathing life back into the ancient accounts that have gathered dust. I plan to use them to do more than just share game development. I think it's important to show yourself as a person, which means making parts of your life visible to the public.

So my question to you all, what do you share? What parts of your life are you posting on twitter or blogs and what do you leave offline? Is this something you think about or do you just post and move on?

I am going to start including my new baking attempts. Since I often let my daughter help this means my immediately family is going to be wrangled into my posts.

I tend to share mostly just game stuff, but I go by my actual name as opposed to a pseudonym all over. I do occasionally share real life stuff (about my dog mostly), but I'm not a fan of social media in general, don't use Facebook, Instagram etc. It's so far not really caused me any issues, and at least my work is associated with me and not a screen-name!


For my New Year's Resolution this year, I've decided that I will make at least one asset a day for my game, no matter how basic or shitty it is, and no matter if I have to redo it later. At least one asset.

I made a crummy dirt block yesterday because I had a headache and went to bed early. I'll post it when I get home!

That's a pretty tall order, good luck!


I finally got the main square of The Great Wen finished! I'm especially pleased with the lighting and the out-of-bounds set dressing, adds some much needed depth I think.

GreatWenSquare.png


GreatWenSquare2.png
 

Minamu

Member
Nov 18, 2017
1,900
Sweden
_Rob_: I've been working on backdrops recently too, how have you solved it looking coherent while still clearly out of bounds and unaccessible?
 

K Monkey

Member
Oct 25, 2017
278
After a day of recovering my project yesterday, I finally put in some game dev time.

q5G1lgN.gif


Managed to put together a useable Title screen finally!
 

_Rob_

Member
Oct 26, 2017
606
_Rob_: I've been working on backdrops recently too, how have you solved it looking coherent while still clearly out of bounds and unaccessible?

It's definitely a difficult one, and for me it somewhat changes level to level because my themes are so varied. However there are a few "rules" I've settled on that help.

Firstly is that out of bounds stuff leans-in-to the level, by which I mean slightly angling things to lean over the traversable environment creates a subtle subliminal boundary. The other main one is that out-of-bounds tends to be much taller than anything you can access, so outer mountains for example will be about double the height of the tallest traversable terrain etc (the below shot should give a better idea of what I mean).

Middle-Age-Crisis-Forest.png


Lastly, I've found lighting is very important too; in the first "The Great Wen" screenshot I posted above, the lighting in-bounds is much brighter and more inviting than the darker subtle glow of the streets beyond the play area.

After a day of recovering my project yesterday, I finally put in some game dev time.

q5G1lgN.gif


Managed to put together a useable Title screen finally!

Loving the motion blur, very cinematic!
 

K Monkey

Member
Oct 25, 2017
278
It's definitely a difficult one, and for me it somewhat changes level to level because my themes are so varied. However there are a few "rules" I've settled on that help.

Firstly is that out of bounds stuff leans-in-to the level, by which I mean slightly angling things to lean over the traversable environment creates a subtle subliminal boundary. The other main one is that out-of-bounds tends to be much taller than anything you can access, so outer mountains for example will be about double the height of the tallest traversable terrain etc (the below shot should give a better idea of what I mean).

Middle-Age-Crisis-Forest.png


Lastly, I've found lighting is very important too; in the first "The Great Wen" screenshot I posted above, the lighting in-bounds is much brighter and more inviting than the darker subtle glow of the streets beyond the play area.



Loving the motion blur, very cinematic!

Thanks!

I havent seen that shot of yours before.. that looks fantastic and homey :)

edit - reminds me of Splash Mountain with Br'er Rabbit! :D
 

Landford

Attempted to circumvent ban with alt account
Banned
Oct 25, 2017
4,678
What is the best engine right now for quick prototypes?
 

Landford

Attempted to circumvent ban with alt account
Banned
Oct 25, 2017
4,678
Im planning to make a small island with traversable terrain on it. Seens Game Maker it is then! I assume its the one in the OP?

Also, to not double post, but anyone has a good playlist for a tutorial on Game Maker?
 
Last edited:

rancey

Banned
Oct 30, 2017
1,703
Im planning to make a small island with traversable terrain on it. Seens Game Maker it is then! I assume its the one in the OP?

Also, to not double post, but anyone has a good playlist for a tutorial on Game Maker?

you could try Shaun Spalding on youtube. He did loads of them, that's what I used when I was learning gamemaker. He ended up getting a job with gamemaker doing something or other I assume off the success of those videos.
 

Asa

Member
Oct 26, 2017
72
Helsinki, Finland
We have a new game coming up: Helihopper! It's a helicopter jumping game and its coming out next week.
Here's the launch trailer.


Sorry about not showing the game earlier, posting just trailer makes me feel bit like i'm pushing advertisements here. We haven't shown anything about the game here or anywhere else till today, for some reason wanted to keep this one pretty close to the chest, exciting to hear what people think about the art style :)
 
Last edited:

Pooh

Member
Oct 25, 2017
8,849
The Hundred Acre Wood
Day 3: Crummy character models

Any favorites? I'm not sure I can do the normals thing I want to do, so keep in mind they may look pretty much like this in terms of lighting/shadowing along voxel edges.

003.png
 

WishyWaters

Member
Oct 26, 2017
94
It's been awhile since I've shared any art. It's hard to select what to share when you know that almost everything is a place holder. We've been working on our battle screen and this comes with some of the most complicated UI, the most important pieces of pixel art, and a pile of programming to make sure everything works together. Combat is incredibly important in our game. We have worked hard to make sure it is never a grind, that each battle is full of variety and fresh mechanics that keep things fun and challenging.

Our battles feature a large variety of enemies laid out in a grid like pattern. Each attack has a pattern associated with it and these patterns grow larger as more powerful spells and weapons are acquired. At it's core, the game is about min-maxing your attack patterns with enemy elemental weakness. It creates a candy crush like experience and landing the right attack feels pretty good.
qJ3KnUs.jpg



We need responsive UI that is both informative and simple. At a glance the player should be able to see the condition of their entire party. HP and Mana bars are clearly defined and large enough to understand. Status effect icons get as much space as hp/mp since we fully intend them to be as important to gameplay. (You may remember my 30 status effects from a few months ago).
Our game has a more complicated initiative than most turn based RPGs. Depending on their speed stat a character may get more turns than others, up to 3 turns to the slowest's 1 turn. This is pretty much just progress bar initiative, but I hate waiting on a bar to fill up, so our engine crunches the numbers, sets an order, and presents you the information as a list. Any kind of slow or speed up will update the list dynamically. In hard fights it will be important to plan your actions out several turns in advance.
J62SVf2.png



So the UI has no style, the enemy sprites have no polish, and the background is still a wip. Yet we have a fully working battle system and that's worth talking about I think.
 

rancey

Banned
Oct 30, 2017
1,703
Day 3: Crummy character models

Any favorites? I'm not sure I can do the normals thing I want to do, so keep in mind they may look pretty much like this in terms of lighting/shadowing along voxel edges.

003.png

The center of the middle one's face looks a little odd, but really all three are totally fine for different kinds of characters. The left would work for a smaller woman and the right for a medium sized man.
 
Status
Not open for further replies.