Framsticks programming 

Generally, developers and users should follow standard guidelines of Software Development and Software Engineering when writing code for Framsticks. However, a list of Framsticks-specific, recurring issues is provided here.

  1. Writing scripts (in FramScript)

    • This option is available for all users of Framsticks. You can write scripts without much knowledge about programming (knowing notions of "procedure", "variable", "condition", "loop" etc. would be helpful).
    • Although scripts are often considered "quick and dirty" method of programming, it is only true for short pieces of code. When programming experiment definitions (.expdef files) or complex macros, you should actually pay more attention to Good Programming Practices, i.e. make a plan of what you want to do, think twice about how to make it in the simplest and most efficient way, etc.
    • Use Framclipse. It will help you avoid errors while you write, as FramScript engine in Framsticks does not check for errors thoroughly. You have to pay more attention to detail when programming in FramScript.
    • If you don't want to use Eclipse, use any text editor to write FramScript code and activate syntax highlighting for JavaScript or Java. Or use one of these editors.
  2. Writing C++ code.

    • This probably means using parts of SDK.
    • Take some time to read SDK docs and get acquainted with available classes (especially "utility" ones like SString, Pt3d, etc.)
    • Don't duplicate functionality. If it is already provided, use it. Or inherit from some existing class to extend functionality.
    • If you are using a non-gcc compiler as default, compile your code under gcc with the -pedantic option just to ensure the code is portable and to fix all glitches.
    • Test thoroughly outside of Framsticks. Make loops and leave your code running for hours.
    • Use valgrind during these tests. This will save you lots of time on debugging, looking for bugs, resource leaks etc.
    • We pay much attention to the quality of source code. Make your code as good as the rest of the code. Adding imperfect sources to a system of such complexity will not be beneficial.
  3. General.

    • Read examples. There are lots of existing pieces of code available, and most probably things similar to what you are trying to obtain have already been done.
    • Use proper letter case. You will not notice any problems under Windows, but other systems distinguish between mytexture.png and MyTexture.png - check the file names you use or your scripts/code may not work for others.
    • If you have doubts or are unsure about choosing the best approach, don't hesitate and ask macko, this can save your time!