Arcen Games

Other => Game Development => Topic started by: DakaSha on November 18, 2010, 03:35:06 AM

Title: Unity 3D thoughts
Post by: DakaSha on November 18, 2010, 03:35:06 AM
I've decided that it may be a good idea for me too to switch to unity3D from the engine I am currently using (although I'm not sure about this yet) and thought this would be the perfect place to ask some questions about it seeing that it is neutral (as opposed to the unity forums) and arcen actually uses it in a full blown 2D game (I am not interested in 3D for now)

First off, if you get  a chance x4000, I guess unity is handling the "2D" rendering quite well (I'm aware it's most likely textures on a 2D plane in 3D space though, correct me if I'm wrong) but what did you do to get that to work so well? Is there anything I should be aware of? Or can I just do what Unity "wants me to do?"

Btw I havnt even done anything in it. I'm just reading about it and see there is a user made custom SpriteManager script available so I'm wondering why that is.

Has anybody else here used the engine?
Title: Re: Unity 3D thoughts
Post by: Vampyre on November 19, 2010, 09:56:09 AM
Hi DakaSha,

I've been using Unity3D myself... Not that I'm a game designer, but I like looking how things work... Unity3d had my curiosity, and I'm now learning how to use it.

Unity3D basically is made for 3D. But that's not really a problem, as you can totally forget about the Z axis. Example : all your object move along X and Y axis, are represented by a sprite... You just need to think how it makes sense to tweak 3D into 2D. For AI War, I'm pretty sure x4000 used a camera, moved it in the 3d space, and just allow zooming in or zooming out. All the rest is parallaxing.

You can build 2D games in a 3D environment (found a free tutorial about it in unity website). You can of course build 3D. I don't think Unity could limitate you to a precise style. There are games designed in Unity only with the GUI Design interface. Others are beautiful renders of 3d earth (realistic !). I'm not sure that's limitating.

On the contrary, Torque Game Builder (don't want to advertise here, but that's just for reference) is great with 2D, but will only do that. If later you want to create something like the tutorial in 2,5D, well, I think that's no way with TGB.

I think that it's better to use an engine who can do very much more than what you actually do, rather than beeing limitated by an engine for which you can't go further... It also avoids learning different languages ;-)

Unity is rather simple (I created a small ridiculous game in about 3 hours. Nothing fancy, just plain cubes, ball, and gravity, and it's not really complicated to learn). Of course programming skills are necessary, but it can be learnt, just as anything else :-)

Furthermore, Unity is free. So why not giving it a try, and see for yourself what it can do (lots of examples to download from unity website). Like that, you could compare with the engine you are using now :-)
Title: Re: Unity 3D thoughts
Post by: DakaSha on November 19, 2010, 10:50:15 AM
Yeah I've already started and quite like it so far. I'd be interested in knowing whether X4000 used the SpriteManager script available on the wiki :P
Title: Re: Unity 3D thoughts
Post by: x4000 on November 21, 2010, 10:13:50 AM
I started out with the SpriteManager script, but wound up going my own way.  I would suggest that the most effective way to render 2D stuff in Unity 3D is actually without GameObjects and instead with using the Graphics.DrawMesh.  It's actually super different from what Unity 3D would suggest, and is the only reason AI War is able to be run on it.  Tidalis uses more the standard methods, though, and certainly works fine.  So it depends how much you plan on doing on the screen at once, and whether or not you want to spring for Unity Pro.  But allocating and deallocating GameObjects is wicked slow, so do that as infrequently as possible no matter what.  And don't try to create more than a few thousand of those, heh.
Title: Re: Unity 3D thoughts
Post by: DakaSha on November 21, 2010, 12:19:54 PM
Hey thanks alot for the tips. Right now I'm obviously just getting the hang of it although its pretty easy after using multiple other engines and vanilla XNA.
I've always been a "2D guy" but the simplicity of this REALLY makes it hard to not try 3D stuff heh

Anyways thats why I posted here... To get an opinion by an unbiased developer who has actually used it to the fullest
Title: Re: Unity 3D thoughts
Post by: x4000 on November 22, 2010, 09:38:11 AM
My pleasure. I still have yet to try out the 3d stuff, I just haven't had time or inclination. Though I used to enjoy making levels for various 3d fps games.
Title: Re: Unity 3D thoughts
Post by: DakaSha on November 22, 2010, 11:14:42 AM
It is very nice to let ones creative side out. This is something I did after just a couple hours of experience (And possibly a mock up for a project I have planned) if anybody is at all intrested:

Terrible quality utube vid: http://www.youtube.com/watch?v=d7xe_1Yl_qY
Title: Re: Unity 3D thoughts
Post by: Vampyre on November 22, 2010, 03:04:14 PM
Impressive Dakasha ! Just a tip, if you don't like the way Youtube is a low rendering, just give a go to Vimeo ;-)

Talking about Unity, perhaps you could help me solving something out ? Basically, I'm not a 3D man. I've worked with different 2D engines (mainly free and open source) in the past, and since I have my mac, I was planning in having a better up-to-date engine... I wanted to go for Torque Game Builder, for its 2D interface, and mac compatible, but... as you might probably know (perhaps not), InstantAction.com, the mother company for Torque Engine, has stopped different occupation... So, for the moment, until someone buy Torque, that engine is dead. Manuals, which are online, might disappear at any moment. And furthermore, the support is gone...

So, I searched what was compatible with mac, and all I found was gamesalad (don't bother checking it, it's for kids... Even worse than gamemaker) and Unity.

Having not a wide choice, I'm starting learning Unity, and here is my problem :

Here is what I'm doing : as mentionned in the reference manual, I created a small basic GUI containing 1 button. 1 managed to solve out how to play with the customisation of the button. And that's all I have in my scene. Here comes the funny part. I've created a small test image (both in TIFF and BMP format). For the TIFF, it only has one layer, made of white. I've left the blue color from the background camera at its default, so I could spot easier the image.

I've imported it into a directory I had create called Resources. Once the image imported successfuly (I can see the image in the preview of the inspector when I select the file), I select the image, click on GameObject in the main menu, Create Other, GUI Texture.

When done, I can see a basic sphere in the scene view, and I have an new object created in the Hierarchy, named after my image.

That's exactly what the reference manual talks about. Unfortunately, when I launch the "game", I see my button customised, and only the standard blue.

Do you spot what I'm doing wrong ? Do I need to make a call in the script to call the image ?

Thanks a lot for helping, if you can :-)
Title: Re: Unity 3D thoughts
Post by: DakaSha on November 22, 2010, 04:29:01 PM
I could only guess that your texture is completely composed of 0 alpha pixels although I'm pretty sure bmp doesnt do that. Try creating a new gui texture without selecting your texture and see if the Unity symbol pops up. It all seems to work for me (and i followed your instructions becuase I've never done it before :P )

On 2D engines:

First off let me say this: Do not underestimate GameMaker. It is not a toy and is extremely powerful when using GML. Not only powerful but fast/efficient. It can do many things i have yet to see anybody do with XNA like fast dynamic shadows and lighting (although its def possible with XNA)
It has its faults but believe me it is a very good tool. It's particle system in particular is better then any other I've seen ;)

Now if you want a "real" engine then I cant stress FlatRedBall enough. Great engine.. The best support ever (literally), A code generator and editors, maintained by a guy who has done alot in the business (Including working for EA and he just ported SteamBirds to android.. )

Not only is it great overall but it has support for: PC, XBox360, Web(Silverlight), Windows Phone 7and in the next release even Android.

Its current state is a bit messed up due to the new platforms (2 new platforms in 3 months time) but once they iron the problems out (And believe me they will because the guy uses it for all of his personal work)  you will have quite possibly the best 2D engine around... It already was but as said some things got a bit crazy the last 3 months xD

Vic (the creator) is EXTREMLY helpful. Right now hes very busy on projects but when things cool down hes always available to help.

Its only real fault is the fact that that it is XNA based.. thats not too bad but it has its quirks (which x4000 actually has a blog post about) and the fact that it is (currently mind you ;) ) "only" a 2.5D engine


edit: you will need to know and have a good understanding of C# though

edit again: actually the XNA quirks dont really count to much because FRB has its own content pipeline :P
Title: Re: Unity 3D thoughts
Post by: Vampyre on November 22, 2010, 10:43:03 PM
Thanks for all the suggestions, I'm going to have a look at those... What surprises me with my problem in unity is that I can currently see my picture inside Unity when selecting the image, in the preview tab... Only it never comes on screen when I hit play... Weirdo... But I'll still have another try later today on this subject...

And I'm off course going to check FlatRedBall ;-) Hope it also works on the mac :p

Edit : Since there is no reply here, I edit, to avoid useless new posts. I found out that the problem was not within the graphics in itself. It may or may not have alpha on it to be displayed. But what I'm missing is a component to my camera : GUILayer, which is missing for the moment. If I don't have this component attached to my camera, I can't see the image. Sounds logical to me as I never called for the graphic to be displayed... I'm now hunting for the GUILayer component, because I didn't selected any package exception made of the standard assets.

For the engine, it seems that it is mac compatible, but the installer is windows only... Kinda weird, but looks impressive though... (btw, loved Steambird on the web :p)
Title: Re: Unity 3D thoughts
Post by: DakaSha on November 23, 2010, 10:24:17 AM
not mac compatible. It's written in XNA/.Net (As opposed to mono)

Didn't know you have a mac. Sorry :(
Title: Re: Unity 3D thoughts
Post by: Vampyre on November 23, 2010, 10:47:41 AM
Yeap, so... For the mac, I only have found Torque Game Builder (dead for now), GameMaker Mac, and Unity... :s

Edit : Finally found out the problem... I needed to activate GUILayer from the components tab in the camera view. Now it's rendering perfectly
Title: Re: Unity 3D thoughts
Post by: brett6golden on January 22, 2011, 05:57:34 AM
Unity3D is  of course good. Switch to it.
Title: Re: Unity 3D thoughts
Post by: Shrugging Khan on January 22, 2011, 09:22:31 AM
I've been jerking around with U3D for some months now, and I think it's time for me to finally learn a proper programming language.

Can you guys recommend boo (since it's python-esque, and therefore rather neat-looking) over C#? Or is C# simply the superior choice?
Title: Re: Unity 3D thoughts
Post by: x4000 on January 22, 2011, 10:58:17 AM
My biased feeling is that C# is the best general purpose language around, but of course I'm biased.  Have not used boo, but am not a particular fan of python or similar.
Title: Re: Unity 3D thoughts
Post by: Shrugging Khan on January 22, 2011, 11:24:10 AM
Can you give me a quick opinion on what makes C# so good? (Heavens, I sound like an advertiser!)

Also, I heard some people are a little discomforted because it belongs entirely to MS. Is that a problem?
Title: Re: Unity 3D thoughts
Post by: x4000 on January 22, 2011, 10:36:49 PM
C# is publicly defined, and does not belong to MS.  Only the .NET implementation does.  Unity uses the Mono implementation, which is 100% open source.

The short answer about why C# rock is: it's reasonably concise, it's strongly typed, it has sensibly named and robust libraries, it has very fast JIT compiling, it has generics, it has reflection, it has a very good OOP model, it has very sensible methods for things like abstract/virtual inheritance, it has excellent threading models and options, it has the ability to call unmanaged code through p/invoke, it has the ability to run raw c++-like data crunching when (hopefully rarely) needed, and various other benefits.

And for those who are used to C/Java like languages, it just "feels right," as well.
Title: Re: Unity 3D thoughts
Post by: RogueDeus on September 01, 2011, 03:07:51 PM
I started out with the SpriteManager script, but wound up going my own way.  I would suggest that the most effective way to render 2D stuff in Unity 3D is actually without GameObjects and instead with using the Graphics.DrawMesh.  It's actually super different from what Unity 3D would suggest, and is the only reason AI War is able to be run on it.  Tidalis uses more the standard methods, though, and certainly works fine.  So it depends how much you plan on doing on the screen at once, and whether or not you want to spring for Unity Pro.  But allocating and deallocating GameObjects is wicked slow, so do that as infrequently as possible no matter what.  And don't try to create more than a few thousand of those, heh.

Having started learning Unity3D this statement has me wondering... Are you speaking specifically in 'on screen' terms, or 'game wide' terms here? If I have 10,000 or 100,000 objects, but only ~1000 of them are on screen at any moment, does that still bog everything down as you say?

If it is an on screen problem, can it be addressed by simply reducing the number of draw calls?
Title: Re: Unity 3D thoughts
Post by: x4000 on September 01, 2011, 03:10:21 PM
Yes, it bogs that down that much simply by having them exist.
Title: Re: Unity 3D thoughts
Post by: RogueDeus on September 01, 2011, 03:41:47 PM
Yes, it bogs that down that much simply by having them exist.

If merely having 10,000 GameObjects in existence bogs the game down, is it possible to use a form of ring buffer that creates and destroys them on a schedule that keeps relevant objects in existence, and caches irrelevant ones until they are relevant again?

Does it matter how complex the GameObjects are?
Title: Re: Unity 3D thoughts
Post by: x4000 on September 01, 2011, 03:45:45 PM
You're asking the wrong guy; I was uncomfortable with GameObjects from the start.  They looked bloaty to me, and when I saw that it took a couple of seconds to even instantiate 10k objects, I was about done with them.  I was in fact using a ring buffer to use them, assigning simple textured quads to them as needed, and activating and deactivating them as I went.  This was with Unity 2.61, but it was wicked, wicked slow.

I now just use Graphics.DrawMeshNow, and instantiate my own general C# objects to represent the gameworld.  If you're not using unity physics or what have you anyway (which I wasn't), there's no reason to have all the overhead of the gameobjects.

But things have changed a lot since 2.61, and so what I said above may no longer be true.  3.0 made a lot of things faster.  I still have no personal use for GameObjects, though.
Title: Re: Unity 3D thoughts
Post by: RogueDeus on September 01, 2011, 03:52:51 PM
You're asking the wrong guy; I was uncomfortable with GameObjects from the start.  They looked bloaty to me, and when I saw that it took a couple of seconds to even instantiate 10k objects, I was about done with them.  I was in fact using a ring buffer to use them, assigning simple textured quads to them as needed, and activating and deactivating them as I went.  This was with Unity 2.61, but it was wicked, wicked slow.

I now just use Graphics.DrawMeshNow, and instantiate my own general C# objects to represent the gameworld.  If you're not using unity physics or what have you anyway (which I wasn't), there's no reason to have all the overhead of the gameobjects.

But things have changed a lot since 2.61, and so what I said above may no longer be true.  3.0 made a lot of things faster.  I still have no personal use for GameObjects, though.

Thank you VERY MUCH for clearing that up. You may have just saved me oodles of test time...

I am not as fluent a programmer as yourself but I too was looking at the way Unity used GameObjects and wondered if they may have been a problem. Especially after watching a few tutorials and how people go out of their way to reduce the number of new GameObject calls in scripts.

I hope you don't mind if I frequent this forum with Unity and C# questions! I am trying to learn as fast as I possibly can and I am finding it sometimes difficult due to my lack of experience and/or friends with similar interests. And there is only so much that StackOverflow and UnityAnswers can do for me in a pinch. :)
Title: Re: Unity 3D thoughts
Post by: x4000 on September 01, 2011, 03:55:55 PM
No worries, and glad I could help.  Oh, one thing to know: I don't think Graphics.DrawMeshNow works in Unity Indie, but I'm not sure.  I'm pretty sure you need Unity Pro for most of that.
Title: Re: Unity 3D thoughts
Post by: RogueDeus on September 01, 2011, 04:12:16 PM
No worries, and glad I could help.  Oh, one thing to know: I don't think Graphics.DrawMeshNow works in Unity Indie, but I'm not sure.  I'm pretty sure you need Unity Pro for most of that.

You are correct, I just checked. The Graphics class is restricted in use to Pro only.

That is a bummer. But not entirely unexpected. I knew that there had to be a reason that they gave the tool set for free. If you wish to make a game that actually works well for more then very small projects, you need to buy it. :) Not complaining. It is actually quite well planned. Learn for free, pay to develop.

Before I shell out 1.5K for the Pro version, I really must make sure I need it... Lots of work to do then.
Title: Re: Unity 3D thoughts
Post by: x4000 on September 01, 2011, 06:40:46 PM
Well, you're able to do quite a vast number of things with their base game: mainly make 3D games with a similar scale to other 3D FPS, racing, and so on games out there.  If you want to do something outside those bounds, then that gets into the more "bare metal" area, and thus into pro.