Unity 3D
So I’m on the cusp of starting a project in Unity3D to build a game for one of our clients here at AKQA. Unfortunately I can’t go into any specifics of the project but what I am hoping to do is document my progress and any choices difficulties I have in building this thing.
For any readers (there aren’t many) that haven’t heard of Unity 3D it’s a Game engine and authoring tool that allows you to build and easily deploy 3D web/Mac/Windows and now even iPhone games. One caveat with building these games is that the authoring tool is Mac only. Not too much of a problem for me but still could be a barrier to a lot of people.
Needless to say this is completely new to me, the authoring tool, 3d games and the scripting that goes with it. Unity allows you to use 3 types of scripting, JavaScript, C# and boo. All of these languages get compiled down to IL so there is not much if any difference in speed once your games actually run.
So before the project starts obviously I’ve been through a few tutorials which mainly introduce me to the IDE and a few 3d gaming concepts. These have all gone pretty smoothly and so far I like the authoring tool. Unity is very asset centric. A lot of the game building is done in a visual way. All game elements derive from a single GameObject. Each of these GameObjects then can include any number of components. For instance you character GameObject could contain colliers so you can interact with the world around you, particle renderers, particle emitters, basically there is a ton of stuff built in which is just drag and drop with property panels to set values. This will (I hope) take a lot of the barriers away from initially learning to program and build 3D games. I would think a lot of these components would take a lot more work in a game engine like XNA. So although the IDE is unfamiliar it shouldn’t take to long to learn the fundamentals.
Scripting components (which are also dropped into GameObjects) are obviously an integral part of any game. The script can define actions and add essential functionality to games. Most of the tutorials using scripts are written in JavaScript. As far as I’m aware there’s no performance drop in using JavaScript over C# so JavaScript seems like an ideal route for someone with Flash and Actionscript experience. But… taking some time out to think about this I’m actually toying with the idea of using C#… so what the thinking with this is:
Cons:
- I’ve not done any C# before so there is a barrier here.
- Everything will probably initially take a little longer to code but hopefully become easier as the project progresses.
- I’m having to use an unknown IDE however this will probably be feature rich compare to unitron (the bundled script editor with Unity) that I’d use for JS.
Pros:
- I get to use a decent code editor. I’m going to try MonoDevelop but if that fails to be useful then I believe visual studio works a treat under parallels for unity projects.
- I get to learn a new language which should be highly useful for future work. C# is used for XNA which is where I hope my skills can be used in the future and even for future Silverlight work. C# is definitely going to become important for me so as I have an opportunity to use it why not.
- C# scripts in Unity seem to be written in an OOP manner (not that I’ve seen too much yet). I much prefer working with OOP where possible as I find it very intuitive to use and think in an OOP way.
- Browsing through the forums yesterday it seems most people use C#. I’m not one to just follow the crowd but if I get stuck at any point then the forum will probably be a safe bet for help. If I’m using C# there should be more people to help.
There are probably loads more pros and cons but to me the initial pain is probably going to be worth it in the long run. It should be beneficial for this project but certainly going forward in my career it will definitely be beneficial. I’m a little worried about time but seeing as it’s my decision I’m just going to have to invest the extra time if I need it. So I think C# it will have to be.
Hopefully I can do regular updates through the project so watch this space for more.
Processing: The Beginning
It’s been a while but I want to start blogging a bit more so I thought I’d start with a few recent projects I’ve been working on.
(6.4mb - may take a while)
I’m personally currently trying to learn how to get more out of OpenGL by using the GL Class directly. This is pretty hard core stuff and it’s certainly going to take a while to get my head round it. In the long run I’m hoping it will give me new ideas and add extra options with my experimentation as well as adding an extra string to my mediocre coding bow.
So garbage collection in AS3 is a big deal. If you’re planning to do any serious coding in AS3 it’s pretty important that you have a good understanding of how garbage collection in the flash player works. I’ve done a fair bit of research in this area myself and by far the best articles have been Grant Skinners series on the subject.
If you haven’t read them I suggest you give them a good going over.
If you have read them then you will understand that the garbage collector will remove objects in memory that no longer have any references to them. After reading a bit more into this I’ve found it very helpful to have some understanding of how the memory dynamics work under the hood of the flash player (and i believe how most, if not all, memory is managed in most modern languages).
Application data is arranged into two distinct components, the stack and the heap. The stack is where the program is run from. It’s faster and more expensive. When data is needed it is placed on the stack. For instance, when a specific function is called, all its variables are pushed into the stack. Once the function is complete and those variables are no longer needed they are popped out of the stack. All primitive types, i.e. uints, numbers, etc, that are created and initialised are placed directly into the stack until they are no longer needed where they will be de-allocated as and when that occurs.
The heap on the other hand is reserved for the storage of reusable objects. When an object is created, an instance of the object is stored in the heap. In addition to this, references to that object will be stored in the stack where references exist within the application. As described in the above paragraph, once a reference is not longer needed (it is out of scope) it will be removed from memory and out of the stack. The instance of the object could then no longer have any references to it and so may not be needed any more. Here’s where the garbage collector steps in and will sweep the heap looking for objects that no longer have any references to it within the stack. If there’s no references, it is not needed and so can be removed from memory.
This is just a high level explanation of what goes on and is by no means definitive. There are plenty of resources out there documenting how stacks and heaps work. I personally just found it useful as a bit of background knowledge in understanding the ins and out of memory allocation and garbage collection.
Compiled QT_FASTSTART.exe
Well after last weeks announcements regarding H.264 video I set about having a little look about at what was going on. Reading Tinic’s announcement I saw his link to qt-faststart.c. Thinking it would be easy to use I set about looking at how to use it. Not having any idea on anything c took me quite a while to figure out what the bloody hell I needed to do with it. Anyway i eventually got it compiled into a .exe to realise that I didn’t actually need it on the .mp4 files i was using to test with.
However… I do now have a working version of the .exe so for anyone else non-technical or lazy out there here’s the .exe file to stop you having to muck about with trying to compile the c version linked from Tinic’s site.
So here I am again…. Mr James Hay. I used to have a blog called vectorjunkie.co.uk which unfortunately I was too lazy to update regularly so it fell by the wayside. Since I joined AKQA I’m feeling the need to blog a bit more so thought I bet set one up and get writing again anyway.
For those that have never read anything from me before I’m a
www.fiat.co.uk - quite a big project overall but for the flash side there was a team of 4 of us. Was my first project at AKQA so was good to get thrown in at the deep end with this one.
www.inthehandsofthegods.com - More recently a project for this film. I loved this one and being the only developer it was a nice smallish project to get stuck into.
Anyway… that’s enough of the background stuff. Laters
Search
Recent entries
About
This is the about text


