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
coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Suspicious Dish posted:

And then you add CUDA-based physics that's nondeterministic. Or you change the player model so that the hitbox is slightly different. Now he's at 2,654 instead of 2,755. Is that a bug? Wait, I ran it again, and now he's at 2,650. Bug?

This is where the whole theory-oriented unit testing thing comes in. You come up with equivalence classes for the input and generate a random input from each equivalence class, then validate the output with tests like "Is the player model still above the ground?".

Another example would be some code I was writing recently to generate random convex polyhedra. The tests were along the lines of "Is Euler's formula satisfied?", "Does every edge have two distinct endpoints?", "Does any edge appear more than once?", "Does every face have as many vertices as edges?", etc.

Adbot
ADBOT LOVES YOU

Obsurveyor
Jan 10, 2003

Paniolo posted:

One more story I need to share about TDD.

A lot of new(and even experienced) TDDers mistake the purpose of their programming to be "make the tests pass/coverage complete" when it's supposed to be "make the program meet the requirements". The real issue had to do with the fundamental idiocy of their choice of dependency injection. You shouldn't ever manipulate your code to be more easily testable if it comes at the expense of the program itself.

This is why I like Behavior Driven Development a lot more. It makes you focus on what your customer wants not the naval gazing programmer stuff.

Paniolo
Oct 9, 2007

Heads will roll.
Any time you try to encapsulate the development process in some sort of acronymic dogma you're really just saying you don't think your hiring bar is high enough to let developers make sensible decisions about the best way to meet their goals, IMO.

a slime
Apr 11, 2005

I'm getting really frustrated with the Unity documentation. I want to change how some class variables show up in the inspector, and so I would like to find a list of classes that inherit from PropertyAttribute. This doesn't seem to be described anywhere, and literally the only thing I can find on Google at all is a couple of examples in a blog post from the Unity 4 beta from more than a year ago.

I literally cannot believe the don't even show an inheritance tree in the documentation

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

a slime posted:

I'm getting really frustrated with the Unity documentation. I want to change how some class variables show up in the inspector, and so I would like to find a list of classes that inherit from PropertyAttribute. This doesn't seem to be described anywhere, and literally the only thing I can find on Google at all is a couple of examples in a blog post from the Unity 4 beta from more than a year ago.

I literally cannot believe the don't even show an inheritance tree in the documentation

The Unity documentation is a piece of poo poo and you will often see pieces of code examples that are just doing things the worst way instead of, you know, using the built in Unity stuff. I can't tell you how many times I've seen obj.tag == "Thing" instead of obj.CompareTag("Thing")

xzzy
Mar 5, 2009

My MO is to hunt around in the Unity docs for a method that sounds like it does what I want to do, then google it on answers.unity3d.com to see what discussion there is about it. Works pretty well. :v:

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch

poemdexter posted:

The Unity documentation is a piece of poo poo and you will often see pieces of code examples that are just doing things the worst way instead of, you know, using the built in Unity stuff. I can't tell you how many times I've seen obj.tag == "Thing" instead of obj.CompareTag("Thing")

Welp I just learned something new.

HaB
Jan 5, 2001

What are the odds?

Paniolo posted:

Any time you try to encapsulate the development process in some sort of acronymic dogma you're really just saying you don't think your hiring bar is high enough to let developers make sensible decisions about the best way to meet their goals, IMO.

This. So much this.

I have done both regular and Agile. Agile works great IF you have 100% buy-in from EVERYONE involved. Guess how often that happens.

I'll give you a hint: dividing by it causes an error. NEVER.

DeathBySpoon
Dec 17, 2007

I got myself a paper clip!

the the posted:

Anyone else using libGDX for android game development?

The iOS build target (roboVM) is actually pretty good now. Once I had my environment setup I had my android game working in the iOS simulator in no time.

The only thing I had to change was the ogg sound files to mp3.

Yeah, I'm using LibGDX and really loving it. It's a fantastic library and gives me exactly what I need. I used to be a huge XNA guy, but I could definitely see myself using LibGDX from now on when I need anything to be multiplatform. My only complaint is the way they have the Y axis origin default to the bottom left instead of the top left. It's not too hard to switch it back, but still annoying.

Surprise T Rex
Apr 9, 2008

Dinosaur Gum
With things like Unity, etc. Can you build directly to iOS with no in-between Mac? I remember a while ago at college trying to port from the Torque engine to iOS, and an Apple computer was required then.

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
No, Unity just creates a project for you to open in Xcode which you'll need a Mac to then compile into something for iOS. That's an Apple limitation, not something Unity can do anything about.

Surprise T Rex
Apr 9, 2008

Dinosaur Gum

Yodzilla posted:

No, Unity just creates a project for you to open in Xcode which you'll need a Mac to then compile into something for iOS. That's an Apple limitation, not something Unity can do anything about.

Yeah, I figured as much, I was hoping that maybe Apple had relaxed a bit in recent years what with the rise of indie/mobile developers and port-to-multiplatform engines like Unity.

superh
Oct 10, 2007

Touching every treasure
There's stuff like Adobe Air that builds straight to the device without going through Xcode, but to be honest it's always a huge headache, when it works at all. Being able to tweak the unity built Xcode project as needed is very nice.

Flownerous
Apr 16, 2012

a slime posted:

I literally cannot believe the don't even show an inheritance tree in the documentation

Can you bring one up in MonoDevelop?

(Not trying to excuse Unity's pathetic documentation though)

MarsMattel
May 25, 2001

God, I've heard about those cults Ted. People dressing up in black and saying Our Lord's going to come back and save us all.
Edit: nm

a slime
Apr 11, 2005

Flownerous posted:

Can you bring one up in MonoDevelop?

(Not trying to excuse Unity's pathetic documentation though)

Is there a way to do that? I poked around MonoDevelop for a bit and didn't see anything like this, but I have never really used it before

Zizi
Jan 7, 2010

a slime posted:

I literally cannot believe the don't even show an inheritance tree in the documentation

Isn't that what the indentation in the class list long the left does? I mean, Unity doesn't have a ton of inheritance to start with. It's mostly a bunch of stuff derived from Component.

a slime
Apr 11, 2005

Zizi posted:

Isn't that what the indentation in the class list long the left does? I mean, Unity doesn't have a ton of inheritance to start with. It's mostly a bunch of stuff derived from Component.

That list doesn't seem to be exhaustive- I want classes derived from PropertyAttribute, which isn't listed in the left-hand side for any of the options in the dropdown.

edit: you can get what I want with this Google query, but that doesn't even return all of the few attributes that I know exist- PopupAttribute and CompactAttribute are both missing, and don't seem to be in the documentation at all :psyduck:

edit: that is because while they were mentioned in an official Unity tutorial blog they were never actually added to the engine aaaaaaa

a slime fucked around with this message at 19:17 on Jan 28, 2014

Obsurveyor
Jan 10, 2003

You could probably figure it out by using ILSpy on the DLLs to decompile into a Visual Studio project and then use that to determine the real inheritance tree.

xgalaxy
Jan 27, 2004
i write code
Pretty sure if you had Visual Studio it would give you a list of deriving classes. Not sure about MonoDevelop.

Edit: Another alternative:
code:
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
foreach (Type type in types)
{
    if (type.IsSubclassOf(typeof(PropertyAttribute)))
    {
        Debug.Log("Found:" + type.Name);
    }
}

xgalaxy fucked around with this message at 19:50 on Jan 28, 2014

Zizi
Jan 7, 2010
edit: actually, nevermind, I need to read better.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice
Unity_docs.png



:smithicide:

xgalaxy
Jan 27, 2004
i write code

poemdexter posted:

Unity_docs.png



:smithicide:

I love that they put all this effort into those video lessons on their learn site but still can't put together worthwhile written documentation.

Jewel
May 2, 2009



Weird, but understandable. At least it says it returns a double in the docs.



(I get why but don't say it returns an integral type if it doesn't at all.)

Jewel fucked around with this message at 05:11 on Jan 30, 2014

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

Jewel posted:

(I get why but don't say it returns an integral type if it doesn't at all.)

It doesn't say type, it says value

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

Jewel posted:


(I get why but don't say it returns an integral type if it doesn't at all.)
It's talking from a mathematical perspective, not a type.

Jewel
May 2, 2009

Why not say "returns a double representing the smallest integral value etc etc".

Edit: vvv Iunno I still think it should be saying it represents that value. It's not returning that value. It's returning the closest thing to that value that a double can store. Which isn't necessarily the same!

Jewel fucked around with this message at 05:20 on Jan 30, 2014

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
It literally says "Type: System.Double" right above your first circle. And then it says "The smallest integral value." Which is almost exactly what you are wanting it to say.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

Jewel posted:

It's returning the closest thing to that value that a double can store.

It doesn't do that though. It returns a double (this is the type) who's value is that of the nearest integer. Which is exactly what you would expect and what it says.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Jewel posted:

Why not say "returns a double representing the smallest integral value etc etc".

Edit: vvv Iunno I still think it should be saying it represents that value. It's not returning that value. It's returning the closest thing to that value that a double can store. Which isn't necessarily the same!

Floats and Doubles can represent integers exactly.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'
If you need an int that badly just use Mathf.CeilToInt and Mathf.FloorToInt

Above Our Own
Jun 24, 2009

by Shine

xgalaxy posted:

I love that they put all this effort into those video lessons on their learn site but still can't put together worthwhile written documentation.
Yeah they are atrocious but if you need documentation on a Ceil function...

Polo-Rican
Jul 4, 2004

emptyquote my posts or die
So, still learning Unity! It's really weird and interesting. It's astonishing how "hacky" so many things feel - if I read another sentence that begins with the words "Create an empty GameObject..." one more time I'm going to lose it!

Is it common to make a script file with a bunch of extremely common, shared variables - like isAnEnemy, hitpoints, etc - call it something like "variables," and embed that in almost every game object? So that, for example, if a bullet collides with an object, I'll know that the object contains a "variables" script that I can pull variables from?

It seems like I can solve a trillion problems easily using this method, but I don't want to start building Unity stuff in a way that other people would find insane, or that might cause performance issues.

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...
"Integral" does not mean "Integer", or "Integer Type". That's like complaining that a function is specified to return positive values, but that the return is signed instead of unsigned. It's an unfortunate ambiguity, but it's just as much the language's fault for appropriating a more general term.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Polo-Rican posted:

So, still learning Unity! It's really weird and interesting. It's astonishing how "hacky" so many things feel - if I read another sentence that begins with the words "Create an empty GameObject..." one more time I'm going to lose it!

Is it common to make a script file with a bunch of extremely common, shared variables - like isAnEnemy, hitpoints, etc - call it something like "variables," and embed that in almost every game object? So that, for example, if a bullet collides with an object, I'll know that the object contains a "variables" script that I can pull variables from?

It seems like I can solve a trillion problems easily using this method, but I don't want to start building Unity stuff in a way that other people would find insane, or that might cause performance issues.
I have a "soul" component, with a bunch of derived classes for specific types, that is pretty much exactly that. It holds state info and variables of universal importance (like hit points, max health, gender, etc). It also acts as a component that knows about a lot of other components, and I can request the AI / move / etc comp directly from it.. GetComponent() is relatively expensive, so avoiding calling that is a good idea if you can.

Polo-Rican
Jul 4, 2004

emptyquote my posts or die
Interesting, thanks! Instead of GetComponent, do you recommend I create a variable with type [script name], and then do the weird thing where I drag the script into the variable slot?

edit: forget it, that didn't make any sense!

Polo-Rican fucked around with this message at 16:13 on Jan 30, 2014

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'
Question about this thread: are we coding-only here, or is talking about game design cool? I've a nucleus of an idea but I'm not sure where to go with it and I wouldn't mind bouncing it around some.

Polo-Rican posted:

So, still learning Unity! It's really weird and interesting. It's astonishing how "hacky" so many things feel - if I read another sentence that begins with the words "Create an empty GameObject..." one more time I'm going to lose it!

Is it common to make a script file with a bunch of extremely common, shared variables - like isAnEnemy, hitpoints, etc - call it something like "variables," and embed that in almost every game object? So that, for example, if a bullet collides with an object, I'll know that the object contains a "variables" script that I can pull variables from?

It seems like I can solve a trillion problems easily using this method, but I don't want to start building Unity stuff in a way that other people would find insane, or that might cause performance issues.

Yeah, don't do that. Do what Shalinor said. Or, at the very, least have something like a "BulletCollider" script that the bullet calls (or, preferably, a ProjectileManager because you don't want bullets all over the place doing their own thing) on collision, and then the BulletCollider works internally to figure out what to do and call.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Polo-Rican posted:

Interesting, thanks! Instead of GetComponent, do you recommend I create a variable with type [script name], and then do the weird thing where I drag the script into the variable slot?

edit: forget it, that didn't make any sense!
That does actually make sense, and is exactly what you should do. It's annoying, but that's the "correct" way of letting a script access its neighbor components. That is precisely how I set up my soul component, for instance (and really everything else - I end up not using the soul as the exclusive component source at runtime, even if I probably should... so basically every component I have has a few public variables that I have to drag the object into, to get references to all the components it needs).

The RIGHT right way of doing it is to create an editor script, that runs in the background in editor mode, that snags references to any components you want silently. Make it auto-fill the variables, instead of you having to drag them across. It's just that it's freaking annoying to write that Editor script for every single component, so the manual drag method is what I mostly do.

It's one of the many things Unity could automate with a simple flag that you could use in your components :(

Shalinor fucked around with this message at 16:23 on Jan 30, 2014

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
Is GetComponent<T>() really so slow that that's necessary? Or is there some other disadvantage that I'm missing?

Adbot
ADBOT LOVES YOU

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

coffeetable posted:

Is GetComponent<T>() really so slow that that's necessary? Or is there some other disadvantage that I'm missing?

If you're calling it frequently, yes.

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