False start

Posted: September 8, 2011 in Uncategorized

Unfortunately my time with Unity has come to an end for the foreseeable future, and thus I won’t get to finish the EVAC tutorial mentioned in my previous posts.

I’ll pick this blog back up when my priorities shift again.

So I got to the mediator portion of my framework and realized that I had no clue what the base view or GUI component type was. In actionscript 3, for example, the base view component in my mediator is IUIComponent, where event listeners can be added and the system can react to what the user does.

I read. I read a lot. I scoured MSDN and Unity forums and documentation, but was unable to determine what would be best for the mediator. This conundrum also reinforced my insecurity of this new domain. I have no idea how a game is written. Sure, I’ve done my own in my own way, and I wrote some back in school for class projects, also done our own way, but I don’t know what the best practices are for building a game, much less for the Unity technology.

In my pile of reading a ran across the EVAC city tutorial, created by a christian company and run by a couple of dudes from – Australia? Awesome!

I decided to just use the tutorial and write the C# code as I wanted. After finishing the tutorial, I eventually settled on creating an IEventDispatcher interface and whatever view component is used, whether that is a Unity GameObject or a Windows form – the framework won’t care as long as it implements the interface and dispatches events – YAY.

My next goal is to start over with the tutorial, but using the MVC architecture and just see how things feel.

So when I started this process, the first task was to figure out what tools I liked the best and the workflow between those tools. The first coding objective I chose was to port my LiteMvc framework to C# and use that as the basis for any applications being developed using the Unity compiler.

The one only thing I missed when I left the Microsoft programming world was visual studio, so hearing that unity has C# for one of their scripting frameworks was beautiful news. The trouble with that is that our entire shop uses Mac OS X, so after digging around and learning 4 different keyboard layouts, my development tool set and workflow is as follows:

1. Mac OS X
2. Virtual Box – open source
3. Licensed Win7 64 bit to install on the VB
4. VS2010 C# Express – No source control? Lame. Gotta add VS pro license to the list of tools to purchase
5. Unity3d on Mac
6. Mono develop on Mac
7. Maya – I don’t have it yet, but I’m sure that will be part of the overall package
8. Easy GUI or some other UI toolkit. The OnGUI stuff supposedly sucks and I’m not going to waste time dabbling in it.

Great. Now I’ve got the software, but how do I edit and compile code on my windows VB or edit and make changes using Unity on my Mac box where the changes are automatically reflected in both places?

1. Create a folder on your disk somewhere. Mine was ~Documents/workspace/Unity
2. Setup your virtual box to use that directory as a Shared Folder
3. Create a new Unity project.
4. Import an asset package that will include a StartupScript (Monobehaviour) and the LiteMvc dll. As long as the dll is in the Assets folder, it is automatically added to the list of project references when compiled – neat.
5. Create objects and scripts to your hearts content.
6. All C# script editing is done in Visual Studio on the windows VB

There are some gotchas that I’ve learned to deal with:

1. I need to load mono develop at least once to edit a script from unity. This will automatically create a visual studio project file that I can add to my LiteMvc solution. I try not to “Sync to MonoDevelop” or otherwise use the editor after the initial time for a project because the new lines that get added to the project file when saved on either platform are different. This causes VS on windows to run the project conversion wizard – annoying.
2. I have my LiteMvc source run post build commands to output the release dll to a folder that I will have packaged up for future unity projects.
3. I grabbed the UnityEditor.dll and UnityEngine.dll from my Unity install on Mac OSX and copied them to ~Documents/workspace/Unity/dlls/ directory and then referenced them in my MonoDevelop created Unity project on my windows box so I could compile the Unity project scripts on the windows machine.

Another really cool thing is after I make and save changes on the windows VB and then switch over to Unity on my Mac – it auto detects the file changes and runs the compiler, so I can tab over to windows, make a change, tab back and hit play and I know my changes are reflected when I run the project.

It may change in the future, but the workflow is manageable and easy to remember so far.

Man, it’s late

Posted: August 4, 2011 in I'm a newbie, Uncategorized

That seems to be the current theme since my company’s CTO announced the use of a new technology for a new product that is in development. I’ve spent the last two weeks awake until midnight or so getting myself refreshed on C# and bringing myself up to speed on Unity3D.

Since my programming background has always been in the domain of an Enterprise or Managed services for multiple enterprises, the coding methodologies used in a non-gaming industry just can’t be found here. Anytime you look for how to perform a task in unity, you mostly find answers for questions like “how to fill up a backpack with ammo?”, or “How do I adjust the velocity of my tank shell to get an arc?”. It’s interesting being back in a territory where you don’t even know the correct questions to ask.

All of the web applications that I’ve written uses an MVC architecture. I’m currently porting over my open source LiteMvc framework to C# and plan to publish soon. To be honest, I’ve already completed the port, but I’m not sure this architecture is the correct way to go in this environment. Should it be restricted to the GUI related views only? I simply do not know enough to say.

One area of interest that I have yet to dive into is the networking aspect of a multiplayer game. What are the current best practices of the industry for that? Do games like Starcraft 2 negotiate the game setup with the server, but the actual game runs peer to peer? Is that new, where their previous games ran peer to peer? What about MMO games, or any other genre for that matter. Just the basics for communication with a server – I’m not sure what’s best.

I’ve run across a bunch of great links and tutorials – the unity community really is awesome and I’m having a great time learning. The latest resource I’ve run across is 3DBuzz – These guys rock and their intro videos remind me of my audio commentary days for Warcraft III. Good times.