Author Topic: Unity development  (Read 6071 times)

Offline vordrax

  • Jr. Member
  • **
  • Posts: 67
Unity development
« on: July 21, 2011, 07:45:38 pm »
Since AI War was converted to Unity (at least, I think it was), I wanted to ask: are there any general tips regarding Unity any of the developers would have to share? Any common pitfalls or annoyances? Anything that you think is just awesome in a basket? How does it stand up as middleware for indie development, and would you recommend it over, say, UDK? Anything else you'd offer about your experiences would be helpful, as well.

Thanks.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Unity development
« Reply #1 on: July 21, 2011, 08:04:25 pm »
Well... that's a large topic. ;)

But, we're very happy with Unity, and I'd definitely recommend it.  UDK isn't really something we'd be interested in because it's focused solely on 3D.  Also, the price of that is crazy -- the royalty share would have cost us well into the six figures, whereas Unity cost us around $3k.  So it's no comparison.

When it comes to Unity, our goal was to be cross-platform, high-performance, still coding in C#, and lacking in prerequisites that have to be installed on the client before running the game.  In terms of being cross-platform and prerequisites-free Unity was a pure, unadulterated win.  In terms of still coding in C#, that was a huge win as well, although Mono does have some drawbacks: mostly in terms of RAM usage and a crappier GC (at the moment), which led to some pain for us for a while.  And an 800mb heap size limit, which was trouble for AI War off and on (fortunately, textures and things don't count as part of the heap).

When it comes to being high-performance, that's been a pretty even swap in the end.  For a while performance in Unity suffered some compared to our older solution in SlimDX.  But as we got more into the Unity side of things, and started replacing more and more of their engine-specific objects with our own stuff, we got around that.  Now performance is actually better in a lot of respects.  But it took a solid 3-4 months across Tidalis, then AI War, then even some AVWW to really get all those kinks ironed out.

My general advice, for anyone using Unity to do 2D:

1. Use sprite dictionaries, either through your own library or one of the ones available on the unity asset store.  Anything that keeps your number of draw calls down is a must.

2. If you need to draw a lot of lines or similar, use vectrosity.  No question about it.

3. If you can, avoid the GUI system of unity like the plague.  We use it, and I think Keith and I are both sorry we do.  There's a better version upcoming supposedly, and there are third party GUI systems on the unity asset store, though.  The reason for this is that it's kludgy and inefficient, and causes a lot of heap allocations it shouldn't.  Among other things.  Specifically avoid their GUI.window stuff, as it is the most prone to bugs.

4. If you're doing your own custom stuff and have a large number of objects you need to draw onscreen at once (hundreds), then I suggest forgoing GameObjects.  They are the cornerstone of normal Unity development, but we don't use them.  We have our own custom rendering call stack that uses DrawMesh.

5. If you've got a large 2D game with lots of stuff you need to dynamically load, you also don't want to use Unity's normal asset pipeline.  Instead you want a custom solution using their WWW class to read stuff asynchronously off your disk, and then you want to manage all that yourself in terms of what stays in memory and what gets unloaded, etc.

6. If you plan on porting your stuff easily to iPhone or similar, then probably you shouldn't do #5, and maybe not #4.  But on the PC and Mac, I couldn't imagine any other way of working with Unity.


In short, I think that it's a great engine, the best one around you can get, and the community support is generally above average for them, too.  Support direct from the company... I'd say it's somewhat below average, although they are reasonably fastidious.  Compared to other professional solutions for professional companies, anyway.  It's miles better than anything that's not professionally driven, with a few shining exceptions like SlimDX, which has tremendous support. 

BUT, as part of that original "in short" comment I strayed from, for our purposes Unity Pro is absolutely needed for its bare-metal access, and we wound up stripping the unity engine down to that bare metal.  We don't use their asset pipeline, their game objects, their physics, or their networking.  We DO use their bare-metal graphics capabilities (which are awesome), their input capabilities (also great), their camera system (also great), their audio system (really good), their shader system (REALLY good, but I wish documentation was better), and other miscellaneous stuff.

I have no intention of switching engines anytime in the foreseeable future, if that's any answer.  There are things I don't like about the engine, but that's going to be true no matter what.  And the pros vastly outweigh the cons for Arcen's specific purposes.  There's no other engine that comes close and that's cross platform and that's C# that is out there at the moment.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Cyborg

  • Master Member Mark III
  • *****
  • Posts: 1,957
Re: Unity development
« Reply #2 on: July 21, 2011, 08:07:58 pm »
annoyance: the memory limit, fake full-screen, I liked the old weapons effects and interface better, the audio system loading sound files all the time
best: I like the installer much better, I like the keyboard controls, some of the effects are better

suspicions: my multiplayer experience was better without unity, whether that is caused by something else I don't know, but I have my suspicions. some of the interface layout issues are kind of weird. The constant reading of random files… I don't know what is actually unity or just the results of porting, but there you have it.
« Last Edit: July 21, 2011, 08:10:30 pm by Cyborg »
Kahuna strategy guide:
http://www.arcengames.com/forums/index.php/topic,13369.0.html

Suggestions, bugs? Don't be lazy, give back:
http://www.arcengames.com/mantisbt/

Planetcracker. Believe it.

The stigma of hunger. http://wayw.re/Vi12BK

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Unity development
« Reply #3 on: July 21, 2011, 08:15:16 pm »
annoyance: the memory limit, fake full-screen, I liked the old weapons effects and interface better

The memory limit and the fake full-screen not being available are both unity.  The old weapon effects were entirely unrelated to Unity, we could have kept them exactly the same if we'd wanted to (we did not).  In terms of the interface, we probably could have come very close to a 1:1 duplication in most cases except for some things like the graphs, but again we did not want to (many people had problems with legibility with the old one, etc, and the old one also had some performance implications even on SlimDX).

best: I like the installer much better, I like the keyboard controls, some of the effects are better

The installer is actually to do with us using Bitrock instead of Advanced Installer, although the lack of prerequisites is thanks to Unity.  The keyboard mappings are mostly thanks to Unity, although actually in retrospect we could have done the same thing in SlimDX based on how we wound up doing it in the end.  And the other effects that are better are again unrelated to Unity.

suspicions: my multiplayer experience was better without unity, whether that is caused by something else I don't know, but I have my suspicions. some of the interface layout issues are kind of weird. The constant reading of random files… I don't know what is actually unity or just the results of porting, but there you have it.

I'm shocked that your multiplayer experience was better pre-unity.  It's incredibly worlds better now in general.  The performance profiles, etc, alone.  In terms of the network library itself, we're using the same one now as before Unity, so actual network quality would not have changed.  In terms of interface layout issues, I don't know what you're specifically referring to but I wouldn't think that was unity, I'd think it was just how we now choose to do it.

In terms of a "constant reading of random files," I'm not sure to what you're referring, but it's important for the game to stream in graphics as it needs them.  Oh, and I guess we are now streaming sound effects as they are needed, rather than storing them all in memory in triplicate and then using them direct-from-memory as needed.  That's improved sound quality and game load speed, although it does much increase disk io.  But it's asynchronous, so should not impact actual game performance at all.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline vordrax

  • Jr. Member
  • **
  • Posts: 67
Re: Unity development
« Reply #4 on: July 21, 2011, 10:34:48 pm »
Thank you for your words, Chris. They confirmed what I suspected, that it is indeed a quality platform. Myself and a couple of friends are looking into working on a simple 4X game, and we had looked into Unity before but weren't too sure. When I saw that AI War was done in Unity, I knew that it could be used to produce something quality.

Two of us (maybe three soon) are Computer Science majors, none of us are very familiar with C# or JavaScript but good with C++ (at least, as well as a student can be) which is cut from the same cloth. We have another who is a web developer, writer, and 3D artist. Then we have a friend who is working on his Masters in some kind of art (it's not coming to mind right now), but he's very good at creating 2D and 3D art, as well as music. It's not a lot, but I think it's enough for a very small game, at least as a learning experience. And certainly much more than the people I see making posts like "I'm looking for a team to help me make an awesome MMORPG, I've read some tutorials on C++ but might need help coding." It should be a fun experience, educational at the least.


EDIT: By the way, on a lark (not that I'm terribly interested in it at the moment) I checked to see what scripting languages work with Unity, and all I found was a while back someone failed to get Lua 2.0 working with it. You wouldn't happen to know, being a bigger member of their developer community, if this has progressed? And if not, are there possibilities for adding fair modding capabilities to a game created in Unity (beyond creating bindings for your own scripting language)?
« Last Edit: July 21, 2011, 10:37:50 pm by vordrax »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Unity development
« Reply #5 on: July 22, 2011, 06:29:56 am »
Honestly I don't think that c++ is a good language for developing in unless you are soon the ency crysis. I still remember when some developers felt you had to write the core of your game in asm instead of the newfangled c or c++. But the thing is computers had progressed to the point where working in the newfangled language was better because computers were plenty fast to run it, and the language reduced bugs, increased development speed, etc. Work in the language you prefer, but my view is that c++ shouldn't be seen as the default option unless you're wanting to transition into the aaa game studio realm.

In terms of lua in unity, I haven't looked into it. Bt given pincoke and similar are supported, plus the full mono runtime, I can't imagine it is impossible. There are a lot of novice programmers in the unity community, so when one gets caught up short unable to do something... don't take that as too much of a sign of feasibility. ;)
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Nalgas

  • Hero Member
  • *****
  • Posts: 680
Re: Unity development
« Reply #6 on: July 22, 2011, 08:54:25 am »
I very agree on C++.  I used to use it at work back in...1997?  Haven't really for a while unless I couldn't avoid it, though.  Yeah, it's changed a lot in the past decade, but there's just so much crap it's accumulated over the decades, both from being based on C, and from C++ itself having existed for so long, and from the various external libraries/frameworks you've had to use over the years just to make it usable, half of which have been practically consumed by the language to become part of it by this point...and despite including at least half a dozen kitchen sinks, it still doesn't have some of the conveniences of newer languages (or when it does have some way to add them, it's usually more awkward).

The good news is that if you're familiar with the concepts behind how stuff works, it doesn't really matter too much which language(s) you know, because you can pick up others a lot more easily.  Yeah, it'll still take some time to get used to some of the specific details, but overall it's a whole lot faster when you already know and understand what you want to do and just have to look up how to express that in Language X's syntax.  In other words, if your CS degree is worth a damn, or even if you just have a little motivation to fool around with it yourself, C# is not a big leap from C++.  Neither is Java, or Python, or...really it's usually not an issue unless you get into functional languages, but you're probably not going to be writing your game in Lisp.  Heh.

Also, considering how people seem to have a fondness for cramming Lua into just about everything, I'd be surprised if someone out there hasn't gotten it working with Unity...