Home Technical Talk

The Programming/Scripting MASTER THREAD

13
As the title suggests this thread is a place for the consolidation of programming and scripting knowledge on Polycount.

It isn't meant to compete with the Tech Artist - What are you working on thread, but rather compliment it in the same way that Technical Talk relates to Pimping and Previews.

Nor is it meant to compete with or dilute information from sites like Stack Overflow, Gamedev.net, TechArtists.org, and TigSource.

I see a lot of budding tech artists and indie developers on Polycount lately and I hope this thread can provide a comfortable place for anyone to ask for and get help on programming/scripting.

Most of us probably aren't formally trained software engineers, but maybe we can at least learn together and point each other in the right direction even if we don't have all the answers (because we don't!).

So feel free to post any questions, tutorials, links, on the subject of programming/scripting in this thread and I'll try to keep all that juicy info nicely organized in the next few posts.

Replies

  • Ben Apuna
    General Learning Resources:

    Where to start!?

    I personally recommend the following free online Stanford University course. Having gone through most of it I've learned quite a bit about programming.

    Programming Methodology, video lectures here, course materials here, free pre-press version of the textbook here, and the other textbook here.

    However if you'd rather learn Python for whatever reason then, there's also a similar course Introduction to Computer Science and Programming from MIT OpenCoursWare. The video lectures are here, and a digital copy of the book is available here.

    After either of those two courses you should be ready to rock and roll.

    Math

    You'll probably need to know some math once you get deeper into coding for graphics related things.

    Khan Academy - One stop shop for math. There are playlists for Trigonometry and Linear Algebra which are probably two of the more important types of math you'll need for the kinds of programming you might want to get into.

    Graphics Programming

    http://kesen.realtimerendering.com/
    http://advances.realtimerendering.com/
    http://renderwonk.com/publications/s...hading-course/
    http://www.crytek.com/cryengine/presentations
    http://publications.dice.se/
    http://www.bungie.net/inside/publications.aspx
    http://www.valvesoftware.com/publications.html
    http://developer.nvidia.com

    Game Programming

    Game Programming Patterns
    http://gameprogrammingpatterns.com/index.html

    General Development Topics

    http://altdevblogaday.com/
  • Ben Apuna
    Languages and Useful Libraries:

    A library for those wondering is just a fancy name for some code other people have written that you can use along with your own code to accomplish a specific task, such as making games.

    ActionScript 3 - link
    The language of Flash, great for web based indie games and as renderhjs has shown, cool tech art tools as well.

    Away3D - ActionScript 3 library for making 3D games.
    Flashpunk - ActionScript 3 library for making 2D games.
    Flixel - ActionScript 3 library for making 2D games.

    C# - link
    Used in Unity and XNA, also great for making tech art tools and programs.

    XNA - C# library for making games on Windows, Windows Phone 7, and XBox 360.
    SlimDX - SlimDX is a free open source framework that enables developers to easily build DirectX applications using .NET technologies such as C#, VB.NET, and IronPython.
    SharpDX - SharpDX is intended to be used as an alternative managed DirectX framework.

    C++
    Great for lots of things, really bad for beginners.

    Ogre - A 3D graphics engine using OpenGL. Can also be used with Python, Java, and .Net languages.
    SDL - A cross-platform multimedia library, Can also be used with .Net languages.
    SFML - Similar to SDL can also be used with Python and .Net languages.

    IronPython - link
    A version of Python that runs on .Net, useful for tech art tools/programs. Sadly you cannot use it with XNA to make games on the XBox 360.

    Java - link
    Not too popular as a indie game programming language, but you'll learn it if you went though that Stanford course I linked to in the above post.

    AndEngine - 2D game engine for Android.
    jMonkeyEngine - Java library for making 3D games.
    libgdx - Cross platform Android development library.
    Slick2D - Java library for making 2D games.

    Lua - link
    The scripting language of Cryengine 3 and many other game engines also used in Modo.

    Love - Lua library for making 2D games.
    LuaJIT 2 - Adds powerful functionality to call native C-functions (so that writing bindings often can be avoided) and to make use of native data structures.

    MaxScript - No official website!?
    The native scripting language of 3D Studio Max.

    Mel - link - (User Guide -> Scripting also under Technical Documentation -> PyMEL reference)
    The native scripting language of Maya.

    Python - link
    The most widespread scripting language for 3D apps, Max, Maya, Blender, Modo and Cinema4D.

    Cocos2D - Python library for making 2D games.
    Panda3D - Python library for making 3D games.
    Py3dsMax - Python for Max.
    PyGame - Python library for making 2D games.
    PyMel - Python library for Maya.

    UnrealScript - link
    The scripting language of UDK.

    Shader Languages

    Cg - link - Language Reference
    A free book by Nvidia "The Cg Tutorial" on the Cg shader language.

    HLSL - link - Programming Guide - Language Reference -
    Shader language for Direct3D.

    GLSL - link - Language Reference -
    Shader Language for OpenGL.

    Nvidia Shader Library - link -
    Many HLSL and CgFX shader samples.
  • Ben Apuna
    Applications, Tools, and Utilities:

    An IDE short for Integrated Development Environment for those wondering is just a fancy text editor that makes common programming tasks easier. They look pretty intimidating when you first open them up (I still get scared sometimes...). But with a few tutorials, blind experimentation, or RTFMing they become much easier to grok.

    Aptana Studio 3 - link - Python and others.
    Similar to Eclipse, comes with PyDev already installed.

    Code::Blocks - link - C++, (and others?)
    An open source alternative to Visual Studio C++ Express Edition.

    Eclipse - link - Java, C++, Python with PyDev.
    A very versatile IDE with can be used with many different languages.

    Estrela Editor - link - Lua, Cg, GLSL, HLSL, OpenCL.
    A mufti-purpose IDE for Lua, CG, GLSL, HLSL, OpenCL, and the Luxinia engine.

    FlashDevelop - link - ActionScript 3, and haXe.
    A great free ActionScript 3 IDE.

    IntelliJ IDEA - link - Java and related JVM languages.
    Free version, has nice code completion.

    MonoDevelop - link - C# (and others?)
    If for some reason you don't like Microsoft apps then this is the C# IDE for you. Ships standard with Unity.

    NetBeans - link - Java and others.
    Another popular Java IDE. Used with jMonkey Engine.

    Notepad++ - link - Many (All?) languages.
    More features than simple text editor and less complex than a full IDE. Perhaps a good app to start off with.

    Spyder - link - Python
    An IDE for Python, quite a bit more responsive than Eclipse/Aptana.

    TextWrangler (Mac) - link - Many languages.
    Looks like a notepad++ for Mac.

    Visual Studio Express Editions - link - C#, C++, and others.
    Free versions of Visual Studio, Microsoft's programming IDE.

    Visual Studio Integrated Shell - link - IronPython, IronRuby,and F#.
    Install this to get a nice Visual Studio IDE for IronPython, IronRuby, and F#.

    Wing - link - Python
    Non-free IDE for Python.

    FX Composer - link - Cg, HLSL
    IDE for Cg and HLSL shaders.

    Render Monkey - link - GLSL, HLSL
    IDE for GLSL and HLSL shaders.

    Shader Designer - link - GLSL
    IDE for GLSL shaders.

    ShaderFX - link - HLSL, Cg, CgFX
    Visual shader editor for 3dsMax.

    Mental Mill - link - GLSL, HLSL, CgFX
    Visual shader editor.

    ShaderFusion - link (Download though the Unity Asset Store) -
    Visual shader editor for Unity by commander_keen.

    Strumpy Shader Editor - link -
    Visual shader editor for Unity.
  • Ben Apuna
    Tutorials, Online Courses, and Books:

    General Topics

    Google Developer Channel - link -
    Lots of neat subjects covered here, code, business, and more.

    General Programming/Scripting

    MIT - 6.00 Introduction to Computer Science and Programming - link - video lectures - textbook -
    A great course to learn the basics. Language used Python.

    Stanford - CS106A - Programming Methodology - link - video lectures - course materials - textbook01 - textbook02 -
    A great course to learn the basics. Language used Java.

    Stanford - CS106B - Programming Abstractions - link - video lectures -
    This one is the course you'd take after CS106A which I linked to above. Language used C++.

    Khan Academy - Introduction to Programming and Computer Science - video lectures -
    Language used Python.

    MIT - Intro to Algorithms - link - video lectures -
    This one is fairly advanced.

    Game Development

    How do I make games? A Path to Game Development - link -
    One of the best "Where do I start" articles I've read.

    GameDev.net Articles - link -
    Tons of info on various subjects.

    TigSource Forums Tutorials - link -
    Many tutorials are here as well. One of my favorites is Vector Arithmetic For The Complete Novice.

    Flipcode Archive - link -
    Lot's of graphics programming articles.

    Sacred Software Tutorials - link -
    Vectors, Time-based animation, Quaternions, Matrices, Collisions

    GPU Gems 1 - link -

    GPU Gems 2 - link -

    GPU Gems 3 - link -

    SIGGRAPH 2010 Course: Physically-Based Shading Models in Film and Game Production - link -

    Mobile Development

    Stanford - iPhone Application Development - video lectures -

    Stanford - Developing Mobile Apps with Web Technologies - video lectures -

    Web Development

    Google I/O 2011: Building Game Development Tools with App Engine, GWT, and WebGL - link -

    Google I/O 2011: Kick-Ass Game Programming with Google Web Toolkit - link -

    GoogleTechTalks - Building a JavaScript-Based Game Engine for the Web - link -

    Application Specific Scripting

    MAXScript 101 - video lectures -
    A video-based introductory course for MAXScript

    UnrealScript Tutorials by Mougli - link -

    Math

    Khan Academy - link -
    Video lectures and problem exercises on beginner to advanced math topics.

    Vector Math for 3D Computer Graphics - link -

    Various Math Formulas for Games - link - link (updated ? re-post) -

    OpenGL - GLSL Tutorials

    Learning Modern 3D Graphics Programming - link -

    An intro to modern OpenGL - link -

    HLSL Tutorials

    HLSL Introduction - link -

    Crash Course in HLSL - link -

    Effects and HLSL Tutorials - link -

    SilverShader Introduction to Silverlight and WPF Pixel Shaders - link -

    Still much more to come as soon as I have time...
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 14
    Heya Ben, thanks for the links. The python one could be super useful for pyMel and more advanced rigging and Maya tools.
  • Ben Apuna
    Some alternatives to programming for those adverse to writing code that still want to make games:

    Antares Universe - link - Visual scripting for Unity.
    Blender Game Engine - link - Visual scripting with logic bricks.
    GameMaker - link - Create games for PC, Mac, iOS, and HTML5.
    Kismet - link - Visual scripting for UDK
    Kodu - link - A Microsoft project aimed at creating games through visual scripting. Non-commercial use only I think.
    Quest3D - link - 3D engine with visual scripting.
    Scratch - link - Similar to Kodu I think, by MIT.
    Scirra Construct - link - Create executables with v1, HTML5 with v2.
    Stencyl - link - Create Flash games for the web and iOS.
    uScript - link - Visual scripting for Unity.
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 11
    I'll start with what I posted in the indie thread. This is a Case statement (Sytax is C#). Comments in line. In this version I DID NOT use myNumber to get my initial random number. Instead, I put the random number generator inside the MathF function. I'll post more code for the PolyCount Pac Man as I go along. First task and the hardest for this is to get ghost moving through a maze towards the player. This bit of code will be the base for all of that.
    using UnityEngine;
    using System.Collections;
    
    // the class ghostMovement HAS TO BE THE SAME NAME AS THE FILE. So you name your file buttKiss, then this class
    //NEEDS TO BE buttKiss.
    
    public class ghostMovement : MonoBehaviour {
    	
    	int myNumber;
    	int Rounded;
    	
    
    	// Use this for initialization, like setting variables and ints. I set my numbers here, so when the "game"
    	//starts, I have the result of Rounded.
    	void Start () {
    	//This pics a random FLOAT between 0 and 4. Floats are numbers with fractions 
    	//things like 1.2 or 35.0000234, where as things like
    	// 1, 2, 3 and 3000404 are int or WHOLE NUMBERS.
    	myNumber = Random.Range(0,4);
    	//Now take this and make it an int by rounding to the nearest whole.
    	Rounded = Mathf.RoundToInt(Random.Range(0,4));
    	}
    	
    	// Update is called once per frame. You really don't want to use this for many things, it eats CPU cycles
    	//But for this demo, we will allow it.
    	void Update () 
    	{
    		
    		
    	//This little beauty is a CASE STATEMENT. It will be the "brains" of our ghosts. If it's this, do this, if it's that do this
    	//The options are finite so we will have total control. All this will do is handle being chased, and chasing.
    	//
    	//You see this switch(Rounded)? That Rounded is what will control the case options. switch is looking for a number
    	//and will only take the result of Rounded. Rounded was decided when the script first ran in the void Start().
    	switch(Rounded)
    	{
    		//Did the result of Rounded equal to 0?
        	case (0):Debug.Log("The number is zero!");
    			break;
    		//Did the result of Rounded equal to 1?
    		case (1):Debug.Log("The number is one!");
    			break;
    		//Did the result of Rounded equal to 2?
    		case (2):Debug.Log("The number is two!");
    			break;
    		//Did the result of Rounded equal to 3?
    		case (3):Debug.Log("The number is three!");
    			break;
    		//Did the result of Rounded equal to 4?
    		case (4):Debug.Log("The number is four!");
    		//These BREAKS stop the process of the case WITHIN this switch. Just know you need this, or it will toss an error.
            	break;
    
    	}
    	
    	}
    	
    
    	
    }
    
  • Ben Apuna
    Stanford University is going to be offering three free online courses this Fall in which you can actually participate and get a "statement of accomplishment" for completing them.

    The courses start on October 10th and last until early/mid December. Check out the following links for more info or to sign up.

    Introduction to Artificial Intelligence - Could be useful for the indie developers looking to code better AI.

    Machine Learning - Looks to go hand in hand with that AI course.

    Introduction to Databases - Could be useful for those that want to be on the asset management side of tech art.
  • Ben Apuna
    Cool stuff Lamont!

    I'm looking forward to seeing how Polycount Pac Man turns out. Sorry I can't offer much support atm as C# isn't a language I know (yet).
  • rooster
    Offline / Send Message
    rooster mod
    more visual editing:

    for unity:
    uScript - http://www.uscript.net/home/ -this is based on kismet's style
    antares universe - http://antares-universe.com/

    quest3d:
    www.quest3d.com

    PS- great thread idea!
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 11
    Ben Apuna wrote: »
    Cool stuff Lamont!

    I'm looking forward to seeing how Polycount Pac Man turns out. Sorry I can't offer much support atm as C# isn't a language I know (yet).
    Good thing you brought that up. What I want to do is show is that people CAN do psudo code and still be a BIG HELP. Code and ideas in any format can help.

    For instance, you want the ghost to turn around 180 when it hits a wall:

    If(You hit a wall in front of you)
    Turn around 180 deg.

    Also, I will toss in bad code and ask it to be fixed. The problem will be in the form of what was learned from the previous post/code snippet. This is to get people to see more than just what is there and pay attention to the compiler codes and research. When it's fixed, it will be posted. Code with a bad portion will be apparent as I'll do something like:

    FIX THIS CODE!! Something in here is keeping it from running!!
    void Update{
    Debug.Log(Why isn't this working?");
    }
    

    The answer would be that it's missing a quote bracket.
  • Lamont
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 15
    graphics related links
    http://kesen.realtimerendering.com/

    http://advances.realtimerendering.com/
    http://renderwonk.com/publications/s2010-shading-course/

    http://www.crytek.com/cryengine/presentations
    http://publications.dice.se/
    http://www.bungie.net/inside/publications.aspx
    http://www.valvesoftware.com/publications.html

    http://developer.nvidia.com

    must have blog
    http://altdevblogaday.com/

    Lua
    http://lua-users.org/lists/lua-l/
    http://lua-users.org/wiki/
    http://luajit.org/ LuaJIT 2 has a very powerful functionality to call native C-functions (so that writing bindings often can be avoided) and to make use of native data structures.

    Editor Lua/Shaders
    Estrela is an open-source editor written in Lua using wxLua which I maintain for both Lua and shader-related projects.
    http://www.luxinia.de/index.php/Estrela/Estrela
  • SpeCter
  • gilesruscoe
    Offline / Send Message
    gilesruscoe polycounter lvl 7
    Another one to add to the list of engines for those adverse to writing code is the Blender game engine, although very rough around the edges, it has a "logic block" based scripting system which is pretty handy for setting up the basic stuff.
    it's capable of doing some ok looking stuff, but i wouldn't suggest it for any serious projects :p
    [ame]
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Android Game Programming
    libgdx - really nice cross platform game library for android development. runs natively under windows, linux, mac OS, and Android. No more emulator needed :)

    [ame]



    AndEngine
    - 2D OpenGl engine for android.


    might want to add Wing to python IDEs
  • Ben Apuna
    Cheers guys, that's quite an onslaught of info! :)

    I've integrated most of it into the first few posts.

    I'm immediately wondering if most of this info would be better served on the wiki in a programming/scripting sub-section. That way the info can be maintained and updated by multiple people and I don't have to do all the work by myself. I'm worn out after just a few hours, lol! :poly136:

    Then the thread can stay a little more focused on discussions rather than random engine, library, IDE listings.

    Or maybe things will settle down for the most part once all the initial links are up.

    Or I could just update the various lists once and a while.

    What do you guys think?
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 11
    Am I missing something or is there a lack of c++ is the useful Libraries and languages post, this is like listing software companies and leaving out Microsoft. I hear by demand you update this asap :).
  • Ben Apuna
    Nah I just haven't added C++ or various other languages yet.

    Personally I'm not too sure how useful C++ will be for most of us either (potentially cool app plugins aside). It takes whole lot of effort to get halfway decent with C++ and for most of us just starting out with programming it's generally regarded as a poor language choice.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 15
    Surfa, I think the idea is not to turn this too much into full programming forum. As for wiki, Ben I am not sure that this wouldn't go too far. Imo tech-artists and alike are better place. A little "link" collection thread like this here should do for polycount.
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 11
    I suppose so but when working with images on a per pixel basis I found the built in garbage collection of c# can throw some hissy fits and just using c++ can provide a quicker result with less headaches. I guess this isn't really a problem it just takes a little more time to calculate some stuff.

    Anyway for the libraries:
    For someone who want to make the leap to something a little bit more low level (then xna) in c# there is slimdx http://slimdx.org/

    Also Ogre comes in with wrapper for .net python and java and can be found in the ogre wiki: http://www.ogre3d.org/tikiwiki/Alternative+Languages&structure=Libraries

    For 2d stuff I tend to use sfml but I have checked out there .net wrapper yet but I have heard good thing about it and sfml is really ease to use anyway.
    http://www.sfml-dev.org/download.php

    Also sdl has a .net wrapper which is great if you want to get into opengl and not have to worry about the set-up.
    http://cs-sdl.sourceforge.net/
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 10
    MEL and Python reference - http://download.autodesk.com/global/docs/maya2012/en_us/index.html (Under Technical Documentation. Commands is MEL)

    Dev C++ was a nice IDE for C++ - http://www.bloodshed.net/devcpp.html

    Thanks for this thread Ben.

    How many of you guys are enrolled for the Stanford courses?
  • Maph
    Offline / Send Message
    Maph polycounter lvl 8
    Surfa wrote: »
    Anyway for the libraries:
    For someone who want to make the leap to something a little bit more low level (then xna) in c# there is slimdx http://slimdx.org/

    This! Big fan of SlimDX myself, and SharpDX is quite promising as well. Although no support for D3D9 on the latter.
  • Ben Apuna
    CrazyButcher:

    I think you're right about wiki. Let's just keep this a nice list to get started with for now then. Definitely don't want to even think of taking the place of Tech-Artists.org or any of the other sites.

    Surfa:

    Nice set of libraries. I had heard of SlimDX but never looked into it, looks nice.

    haiddasalami:
    Thanks so much for the Maya documentation link. I've been a Modo user for so long I've completely lost touch with Maya and Max.

    You might want to be careful with DevC++ I've read that it's pretty outdated now. I've heard better choices are Visual C++ Express Edition and Code::Blocks.

    I've submitted my email to those Stanford courses. I'm just waiting to hear back from them. I hope I can somehow come up with the time to do all three.

    Maph:
    Cool!, I've never heard of SharpDX before.
  • Sandro
    This is a sweet thread, lots of useful stuff.

    It would be cool to see more learning resources about general programming, common practices, algorithms and math/trigonometry/physics related stuff, not necessarily particular engine/library or even programming language-specific. Seems like there are tons of libraries that deal with low-level mumbo-jumbo of putting sprites/images on screen, but you still need to code how they behave, which can vary from sorting swords in inventory to caclulating complex trajectories or buildig save/load system e.t.c
  • PeterK
    Offline / Send Message
    PeterK greentooth
    Can we make this a sticky ?
  • Maph
    Offline / Send Message
    Maph polycounter lvl 8
    Sandro: Indeed! And I couldn't agree more!

    I personally would love to talk about how you guys would handle GameStates, Data driven gameplay, and of course; vector math!
    The latter is very important for any dev working in games! And this is by far one of the best -and most well explained- lessons when dealing with vectors.
    http://chortle.ccsu.edu/vectorlessons/vectorIndex.html
  • UNCCheezy
  • Ben Apuna
    Sandro:

    That's the plan. I just haven't had enough time to put up everything I've got yet.

    UNCCheezy:

    I completely agree, www.tech-artists.org is definitely the place to go for purely hard core tech art information.

    I see this thread as more like a casual mix of indie game dev and tech art stuff mostly aimed at artists who might feel out of place on a programming board. More like a starting point of interest rather than authoritative source of information.
  • cw
    Offline / Send Message
    cw polycounter lvl 12
    maxscript questions I can try to help. I think it's good for people to not be afraid of maxscript, it can speed things up so much it is crazy, and make everyone's life easier. :D
  • SimonT
    Offline / Send Message
    SimonT interpolator
    Currently i work on an HTML5 Prototype within Aptana. Nice Tool but it annoys me that the function list a) can't simply show ONLY functions and b) the function list always collapses during writing some code.

    Has anyone a tip for me how to handle with that?
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 11
    Update to PolyCount man will be tonight my time. Next will go into MOVING the ghost object. Till then, think about and post what a typical Pac Man ghost does/can do and try to make psudo code.
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    cw wrote: »
    maxscript questions I can try to help. I think it's good for people to not be afraid of maxscript, it can speed things up so much it is crazy, and make everyone's life easier. :D

    Likewise, allways like to see folks asking about MXS here.

    Techwise for myself I've been learning JAVA/Android. I'm loving explicitly typed data. (what a nerd)
  • Ben Apuna
    @cw & r_fletch_r:

    It's great to see some MaxScript people popping in here to help. Are there any good links for the language reference or beginner tutorials? I don't have much to add to the list on MaxScript. There's a bunch of stuff on Tech-Artists wiki but nothing easily accessible for beginners.

    @SimonT:

    Sorry I can't help with Aptana. I only used if for a short time while learning Python. I did like the dark themes though. You might want to look up help for that issue under Eclipse since Aptana is a rebuild of Eclipse there's probably more info out there for Eclipse.

    @Lamont:

    How closely did you want to follow the actual AI of the original Pac Man? There is a pretty cool article about it on Gamasutra - The Pac-Man Dossier.
  • SpeCter
    Offline / Send Message
    SpeCter polycounter lvl 11
    The best thing you can do about maxscript is going through the tutorials and stuff inside max.Furthermore reading some other maxscripts(unencrypted ones of course).

    Wasn´t it our very own MoP who made a little tutorial for the beginners?
    I can´t forget what he said there... This is the listener, this can be fun.Pink is for watching , white makes things run!
  • Eric Chadwick
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 10
    Heres another Intro to Maxscript

    MAXScript 101 by John Wainwright

    EDIT: Whoops see this was already added.
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    SpeCter wrote: »
    The best thing you can do about maxscript is going through the tutorials and stuff inside max.Furthermore reading some other maxscripts(unencrypted ones of course).

    Wasn´t it our very own MoP who made a little tutorial for the beginners?
    I can´t forget what he said there... This is the listener, this can be fun.Pink is for watching , white makes things run!

    that was Vig :)
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 8
    <- will be watching this thread
  • Lamont
  • SpeCter
    Offline / Send Message
    SpeCter polycounter lvl 11
    r_fletch_r wrote: »
    that was Vig :)

    Ah right it was Vig , my bad!:poly136:
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    cptSwing wrote: »
    <- will be watching this thread

    *ask Questions*
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 11
    So after some reading and discovering that they DO in fact use a beacon system for Pac Man this is what my code will look like for the ghost:

    Stored value for turning left
    Stored value for turning right
    //These will only lock rotations to 90 deg intervals
    // Following the doc on the listed page create 3 states for the ghost AI

    Following the beacon system will use mono to make a manager for the world. The manger will know where the ghosts, player and beacons are. When the ghost reaches a beacon, it will ask where is the player, then decide which way to turn.

    The Beacons.

    The beacons will send a message and have a debug mode to show which directions it can send the ghost in (using Debug.DrawRay). The beacon is activated y a proximity to make sure the ghosts don't miss a turn.

    First stage is to get the beacon system planned out. Second stage is to get the ghost moving through the world using the beacons.
  • igi
    Offline / Send Message
    igi polycounter lvl 11
    For me the timing couldn't be better.I've searched for Ben Apuna's informative posts for the programming info and I've found that thread,just great.I'll be contibute to the thread whenever I'm able to do something higher level then just write a word on a screen..
    Great thread for sure.
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 8
    r_fletch_r wrote: »
    *ask Questions*


    unfortunately i have way too much other art-related stuff to get the hang of before i seriously dive into programming.. goddamn these 24 hour days..

    i will however take this opportunity to paste a couple of my hackjob maxscripts here, i'm sure you guys have some pointers on how to make them more efficient.

    this script i pieced together when i discovered that the panel-toggle script i had been using (http://www.scriptspot.com/3ds-max/scripts/toggle-time-command-panels) refused to work in max 2012
    macroScript toggleLowerPanels
     category:"MyScripts" 
     toolTip:"Toggle Time-, Status-, and Trackbar" 
     buttonText:"Toggle Lower Panels"
    (
     local allToggled
     
     if (trackbar.visible == true or StatusPanel.visible == true or timeSlider.isVisible()) then
     (
      allToggled = false
     )
     
     
     if (allToggled == false) then
     (
      local val = timeSlider.isVisible()
      timeSlider.setVisible(false)
      StatusPanel.visible = false
      trackbar.visible = false
      allToggled = true
     )
     else 
     (
      timeSlider.setVisible(true)
      StatusPanel.visible = true
      trackbar.visible = true
      allToggled = false
     )
    )
    


    and this one is a similarl hackjob to enable the element mode toggle in the UV editor, another function i could not get to work in 2012
    macroScript toggleelementmode category:"Unwrap_UVW"
    (
    -- register status of subobjectmode and element mode
    sub_obj_mode = $.modifiers[#unwrap_uvw].unwrap2.getTVSubObjectMode()
    element_mode = $.modifiers[#unwrap_uvw].unwrap2.getTVElementMode()
    -- set to subobjectmode to 0 in order for element toggle to go through (bug?)
    $.modifiers[#unwrap_uvw].unwrap2.setTVSubObjectMode 0
    $.modifiers[#unwrap_uvw].unwrap2.setTVElementMode(not element_mode)
    -- set subobjectmode back to original
    $.modifiers[#unwrap_uvw].unwrap2.setTVSubObjectMode sub_obj_mode
    )
    


    i have quite a few ideas for simple (?) maxscripts that i'd like to try my hands at somewhere down the line, but seeing as it usually takes me quite a while to get results, and it can be quite frustrating to just guess around until i get to where i want to be, i usually find better ways to spend my time ;-/
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 11
    Learning how to do path-finding in 2D.(Grid-based).
  • DEElekgolo
    Offline / Send Message
    DEElekgolo interpolator
    I have a 2d Tile system setup and I am not sure if I did it correctly since I am unable to have an entity traverse the grid properly.

    C++
    I have 2d array of tile objects.
    The tile object has a vector full of entities to draw at that tile.
    due to this, the entities contained in a tile are unaware of their own XY position.
    How would I have my player object go from the tile that it is in to the tile that is next to it and allow have room for an animation to play? The state pattern works well but what "flow" would I give it?
    Change player state to moving, play an animation and shift the drawing of the player to the tile it is going to move over, and then once the animation is complete should I copy the entity to the new tile and delete the old one?

    Its the designing of things like this that throw me off in the not-so-long run. Any information will do.
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 11
    Grid-based movement system?
    I'd do:
    Find path from A to B
    Move (normalize the time)
    When B is reached, do animation.

    I'm thinking like a chess system.
  • SpeCter
    Offline / Send Message
    SpeCter polycounter lvl 11
    You could do a simple A* which is pretty easy to do.
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    cptSwing wrote: »

    i have quite a few ideas for simple (?) maxscripts that i'd like to try my hands at somewhere down the line, but seeing as it usually takes me quite a while to get results, and it can be quite frustrating to just guess around until i get to where i want to be, i usually find better ways to spend my time ;-/

    its just a matter of practice. my best advice would be to work as neatly and modularly as possible. break code into functions as much as you can, and print out to the console alot. When you break your scripts down into functions it becomes much easier to locate errors and also becomes alot more readable.
    When you are using variables type the first 3 letters then press CTRL+enter this will give you an auto complete list, if you use that you will misspell things far less :).

    do this tutorial and enable autocomplete for the full mxs api (very very cool)
    http://apps.jhaywood.com/Blog/?c=3dsMax&p=1
13
Sign In or Register to comment.