clyde

Amateur Game Making Night

Recommended Posts

man ain't nobody knows what a quaternion is

 

There is a fucking 300+ page book sitting on a coworkers desk called "understanding the quaternion". No one wants any of that shit. Thankfully unity provides you a bunch of methods to interact with them like Euler angles. From my understanding they're usually just used cause they're super fast.

 

DO NOT USE UNITY SCRIPT (what they for some reason call javascript). I mean you can use it, especially if you're working totally solo. However EVERYONE uses C# (also typed languages are fucking rad). So if you end up working with other people you're going to be seeing code written in C# basically all the time. 

Share this post


Link to post
Share on other sites

The book I'm using to learn Unity that I linked a couple pages back is teaching with UnityScript and giving the C# version of the code at the end of each chapter. The only real difference so far, to me, seems that C# is more particular and wants to be really specific about things. The code all looks pretty much the same though, just syntactically different, to the beginner (me).

Share this post


Link to post
Share on other sites

You're interfacing with the same API. You are correct at the begging level you're only going to notice syntax difference (typed versus untyped). Actually there might not be many functional differences now. You used to not get some of the datatypes (like generics) using unity script. I think you can get those now (you're just getting the .net version of them which is actually even stranger to me). I just think it's wise to go with the defacto standard. It's extremely jarring to have classes written in both lnguages IMO and using Unity Script will put you in the extreme minority.

Share this post


Link to post
Share on other sites

This is what i made tonight in gamemaker. The red boss is meant to move to the blue player, but instead moves to his health bar. hmmmm.

Also, in the background is my re-imagining of Mary Had A Little Lamb.
 

 

I probably should join that IRC channel to show off my amazing stuff.

Share this post


Link to post
Share on other sites

Gotta fix the dust kicking up in mid air :)

 

Yes, haven't added

 

 

if (inAir) dust = false;

 

yet. It's going in v0.3!

 

Also, if the car flips over, it can fly..

 

EDIT: FYI, Unity camera code, should go in FixedUpdate instead of Update. Got terribly shaky camera follow motion before doing that.

Share this post


Link to post
Share on other sites

I'm not sure if it's at pure 60. It runs in step with the physics system not the rendering system, I remember that being it's key component. It's generally used for physics operations. 

 

There's also LateUpdate, which is rad and few people seem to use! (but is kind of orthoginal to the conversation at hand...). I love Unity a whole lot :wub:

Share this post


Link to post
Share on other sites

iQIKjT0kBHJmT.gif

 

Dropped frames, but when you see the player or a red square disappear it's been shot by a yellow beam of death

Share this post


Link to post
Share on other sites

I just heard about this on the podcast and think it's really cool. I'd love to get to know some people who share the same passion and maybe collaborate and exchange experiences.

Share this post


Link to post
Share on other sites

I love that guy, he looks cool. He's got sweet rythms!  That's your rythm game, right?

Share this post


Link to post
Share on other sites

Yup! I have a shit ton of animations to do now, but at least that's the fun part. I have plans for different kinds of weapons, enemies who move on different divisions of the beat, and maybe some other stuff. I probably need to get more organized but this is hardly a massive project!

 

EDIT: Also welcome Gravedrinker!

Share this post


Link to post
Share on other sites

Gravedrinker is an incredible name. Although I'm scared it could be prophetic for me... You know drinking yourself into a grave and etc.

Share this post


Link to post
Share on other sites

DO NOT USE UNITY SCRIPT (what they for some reason call javascript). I mean you can use it, especially if you're working totally solo. However EVERYONE uses C# (also typed languages are fucking rad). So if you end up working with other people you're going to be seeing code written in C# basically all the time. 

 

Oh thank god I chose C# then. I've been learning Unity by working on a game with my friends (basically a remake of the old pc game Skyroads) and I didn't know what to choose. I was more familiar with C# but it looked like their documentation and a lot of tutorials used Javascript. I guess I chose wisely.

Share this post


Link to post
Share on other sites

EDIT: FYI, Unity camera code, should go in FixedUpdate instead of Update. Got terribly shaky camera follow motion before doing that.

 

I don't think this is correct. As long as you're accounting for the varying timestep in the Update method, i.e. use Time.deltaTime your camera movement should be smooth.

Share this post


Link to post
Share on other sites

I normally put my camera code in late update actually. Well if I'm tracking something that is. That way the camera will correctly track things that have been moved in the Update or in the FixedUpdate  functions. 

Share this post


Link to post
Share on other sites

Alright I figure this is as good a place as any to complain about Unity:

 

I have a piece of code that sets an object's rotation to a random 360 degree angle. I then need to find out if another object's rotation is +/- 10 degrees of the first object's rotation. The problem comes when Unity treats -10 degrees and 350 degrees as different values, because it just treats the angle as any other int. I understand WHY it does it, but it doesn't do it in the inspector and means I have to use a lot more code to accomplish the same thing.

Share this post


Link to post
Share on other sites

Try using a mod ( % ) operator. That way -10%360 = 350 and 350%360 = 350;

 

EDIT: I spoke too soon, this was true in chrome's address bar, but not in Unity. So here's a fixed code snippet:

 

(((number%360) + 360) % 360)

Makes number a positive integer between 0 and 359 inclusive. For example:

		int number = -370;
		Debug.Log(number + " equals angle " + (((number%360) + 360) % 360));
		number = -10;
		Debug.Log(number + " equals angle " + (((number%360) + 360) % 360));
		number = 350;
		Debug.Log(number + " equals angle " + (((number%360) + 360) % 360));
		number = 710;
		Debug.Log(number + " equals angle " + (((number%360) + 360) % 360));

Prints

-370 equals angle 350
-10 equals angle 350
350 equals angle 350
710 equals angle 350




Share this post


Link to post
Share on other sites

Modulo is a remainder operator for people wondering how that magic just happened.

Share this post


Link to post
Share on other sites

Finally read to the end of this thread! I'm a newer member to these here forums, but don't hold it against me. I've been dabbling around in Unity and Twine, trying to learn things. I'd love to join in in the Hangouts on Sunday and check out this thread everyday. I'm a Truck Driver, so won't be able to hang in IRC, except for most weekends, but would love to contribute what I can and learn more along the way! I'm still poking away at the Unity 3D platformer tutorial while formulating ideas in Twine and on the side, per Famous Vanaman's suggestions. I'd love to work on code or throw out some of my ideas in the Hangouts or here sometime wicha all!

Share this post


Link to post
Share on other sites

Also another related tip.  Unity uses a lot of floating point values, which are vulnerable to binary precision loss when operated on frequently.   Instead of comparing float values using == instead use Mathf.Aproximately(float a, float B)

 

while -10 degrees is absolutely the same thing a 350 degrees, you'll probably run into a lot of situations where 10.000000001 is not considered the same as 10.000000002

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now