Contents
Integrating MaxScript and .NET Systems
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Lead World Designer
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [6]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Time Fcuk
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Integrating MaxScript and .NET Systems
by Shea McCombs, Kevin Rabun
7 comments
Share RSS
 
 
September 9, 2008 Article Start Page 1 of 5 Next
 

Every journey has a beginning, and for us, the journey of integrating 3DS Max and .NET tools began when a level editor needed to be built. The requirements for this new level editor, which became known as APPLE (Authoring Plugin for Placing Level Entities), were ambitious. Our level editor had to be platform-independent, genre-independent, and we had to have a functional system up and running in less than six months.

The requirements for this new level authoring tool were driven by the culture at Vicarious Visions. Vicarious Visions develops handheld and console games on a regular basis, and many of our level designers move between the various platforms. We wanted to provide a unified level tool for designers so they could move between projects without having to learn new applications.

Advertisement

We researched many possibilities for building a level construction tool, and this article will document what those options were and why we decided to move forward with a .NET/3DS Max hybrid solution.

Our goal is to demonstrate how .NET applications and 3DS Max can be integrated. We will also address issues encountered during the course of development and how those issues can be overcome. This article is intended to demonstrate how to integrate .NET applications and 3DS Max and provide perspective about when this solution is appropriate.


An overview of the data pipeline.

Level Editor Approaches

With the requirements and timeline set for our level construction tool, we now had to research how to achieve this new system.

The first option we considered was to build a standalone level editor tool from the ground up. This approach would allow us total control over the new application and give us the freedom to customize the user interface and subsystems to fit the needs of the designers and artists at Vicarious Visions.

Building a new application from scratch would have required time and engineering resources for building a rendering engine, user interface engine, file I/O and numerous supporting subsystems. After looking at the volume of work which would need to be done just to get a basic system off the ground, we concluded that an alternative needed to be found.

The artists and designers at Vicarious Visions are 3DS Max users, so we decided to research how to leverage the existing functionality of 3DS Max to create our level-building tool. The traditional solutions for adding new functionality to 3DS Max involve either writing plugins in C++ or using MaxScript. With the release of 3DS Max 9.0, there was a third option to consider when new behaviors and functionality needed to be added to 3DS Max -- .NET controls. We will go over why we chose this new solution of .NET integration, but first we need to examine what the .NET Framework is and how it works.


Image courtesy of codeguru.com

.NET Framework Overview

The .NET Framework is a software component provided by Microsoft to facilitate an end-to-end solution for application development. "End-to-end" means that an application developer can write code, build code, and execute code entirely within the .NET Framework using any of the supported .NET languages. The .NET Framework includes code libraries collectively known as the Base Class Library (BCL), packaged in managed .dll files called assemblies, that solve common programming tasks including: user interface, numeric algorithms, file I/O and XML document manipulation.

The runtime side of the .NET Framework is called the Common Language Runtime (CLR) and is responsible for compiling code on the fly with the Just-In-Time compiler, managing memory and handling exceptions. Programs developed in .NET languages are initially compiled into an intermediate language called Common Intermediate Language (CIL).

The CLR is responsible for compiling the intermediate language into native code when the code is first executed. The "just-in-time" compiling of intermediate code to native code means that wherever the .NET Framework is installed, a .NET program will be able to run, regardless of operating system or hardware configuration. Mono and Portable.NET are examples of implementations of the CLR other than the Microsoft .NET Framework which are capable of running .NET programs.

 
Article Start Page 1 of 5 Next
 
Comments

Klaus Drobec
profile image
As usual, I appreciate the quality of your feature articles very much. As a small point of critique: For articles with long code sections, could you please make an effort at formatting those to a more readable form. As I've seen blog software do this automatically, my guess is a large online offering such as yours has appropriate solutions at hand.
Much obliged.

Simon Carless
profile image
Klaus - looks to me that the main issue is the in-code comments overflowing lines on the code excerpt on Page 3, correct? Going to see if we can fix that, thanks.

Joel Martinez
profile image
"One of the key features of C# is that it is a reference-based language, and pointers do not exist."

This is actually not quite right :-)
http://msdn.microsoft.com/en-us/library/y31yhkeb(VS.80).aspx

Rune Braathen
profile image
Thank you very much for an informative article.

The .NET integration-features that have been introduced into MAX is a step in the right direction, but there are some shortcomings that may benefit from the act of being brought to the surface, in case someone out there were dancing a mazurka of joy, thinking they could throw out the MAX sdk come blue morning.

The ability to interface with MAX datatypes from the .NET assembly is practically nonexistant. As a result, shuffling large portions of data to the .NET-side therefore requires iterating the data. This e.g. hardens the possibilities of quickly performing a very common plugin task: munching geometry.

Hopefully, integration will become a bit tighter in the future, although I would rather prefer they put their weight on making MAXscript run faster.

Chaitanya Munjuluri
profile image
I made a level editor in 3DS Max 5/6 back in 2003/2004. We were using Renderware as middleware. There were two main components to the editor I had made. Level building and ai/gameplay related data. I used 3DS Max purely as a user interface and a nice render interface. Artists would export the models from 3DS Max to Renderware specific format and put all of these into a library. Levels were built by placing an art asset from the library. I would save the level to Rendeware's level format by refering only to the asset id (name). The ai/game play artists would build the path nodes and place gameplay data using 3ds Max nodes that I had built after deriving from the 3DS Max Dummy objects. All of the ai and gameplay data was stored in XML files (used Xerces to parse the data). Come to think of it the most difficult part of it was to import Renderware 3D mesh data into 3DS Max and displaying it as 3DS Max geometry.
I had such a bad time with making the UI for the tool. I could never make it as good as I would have liked.
IIRC Maxscript cannot access everything that's visible in the UI. For example I had issues with using the "loft" tool in Maxscript. Not sure if anything's changed now. I used Maxscript essentially for raising events and for the UI. The majority of the work was done in the 3DS Max Plugins.
Could you tell us something about the formats in which you had exported the data from 3DS Max?

Luke Rymarz
profile image
From the article:
"For some developers, integration with 3DS Max may mean rewriting thousands of lines of code within .NET, and each developer will need to assess how reasonable that would be to achieve."

I've been in positions where I needed to get a lot of old C code into C#. Lucky for me, it was in a DLL, and C# makes running DLL functions relatively easy with platform invoke. Microsoft has a tutorial at http://msdn.microsoft.com/en-us/library/aa288468.aspx.

You'll have to marshal data between the DLL and your C# code, but there ends up being about 10 basic types of marshals (string, array, pointers, etc etc), and once you've got a handle on them, building a class that will run all your DLL functions for you becomes pretty easy.

Anyways, just my two cents. With platform invoke, you'll still have to write a good bit of C# code, but you don't have to rewrite (and re-debug) the code that does most of the work.

Erwin Abdulrahman
profile image
thanks for sharing


none
 
Comment:
 


Submit Comment