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
ApproachingInfinity
Sep 14, 2008
Nothing about that looks like it should be killing your framerate to me; try checking the profiler to see if your bottleneck isn't maybe in a different script entirely (or if it's here, to find out which function it's in).

You can make this a little bit simpler, in any case. Coroutines can take parameters, so you can send all the necessary information directly into them. Wrapped with a function, you can also ensure that if you call up a new fade while one is running, you don't end up with both running at once. Something like:

code:

Coroutine currentFade;

// Wrap the IEnumerator in a function that takes care of stopping any currently running fade
public void Fade(Color endColor, float time, bool enabledWhenDone)
{
	if (currentFade != null) { StopCoroutine(currentFade); }
	currentFade = StartCoroutine(FadeSequence(endColor, time, enabledWhenDone));
}

IEnumerator FadeSequence(Color endColor, float time, bool enabledWhenDone)
{
	// May not be necessary, the code that started the fade could do this part (or choose not to)
	image.enabled = true;
	
	// Always start with whatever the image's color currently is
	Color start = image.color
	
	// This method means that the fade always takes exactly [time] seconds to complete
	float currentTime = 0f;
	while (currentTime < time)
	{
		image.color = Color.Lerp(start, endColor, currentTime / time);
		currentTime += Time.deltaTime;
		yield return null;
	}
	image.color = endColor;
	image.enabled = enabledWhenDone;
	currentFade = null;
}

With that, you can call Fade() with whichever color and fade time you happen to need, and the bool parameter lets you decide if the image should be turned off once the fade is complete (as in a fade to Clear).

e: fixed an error in the code

ApproachingInfinity fucked around with this message at 16:59 on Feb 8, 2016

Adbot
ADBOT LOVES YOU

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.
This weekend I got a lot of game dev time in while half-watching the superbowl, added some new features and cleaned up my code and stuff.

At one point decided I should refactor my player class into a state machine using an enum state rather than the current tree of conditions that it has. That'll be simpler to keep track of state and which actions are possible from any given position, right? Sounds great!

Well an hour later everything was broken, and I realized that it'd take a few more hours to sort everything and get it working as well as it did before with the new system...

git checkout HEAD~1 Player.java

git commit -a -m "I've made a huge mistake."

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Zaphod42 posted:

At one point decided I should refactor my player class into a state machine using an enum state rather than the current tree of conditions that it has. That'll be simpler to keep track of state and which actions are possible from any given position, right? Sounds great!

Well an hour later everything was broken, and I realized that it'd take a few more hours to sort everything and get it working as well as it did before with the new system...
Use the state pattern! It will bring peace to humankind.

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."
What I'm seeing is Canvas.BuildBatch which takes up (self) 3477 ms (although even the profiler can't handle the lags so I'm not sure it captured the right frame), and I've come upon this thread http://forum.unity3d.com/threads/why-does-canvas-buildbatch-happen-at-random-and-how-can-i-avoid-it-during-runtime.277966/ At the end there it says that the issue got fixed, but maybe not as related to me? Maybe since I'm changing the color of the whole screen it has to do a lot of checks and stuff? I don't know then how other people don't experience that with this fading script though.

Edit: No, I'm not the only one, and a guy is specifically mentioning the 5.2 update... so, I guess I'll disable the script for now.

supermikhail fucked around with this message at 19:54 on Feb 8, 2016

ApproachingInfinity
Sep 14, 2008
Yeah, that's pretty weird. I do fades almost exactly in that manner all the time and haven't ever had an issue like that before. Only difference is I use a tween library to control the image's color instead of a Coroutine, which would still cause the build batch stuff. What's in your UI, other than the fade image? Also, which version of Unity are you on, and what platform are you on? (If on OSX, try switching to OpenGL 2, their 4.0 renderer is still kind of busted)

Ultraviper
Jul 26, 2007

I won the 100th Concurrent WOL Jabber Award and All I Got Was This Lousy Title!
code:
	Image image = GetComponent<Image>();

	void FadeIn()
	{
		image.CrossFadeAlpha(0, 2, false);
	}

	void FadeOut()
	{
		image.CrossFadeAlpha(1, 2, false);
	}

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."
Okay, this, and also scaling the image to full screen in the editor instead of in code... Or rather, probably simply just the latter. I don't know why I didn't think of this sooner... Well, I know. Because it was one of many lines of code inherited from the original script, and now I've cut the bullshit down to just the two I need (with your help):

code:
    void Start()
    {
        image = GetComponent<UnityEngine.UI.Image>();
        image.CrossFadeAlpha(0, fadeSpeed, false);
    }
I think I should set the canvas scaler to "Scale with Screen Size" and "Expand" now?

nolen
Apr 4, 2004

butts.
It's late and my brain doesn't want to math properly.

Given this lovely diagram:



where:

x = some value
y = x/3
z = some other value between 0 and x, inclusive


How in the fart can I round z UP to the nearest y?

Using the diagram as an example, z would be rounded up to 3y. If you were to reduce z by let's say half, you would round it up to 2y, and so forth.

Praseodymi
Aug 26, 2010

ceiling(z/y)*y?

From Earth
Oct 21, 2005

Divide Z by X, multiply by three, round up, multiply by Y?
E: Clamp the value to 1-3 after rounding up to deal with edge cases.

From Earth fucked around with this message at 08:45 on Feb 9, 2016

pseudorandom name
May 6, 2007

Well, now we know why Amazon gave a pile of money to CryTek.

Tres Burritos
Sep 3, 2009

The AWS and Twitch integration seems attractive.

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

pseudorandom name posted:

Well, now we know why Amazon gave a pile of money to CryTek.
For those that missed it: http://gamasutra.com/view/news/265425/Amazon_launches_new_free_highquality_game_engine_Lumberyard.php

BlueKingBar
Jan 25, 2016

Hey guys let's just literally never talk to me again maybe that'll fix things

It's free... money-wise. If you make an online game you either have to be filthy rich or sell your soul to Amazon. Cool.

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
So Amazon released an engine that can't even deploy to their own devices? :waycool:

BlueKingBar
Jan 25, 2016

Hey guys let's just literally never talk to me again maybe that'll fix things
Also what the gently caress kind of name is "Lumberyard"? The last thing I want to think of when I'm considering a game engine is one of those lovely redneck farmer stores like Home Depot or Fleet Farm.

xzzy
Mar 5, 2009

Doesn't seem any better or worse a name than "UE4" or "Unity."

At least Lumberyard will index well for search engines.

BlueKingBar
Jan 25, 2016

Hey guys let's just literally never talk to me again maybe that'll fix things

xzzy posted:

Doesn't seem any better or worse a name than "UE4" or "Unity."

At least Lumberyard will index well for search engines.

If I Google search UE4 I guarantee you I'm going to get nothing but the game engine. Unity's such an infrequently used word otherwise that it's the same poo poo. If I Google Lumberyard I'll get 9 pages about actual lumberyards and one about the game engine.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Lumberyard better at least have exceptional logs.

pseudorandom name
May 6, 2007

So if you use Lumberyard, most of SteamWorks is verboten.

And I guess you can't use it on the Xbox One either, since every game implicitly uses Xbox Live's cloud storage.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?
Hooooooly jeebus is that a tempting offer.

But. I mean I face-plant into dumb poo poo in UE4 on a daily basis, and that's an engine that's (technically) been out for years. I'm trying to imagine the epic shitshow that Lumberyard is going to be, for the next few years. Still. Heck of an offer. It's even full source. :love:

I'm really wondering how Unity is going to compete, long term. They're going to have to up their game substantially.

Wolfsbane
Jul 29, 2009

What time is it, Eccles?

BlueKingBar posted:

It's free... money-wise. If you make an online game you either have to be filthy rich or sell your soul to Amazon. Cool.

I don't know, it doesn't seem too bad compared to other hosting solutions for MMO games:

http://aws.amazon.com/gamelift/pricing/ (scroll down to the examples)

~$6k a month for a game with 10,000 daily users sounds cheap to me, I would have estimated more around $10k. That said, it's many years since I was involved with AAA stuff. It's certainly aimed at medium-large studios though, this isn't an indie product (unless you make non-networked games, in which case it's amazing).

BlueKingBar posted:

If I Google search UE4 I guarantee you I'm going to get nothing but the game engine. Unity's such an infrequently used word otherwise that it's the same poo poo. If I Google Lumberyard I'll get 9 pages about actual lumberyards and one about the game engine.

That's true now, but a few years ago any search for unity would be full of this poo poo.

pseudorandom name posted:

I guess you can't use it on the Xbox One either, since every game implicitly uses Xbox Live's cloud storage.
Where are you getting that from? They're heavily pushing XBone compatibility, so I imagine they've worked something out with Microsoft.

Rocko Bonaparte posted:

Lumberyard better at least have exceptional logs.

:golfclap:

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

Rocko Bonaparte posted:

Lumberyard better at least have exceptional logs.

:lol:

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
Has Crytek announced anything since they said they were basically going under and then Amazon gave them a sack full of cash for this engine license? That was almost a year ago and Ryse was the last thing they did.

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!

Wolfsbane posted:

~$6k a month for a game with 10,000 daily users sounds cheap to me
Sounds terrible to me, but I guess it's okay if you're doing the niche MMO style thing with server-side physics or something crazy like that. For anything else, why not spin up local servers on the clients. Pretty sure battle.net back in the day could have run on a single Pentium server that you could get better than for about $20 a month today. Hell, *I* have a game that at its peak had over 50000 daily users, lovely MMO-style, that runs on a $20/mo virtual server, and it's not even remotely optimized because I never needed to. Admittedly the player-actions-per-second in my game is typically low, but 10000 daily users is just really not very much. You could build that on an IRC server.

Maybe it's worth $6k a month not to have to think about it.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I might as well post something more interesting with less puns. Regarding this:


I figured out that most all the defects--other than the porch needing a clear obstacle blocks--comes from how I'm gauging valid spaces. I fire a ray down in the middle of each grid square, and then branch off from there. There are two issues:
1. When the downray hits the top of a cabinet, it thinks it's clear.
2. When the downray hit a diagonal wall, it ends up on top of it since the ray hits dead center on top of the wall. So it thinks there's a valid route there.

In the short term, I will probably just fire more rays in adjacent squares to verify heights and topology. I'm just precalculating on my PC, after all. However, the map data this algorithm is filling up actually has some stuff in it for handling heights and platforms, so I will eventually fill that up too. I'm mostly thinking out loud for posterity, and also hoping somebody will call me out if I'm being real dumb. It seems excessive for me, but I went for this "thin wall" tile-based layout originally, so I brought it upon myself.

xgalaxy
Jan 27, 2004
i write code
They are hyping up the Twitch support but I don't really see how that is a feature I'd want in a game engine.

Any Twitch streamer worth their salt isn't going to be using in-game Twitch integration at all. They use OBS or similar software that lets them setup different "scenes" for different game and web cam layouts, interstitials, and community written plugins, etc, etc.

Besides, Unreal also has Twitch support as well. Lumberyard is hardly the first.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Rocko Bonaparte posted:

I might as well post something more interesting with less puns. Regarding this:


I figured out that most all the defects--other than the porch needing a clear obstacle blocks--comes from how I'm gauging valid spaces. I fire a ray down in the middle of each grid square, and then branch off from there. There are two issues:
1. When the downray hits the top of a cabinet, it thinks it's clear.
2. When the downray hit a diagonal wall, it ends up on top of it since the ray hits dead center on top of the wall. So it thinks there's a valid route there.

In the short term, I will probably just fire more rays in adjacent squares to verify heights and topology. I'm just precalculating on my PC, after all. However, the map data this algorithm is filling up actually has some stuff in it for handling heights and platforms, so I will eventually fill that up too. I'm mostly thinking out loud for posterity, and also hoping somebody will call me out if I'm being real dumb. It seems excessive for me, but I went for this "thin wall" tile-based layout originally, so I brought it upon myself.

What exactly is it you're trying to do here? Just generate a navmesh for your scene? The way you're going about it seems extremely finicky and error prone. If your scenes aren't procedurally generated (and it looks like they aren't) then maybe it would be easier to just design the navmesh by hand no?

Xerophyte
Mar 17, 2008

This space intentionally left blank

xgalaxy posted:

They are hyping up the Twitch support but I don't really see how that is a feature I'd want in a game engine.

Any Twitch streamer worth their salt isn't going to be using in-game Twitch integration at all. They use OBS or similar software that lets them setup different "scenes" for different game and web cam layouts, interstitials, and community written plugins, etc, etc.

Besides, Unreal also has Twitch support as well. Lumberyard is hardly the first.

I got the impression that it was more for the twitch-to-game than the game-to-twitch. People would be streaming and their viewers would be able to directly control the experience: vote for characters and maps, directly spawn enemies or objects, etc.

This will of course devolve until someone makes a game where the only way to get the best loot is to subscribe to the most popular streamer of that game and eventually we end up in Fifteen Million Merits. Twitch-plays-you could be used well in a game before society ends, though.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

HappyHippo posted:

What exactly is it you're trying to do here? Just generate a navmesh for your scene? The way you're going about it seems extremely finicky and error prone. If your scenes aren't procedurally generated (and it looks like they aren't) then maybe it would be easier to just design the navmesh by hand no?
I was originally making a map editor, but I didn't think I could keep up with the level of tool capability I wanted to make it well. So I used ProBuilder to design the levels, while honoring some conventions for grid sizes. I then decided to have something make an initial scan of the level to generate navigation data. I think I'll eventually reuse the map editing code to manually tweak the navigation mesh, but I still think getting a semi-accurate starting grid will help me out. For the little bit of level I am showing, I could just manually edit it, but I expect to make much larger stuff.

nolen
Apr 4, 2004

butts.

Praseodymi posted:

ceiling(z/y)*y?

This was perfect. THANK YOU.

Lork
Oct 15, 2007
Sticks to clorf
A while back I received a newsletter from AIGameDev which contained the following:

quote:

One of the big trends of the year from our perspective has been "Letting Go"; from old practices and techniques that don't work anymore (who thought huge animation graphs were a good idea?), descriptions and terms that no longer apply (we stopped using the words "Game AI" as it became overloaded), to levels of control that are not sustainable (everything is becoming more systemic and procedural). Things are moving forward whether we're ready or not, so get ready for the transition!

As someone working on a game that features what is by my estimation a huge animation graph (care of Unity's Mecanim) used by both the player and AI, this seems relevant to my interests. I can't find anything about it in my searches though, so I put the question to you guys: What's wrong with big animation graphs? I get that they can become a bit unwieldy when you want to change something and have to redo all the transitions, but what's the alternative?

Quaternion Cat
Feb 19, 2011

Affeline Space

nolen posted:

This was perfect. THANK YOU.



Hi, just wanted to say that this looks cool.

TheresaJayne
Jul 1, 2011

Rocko Bonaparte posted:

Lumberyard better at least have exceptional logs.

:rimshot: :suicide:

aerique
Jul 16, 2008
I asked this in the Making Games Megathread, but I actually thought I posted it here (which would have been a better place):

Does anyone have a link to / suggestion for a 3D model of a human, rigged and animated? And also free'ish (up to say $50). Low poly count is fine though.

Also, it must be something that can be used outside of Unity and UE4.

(I know I'm asking for a lot.)

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
For anybody following along at home with my pathfinding generation experiment: I really needed to also check the entire volume of each grid, rather than just fire rays everywhere. I'm not trying to put a grid over a completely arbitrary level. It's 2.5d, and walls go at the edges of each grid. However, I have some diagonal walls that foiled the generator, but a box test should fix it.

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."
I keep agonizing about how to serialize my stuff in Unity, partly due to my sketchy knowledge of C# and Unity. But basically, is their official tutorial (http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/persistence-data-saving-loading) the best way? To me, it has some kind of weird singleton which throws me off... And I wish the same thing were available in text form.

xzzy
Mar 5, 2009

I've become a huge sucker for yaml these days, I love the look of the files (they're super easy for a human to edit) and importers/exporters exist for just about every language. I'm sure Unity has one too. I know it does json as well, which is a reasonable alternative for serialization.

ShinAli
May 2, 2003

The Kid better watch his step.

supermikhail posted:

I keep agonizing about how to serialize my stuff in Unity, partly due to my sketchy knowledge of C# and Unity. But basically, is their official tutorial (http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/persistence-data-saving-loading) the best way? To me, it has some kind of weird singleton which throws me off... And I wish the same thing were available in text form.

If you're fine with singletons, sure. You would only have one game save loaded at a time so I don't particularly think a singleton is a bad idea for that. Depends on your general architecture I guess.

If you want to serialize it into text, just pick a format (XML, JSON, etc) and use that serializer. This is a pretty simple example of XML serialization. For any other format you'd have to google around, usually any C# solution would work since Unity has the .NET 2.0 framework.

EDIT: If you're talking about Unity's serialization, that's kind of another thing. This blog post is a pretty good look into it.

ShinAli fucked around with this message at 21:41 on Feb 10, 2016

Adbot
ADBOT LOVES YOU

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."
Oh, dear... So do I want Unity serialization or... C# serialization? I guess it's probably up to me.

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