From maxscript to C# OR C++?

Hi there,

I’m in a point where maxScript can’t reach some things in 3dsMax and need to move in the world of C++ or C#. I suppose that the easy/fast solution would be to go for C#. But I see that the industry works more with C++ so I’m thinking to start C++. What’s your opinion?

Regards,
Nick

from 3ds Max 2012 SAP and up: http://area.autodesk.com/blogs/chris/25-things-you-probably-didn039t-know-about-the-3ds-max-sdk
specifically the 1st point. you could access the dot net api through the dot net utilities of maxscript.

but beware that the whole dot net sdk is quite a mess still at this point. Hopefully Autodesk comes up with some major cleanup with 2014.

Thank you very much for your reply greuh. I have read this post from Christopher. My question wasn’t if C# is supported and in what level but more of I was asking an advice on what language do you think I should follow.

the facts are:

  1. C# is easier to learn.
  2. C++ is cross platform (if you use crossplatform libraries)
  3. Autodesk is trying to make 3dsMax available to other OSes.

So basically the question is can I avoid C++? If I learn C# will it be a limiting factor in the future and I would end up learning C++?

I’m currently using C#, but there are some limitations and depending what you need to do C++ is the best choice.

If you really want to learn one of 'em, try C++.

I found one very cool 10hours webcast at the Autodesk’s website ( direct download link of the webcast)…

I saw the first hour and my conclusion was that the C# is way more limited from what I had in mind… :confused: So, I suppose I’ll have to go for the C++

Thanks pedepano :slight_smile:

I have all videos of 3ds max (c++), was a MasterClass that Autodesk made last July. It’s really really good!

Yup, that’s the one I’ve shared! Seems really good but it’s a bit hard for me to find a good example of controller plugin (I didn’t had the time yet to check SDKs sample files). Even the Visual Studio Plugins Wizard doesn’t seem to have a template for it :confused:

on Autodesk’s C++ MasterClass, was 10 days of pure C++ programming, lots of examples and exercises. Also Autodesk made a new VS Plugin Wizard (fixing some bugs in the old one).
It’s a really good material and is very hard to learn. lol

If you’re interested, I can share via dropbox with you all content of the MasterClass.

See ya

This has been said before; avoid learning the language and the API/SDK simultaneously.

Just my 0.02.

It really depends on what you need to do.

C++ is more powerful and faster and hence better for actual game devopment. It’s also much more complex and manual, with lots of subtle ways to shoot yourself in the foot.

C# is a better tools development language – it has the big ol’ .Net libraries for common tasks, it’s easier to deploy ( less DLL hell) and it’s free of manual memory management (it’s a lot harder to bluescreen your machine in C#!) . FWIW it’s also cross platform, just use Mono.

Personally I avoid C++ because my job focuses on reliability and maintainability over maintenance. I just watched the engineers here spend three full days moving our codebase from Visual studio 2008 to visual studio 2010 ; watching a bunch of experienced guys wrestling with all the grunt involved made me grateful I don’t have to wrestle that particular beast. Yecch. It’s a great language for precise control over hardware – if you’re pushing the perf limits of your box, it’s the only game in town – but t its not very agile or well suited for rapid development.

Of course, if it’s plugins you want to write you don’t really have a choice…

[QUOTE=pedepano;18794]on Autodesk’s C++ MasterClass, was 10 days of pure C++ programming, lots of examples and exercises. Also Autodesk made a new VS Plugin Wizard (fixing some bugs in the old one).
It’s a really good material and is very hard to learn. lol

If you’re interested, I can share via dropbox with you all content of the MasterClass.

See ya[/QUOTE]

great… I wish I had known this before I figured it out all by myself :frowning:
Thanks for sharing the master class!

@pedepano, the videos thankfully are available through Autodesk’s website (I’ve shared the video before) but unfortunatelly they don’t share the other content. If you can share it that would be great! When you have the link, you can PM me. :smiley: Thanks!

@LoneWolf, I’ve searched the forum but I didn’t found a thread with a VS between C++ and C#. If there is one, I’m very sorry. Even though I have some tight deadlines atm, I’ve started a couple weeks ago to watch some tutorials from http://www.youtube.com/course?list=ECAE85DE8440AA6B83. When I have the time to write to some code and when I start feeling comfortable with C++ syntax, I’ll try to write a plugin. In terms of the API, I had a friend a while ago that was working on an exporter and he knew C++. He didn’t knew 3dsMax and with my MaxScript knowledge I was able to driving him, so I suppose it won’t be that hard for me to jump from MaxScript to SDK as soon as I learn C++.

@Theodox, thank you very much! I’ve searched mono yesterday and I figure out that it has some problems with external libraries and UI controls. It doesn’t work with WPF for example and stuff… but it seems the only way to crossplaform your C# code. Unfortunatelly I want to write a plugin. I want to write a transformation controller and neither MaxScript’s Scripted Plugins nor C# supports new classes. :confused:

@RobertKist , it’s uploaded to Autodesk’s site too… I’ve shared the link in a previous post.

I always used this site for c++ : http://www.cplusplus.com/

I started with the sdk a couple of weeks ago. I am not that good with it yet, but you can always ask questions.

If you learn C# you’ll be able to do more total because it is an easier language to use. If you learn C++ you may be able to do more exciting things but they’ll take longer.

As for “the industry”, very little tools dev is done in C++, it is almost entirely managed languages. Engine programming is done almost entirely in C++ but that’s probably not why you’re here.

Personally I never suggest anyone learn C++ unless they are working on something which they need to know C++ for. General tools development is not that. Maybe a Max plugin is but I doubt it.

IMO.

Here’s my take on the whole issue…

C++ definitely isn’t a core language for us, but I think it’s good to have someone on the team who knows it. If C++ is an option for you probably depends on what you do and which DCC packages you use. If you’re in a Maya shop you’ll probably encounter more C++ than C# and it might be the opposite if you’re in a Max shop. Personally I recommend C# for Max and C++ for Maya for people who want to move on from MXS or Python respectively.

At the core C/C++ is not a difficult language. You just need a command line compiler and a text editor and you’re ready to go. (confused about header files and such? The make code easier organizable and compilable, but they’re not a must at the beginning) You can make it more difficult by choosing an IDE-suite but then again if you’re a newbie to Python you probably don’t want to go through a full fledged Eclipse setup either. You can make C programming as difficult as you want, just like with any language. The more “pythonic” you write your code in Python the more confusing it will be for outsiders, and the same is true for C. The good thing is that C is very fast and we don’t really care for milliseconds like an engine programmer does, so even if we don’t fully optimize our C code and instead write it nicely and readable, it will be much faster than anything in e.g. Python.

If you want to learn C, then start with ANSI C, which will teach you the basics - data types, functions, arrays, memory management. Then move to C++ and get an overview how classes work (you can skip operator overloading and advanced stuff for now but look it up later when you’re more advanced). Then I really really recommend Qt. It shields you from C’s old fashioned default memory handling by giving you awesome convenience classes. At this point you can be productive, but keep learning about what’s going on behind the scenes (e.g. how C’s memory handling works). Not only will you encounter this sooner or later, but it will give you deeper understanding about the mechanisms you find in most other programming and scripting languages and some of their quirks may make sense after you learning how C deals with it.

It’s like being a Max/Maya user and when you first pick up e.g. “Akenine’s Real Time Rendering” book it suddenly makes sense why some stuff in Max or Maya behaves the way it does. It is the same when you learn C and then look at other languages.

What makes C++ difficult to read/learn is usually your environment - e.g. the OS, your UI framework, etc. This is just my opinion, but I find Windows UI code in C just a mess, whereas Qt code is really easy to read - actually you can often take C++ Qt code and port it right away to Python - it’s that esay.
Sure there’s some advanced concepts in C, like pointers, but they have - sometimes more limited, sometimes more elegant - equivalents in other languages.

How can you fit C++ in your pipeline as helper language?

  • Extend Python: use third party libraries and make them callable from Python. We took a maya IFF reader library and turned it into a Python module. We did the same with a library calling Hansoft and the same with a library that creates NTFS junctions.
  • Extend Photoshop: we use this to add new commands to Photoshop’s extendscript and now we can, for example, talk directly - no more COM - with it from other apps.
  • Extend ZBrush: same thing we did with Photoshop
  • Qt: We got tired of the huge memory footprint (and some packaging issues) of some py2exe programs. 4mb vs 34mb.
  • small CLI apps with no dependencies: use them for installers, pipelines, etc. Runs when there’s no Python, no NET framework, no Powershell or whatever helper that’s required. Totally failsafe.
  • Speed: especially loops tend to be really slow in Python. We have some crazy requirements from clients about UV shells, distance between UV points and whatever crazy things float their boat. Iterating through every vertex, face, UV point, etc is just much faster done in C.

Having said all this, if you come from Max, I’d say C# is the better choice :wink:

@Nysuatro, Thank you very much! Yep, that was one from the first sites I came across :slight_smile:
@Rob Galanakis, Thanks very much. The thing is that because I use dotNet through MXS, the only language that I can understand easily in the MSDNs examples, is C#!
@RobertKist, WOW thank you very much for taking the time to write all these things!

Does anybody know if I can create a transformation controller with C#? From what I’ve read you can’t but I’m such a newb with that stuff and I might understood something wrong :confused: