Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Boo Scripting Resource Thread

Discussion in 'Scripting' started by anothervenue, Jan 1, 2011.

  1. xqterry

    xqterry

    Joined:
    Dec 27, 2011
    Posts:
    3
    Hi

    I defined class A in javascript like this:

    class TestManager
    {
    public static function getInstance():TestManager
    {
    ...
    }
    }

    How could I use it in boo? I tried to call getInstance method, but got compile error.

    class ResultManager (MonoBehaviour):
    def Start ():
    TestManager.getInstance()

    def Update ():
    pass

    Error: Assets/scripts/scenes/ResultManager.boo(11,15): BCE0005: Unknown identifier: 'TestManager'.
     
  2. Sirex

    Sirex

    Joined:
    Feb 7, 2011
    Posts:
    77
    Code (csharp):
    1. import UnityEngine
    2. class PlanetGUI(MonoBehaviour, IGUI):
    3.     _combatScript as ICombatScript
    4.     _gameState as GameState
    5.     def Start():
    6.         _combatScript = gameObject.GetComponent('ICombatScript')
    7.         _gameState = GameObject.Find('GameRules').GetComponent[of GameState]()
    xqterry, Is this sort of what you mean?
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    And ensure that the TestManager is in plugins or a folder compiled first, as Boo <-> JS has the same limitations as JS <-> C# when it comes to cross language communication (the JS must be in a -firstpass project in the MD solution, while the Boo one isn't - UT unluckily removed the manual page on the matter)
     
    Last edited: Dec 27, 2011
  4. xqterry

    xqterry

    Joined:
    Dec 27, 2011
    Posts:
    3
    Thanks, but no, class TestManager is not bounded on same gameObject and not a subclass inherits MonoBehaviour.
     
  5. xqterry

    xqterry

    Joined:
    Dec 27, 2011
    Posts:
    3
    @dreamora
    Thanks. Is it possible to modify compilation order ?
     
  6. shinriyo_twitter

    shinriyo_twitter

    Joined:
    Aug 12, 2011
    Posts:
    328
    What is the advantage of Boo?
    I like Boo better than UnityScript
     
  7. Sirex

    Sirex

    Joined:
    Feb 7, 2011
    Posts:
    77
    The mayor advantage is duck typing and less fencing with the compiler.
    You can implement your solution from your mind to the computer faster.
     
  8. deus_duke

    deus_duke

    Joined:
    Mar 12, 2012
    Posts:
    11
    does anyone know how to do else clauses for defines in boo:

    ifdef not UNITY_IPHONE and not UNITY_ANDROID:
    # do stuff, this works
    else: # this line doesn't work
    ...
     
  9. Sirex

    Sirex

    Joined:
    Feb 7, 2011
    Posts:
    77
  10. pivotraze

    pivotraze

    Joined:
    Feb 4, 2012
    Posts:
    593
    I made a conversion of all the C# scripts used in the 3DBuzz tutorial to Boo. They are EXTREMELY commented up, so they should be of some help.

    http://forum.unity3d.com/threads/133405-Open-Source-Boo-Scrips-for-a-Space-Shooter

    I'm going to work on translating all the scripts in the rest of the Unity Tutorials I find (especially the ones in the main tutorials) to Boo, regardless of their use of UnityScript or C#. I love Boo... Well, I love Python, but Boo is close enough ;)
     
    Last edited: Apr 27, 2012
    Archeia likes this.
  11. shinriyo_twitter

    shinriyo_twitter

    Joined:
    Aug 12, 2011
    Posts:
    328
    However, in Unity environment duck typing does not allow.
    Is there Coding Standards of Boo of Unity?
     
  12. pivotraze

    pivotraze

    Joined:
    Feb 4, 2012
    Posts:
    593
    As far as I know, there isn't set-in-stone "This is how you code with Boo in Unity" kind of things. I just follow the PEPs of Python. Python is really similar to Boo, so the PEPs really easily apply to it :)
     
  13. tonyd

    tonyd

    Joined:
    Jun 2, 2009
    Posts:
    1,224
    FYI, type 'duck' works fine in Unity, even on the iOS.
     
  14. vmars316

    vmars316

    Joined:
    May 25, 2012
    Posts:
    1
    Hello Boo,
    I am trying to understand the relationship between
    Boo and javascript and compiled code (==> *.exe).
    Can Boo run in a webBrowser?
    If not, Is there a 'booScript to javascript' converter.
    Is there a BOO Gui-IDE ?
    Is this following info still valid?
    Thanks...Vernon

    From 2010 Thread: http://social.msdn.microsoft.com/Forums/en-US/dlr/thread/b510ee5c-5ba4-48b3-a3c1-73ad1f3c0048
    Boo is a full compiler to the .NET/Mono platform. It doesn't generate C# code, it compiles directly to a .NET assembly with CIL bytecodes.
    Boo has both a compiler booc.exe and an interpreter booi.exe, that reuse the same base code.
    The only dependency of Boo with C# is that the compiler/interpreter code is currently written in C#, as many other compilers in .NET.
    Boo creators are intent on rewriting the compiler in Boo itself, but that is in the future.
     
  15. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    I just want to say that I love Boo and I wish more people were aware of how awesome it is. It is not quite as good as CPython, but, it's vastly superior to C# and UnityScript.

    Things that could be improved:
    Type inference isn't as good as I wished.
    Whitespace can be annoying when your text editor inserts the occassional space instead of a tab.
    Arrays vs Lists takes a bit to get used to (particularly multi-dimensional) and I wish Boo had picked one or the other (that is, I wish it was just Lists all the way).

    On the other-hand, you get
    Awesome syntax that is readable and easy to write (which means increased productivity).
    Macros!
    Acceptable type inference.
    All the usual goodies like proper inheritance, continuations, closures, etc.
    And, I cannot stress enough, AWESOME SYNTAX.
     
  16. highway900

    highway900

    Joined:
    Jul 17, 2012
    Posts:
    5
    Great thread. I really love Boo as well as I do like python a lot. I recently ported a Camera Orbit script I found on the unify wiki you can get it here This was a great exercise and really sped up my unity boo skills. I recommend porting anything you can to help improve your skills and expand the resources available for Boo in unity.

    Cheers.
     
  17. pivotraze

    pivotraze

    Joined:
    Feb 4, 2012
    Posts:
    593
    I do the same thing :)

    On a side note, there is an amazing new resource for boo

    Everyone who uses Boo: You know how you can't see all the resources on the codehaus website? Well, go here: https://github.com/bamboo/boo/wiki/Boo-Primer

    It works MUCH better :)
     
    Archeia likes this.
  18. highway900

    highway900

    Joined:
    Jul 17, 2012
    Posts:
    5
    thanks Pivotraze. It is quite annoying the docs are down for Boo. I found on the google group for boo that click the view in wiki button (small icon top left of viewing page) takes you to the boo wiki reference for the page you are looking at and displays the info for the document. Still a bit annoying.

    But the github ref is excellent. I have just started a project and I have convinced my partner in crime to use Boo, he was kinda keen on using C# as he had used it a little before. But he came around once he spent some time coding in Boo.

    He ported some code and that made it easy to move forward.

    P.s. Slenderman was reviewed on an australian tv show good game this week. Great work! You can check it out here -> http://www.abc.net.au/tv/goodgame/stories/s3557579.htm
     
  19. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    I'm in the process of writing an Emacs mode for Boo if anyone is interested.
     
  20. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    This is what I've got so far. I'm not really an ELisp person so the code below is probably a terrible way of going about adding a Boo mode, but, so far it's working for me.

    Mostly this is adding font syntax highlighting and indentation rules for those things in Boo that aren't in Python as well as things that are Unity specific like the standard class names and common idioms. There's nothing in here for anything special like looking hooking into an interpreter environment.

    Also, this is built off of python-mode.el, so you'll need that and not python.el (though the font-lock stuff should work on both).

    Code (csharp):
    1. ;; --------
    2. ;; BOO/UNITY SYNTAX HIGHLIGHTING
    3. ;;
    4. ;; Define faces
    5. (defface boo-modifier-face
    6.   '((t (:inherit font-lock-function-name-face)))
    7.  "Face for Boo modifiers (public, static, etc.)")
    8. (defvar boo-modifier-face 'boo-modifier-face)
    9.  
    10. (defface boo-type-face
    11.   '((t (:inherit font-lock-constant-face)))
    12.  "Face for Boo/CLI variable types (int, double, etc.)")
    13. (defvar boo-type-face 'boo-type-face)
    14.  
    15. (defface unity-keyword-class-face
    16.   '((t (:inherit font-lock-variable-name-face)))
    17.  "Face for Unity-specific class keywords (MonoBehavior, Vector3, etc)")
    18. (defvar unity-keyword-class-face 'unity-keyword-class-face)
    19.  
    20. (defface unity-idioms-face
    21.   '((t (:underline t)))
    22.  "Face for common Unity 'idioms' like 'gameObject.GetComponent'")
    23. (defvar unity-idioms-face 'unity-idioms-face)
    24.  
    25. ;; Define regex expressions for highlighting
    26. (defvar boo-font-lock-keywords
    27.   (let ((kw1 (mapconcat 'identity
    28.             '("public" "static" "private" "abstract" "virtual" "override" "protected")
    29.             "\\|"))
    30.     (kw2 (mapconcat 'identity
    31.             '("ADBannerView" "ADError" "ADInterstitialAd" "AccelerationEvent" "ActionScript" "AndroidInput"
    32. "AndroidJNIHelper" "AndroidJNI" "AndroidJavaObject" "AndroidJavaClass" "AnimationCurve" "AnimationEvent"
    33. "AnimationState" "Application" "Array" "AudioSettings" "BitStream" "BoneWeight" "Bounds" "Caching"
    34. "ClothSkinningCoefficient" "Collision" "Color32" "Color" "CombineInstance" "Compass" "ContactPoint"
    35. "ControllerColliderHit" "Debug" "DetailPrototype" "Event" "GL" "GUIContent" "GUILayoutOption" "GUILayoutUtility"
    36. "GUILayout" "GUISettings" "GUIStyleState" "GUIStyle" "GUIUtility" "GUI" "GeometryUtility" "Gizmos" "Graphics"
    37. "Gyroscope" "Handheld" "Hashtable" "HostData" "IAchievementDescription" "IAchievement" "ILeaderboard" "IScore"
    38. "ISocialPlatform" "GameCenterPlatform" "IUserProfile" "ILocalUser" "Input" "JointDrive" "JointLimits"
    39. "JointMotor" "JointSpring" "Keyframe" "LayerMask" "LightmapData" "LightmapSettings" "LocalNotification"
    40. "LocationInfo" "LocationService" "MasterServer" "MaterialPropertyBlock" "Mathf" "Matrix4x4" "Microphone"
    41. "NavMeshHit" "NavMeshPath" "NetworkMessageInfo" "NetworkPlayer" "NetworkViewID" "Network" "NotificationServices"
    42. "Object" "AnimationClip" "AssetBundle" "AudioClip" "Component" "Behaviour" "Animation" "AudioChorusFilter"
    43. "AudioDistortionFilter" "AudioEchoFilter" "AudioHighPassFilter" "AudioListener" "AudioLowPassFilter"
    44. "AudioReverbFilter" "AudioReverbZone" "AudioSource" "Camera" "ConstantForce" "GUIElement" "GUIText"
    45. "GUITexture" "GUILayer" "LensFlare" "Light" "MonoBehaviour" "Terrain" "NavMeshAgent" "NetworkView" "Projector"
    46. "Skybox" "Cloth" "InteractiveCloth" "SkinnedCloth" "Collider" "BoxCollider" "CapsuleCollider"
    47. "CharacterController" "MeshCollider" "SphereCollider" "TerrainCollider" "WheelCollider" "Joint"
    48. "CharacterJoint" "ConfigurableJoint" "FixedJoint" "HingeJoint" "SpringJoint" "LODGroup" "LightProbeGroup"
    49. "MeshFilter" "OcclusionArea" "OcclusionPortal" "OffMeshLink" "ParticleAnimator" "ParticleEmitter"
    50. "ParticleSystem" "Renderer" "ClothRenderer" "LineRenderer" "MeshRenderer" "ParticleRenderer"
    51. "ParticleSystemRenderer" "SkinnedMeshRenderer" "TrailRenderer" "Rigidbody" "TextMesh" "Transform" "Tree"
    52. "Flare" "Font" "GameObject" "LightProbes" "Material" "ProceduralMaterial" "Mesh" "NavMesh" "PhysicMaterial"
    53. "QualitySettings" "ScriptableObject" "GUISkin" "Shader" "TerrainData" "TextAsset" "Texture" "Cubemap"
    54. "MovieTexture" "RenderTexture" "Texture2D" "WebCamTexture" "OffMeshLinkData" "ParticleSystem.Particle"
    55. "Particle" "Path" "Physics" "Ping" "Plane" "PlayerPrefsException" "PlayerPrefs" "ProceduralPropertyDescription"
    56. "Profiler" "Quaternion" "Random" "Range" "Ray" "RaycastHit" "RectOffset" "Rect" "RemoteNotification"
    57. "RenderBuffer" "RenderSettings" "Resolution" "Resources" "Screen" "Security" "SleepTimeout" "Social"
    58. "SoftJointLimit" "SplatPrototype" "StaticBatchingUtility" "String" "SystemInfo" "Time" "TouchScreenKeyboard"
    59. "Touch" "TreeInstance" "TreePrototype" "Vector2" "Vector3" "Vector4" "WWWForm" "WWW" "WebCamDevice"
    60. "WheelFrictionCurve" "WheelHit" "YieldInstruction" "AsyncOperation" "AssetBundleCreateRequest"
    61. "AssetBundleRequest" "Coroutine" "WaitForEndOfFrame" "WaitForFixedUpdate" "WaitForSeconds" "iPhoneInput"
    62. "iPhoneSettings" "iPhoneUtils" "iPhone")
    63.             "\\|"))
    64.     (kw3 (mapconcat 'identity
    65.             '("sbyte" "short" "int" "long" "byte" "ushort"
    66.               "uint" "ulong" "single" "double" "decimal" "char"
    67.               "bool" "string" "object")
    68.             "\\|"))
    69.     (kw4 (mapconcat 'identity
    70.             '("transform.Translate" "gameObject.GetComponent"
    71.               "Destroy" "gameObject.FindWithTag" "gameObject.Find" "Mathf.FloorToInt" "gameObject.GetComponent" "Resources.Load" "DestroyImmediate")
    72.             "\\|"))
    73.     )
    74.     (list
    75.      ;; variable/class/function modifiers
    76.      
    77.      (list (concat "\\([^. \t]\\|^\\)[ \t]*\\b\\([" kw1 "\\| ]\\)\\b[ \b\t]")
    78.            2 boo-modifier-face)
    79.      ;; Unity-specific classes and such
    80.      (list (concat "[ ()\t]+\\(" kw2 "\\)[ )(\t\n]+")
    81.        1 unity-keyword-class-face)
    82.      ;; BOO/CLI variable types
    83.      (list (concat "\\b\\(" kw3 "\\)\\b")
    84.        1 boo-type-face)
    85.      ;; Unity-specific commonly used "idioms"
    86.      (list (concat "\\(" kw4 "\\)")
    87.        1 unity-idioms-face)
    88.      ;; Variable assignment
    89.      (list (concat "^[ \t]*\\b\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)\\b[ \t]*\\(-=\\|\\+=\\|=\\)[ \t]*")
    90.            1 font-lock-constant-face)
    91.  
    92.      ;; True/False is now true/false
    93.      '("\\<\\(true\\|false\\)\\>"
    94.       1 font-lock-keyword-face)
    95.  
    96.     ;; basic lock syntax
    97.     '("\\<\\(lock\\|struct\\|class\\)\\>"
    98.        1 font-lock-keyword-face)
    99.  
    100.      ;; highlight a struct name
    101.      '("^[ \t]*struct \\(.*\\):"1 py-class-name-face)
    102.  
    103.     ))
    104.  "Additional expression to highlight in Boo mode.")
    105.  
    106.  
    107. ;; Define a new mode, boo-mode, derived from python-mode. This
    108. ;; will currently just function as python-mode with some additional
    109. ;; syntax highlighting.
    110. (define-derived-mode boo-mode python-mode
    111.  "boo-mode"
    112.  "syntax highlighting for boo. derived from python-mode"
    113.  (font-lock-add-keywords 'boo-mode boo-font-lock-keywords)
    114.  
    115.  
    116.   ;; add lock and struct to syntax for indenting purposes
    117.   ;; specific to python-mode.el
    118.   (defconst py-no-outdent-re "\\(struct\\s+.*:\\|lock\\s+.*:\\|try:\\|except\\(\\s +.*\\)?:\\|while\\s +.*:\\|for\\s +.*:\\|if\\s +.*:\\|elif\\s +.*:\\)\\([    ]*\\_<\\(return\\|raise\\|break\\|continue\\|pass\\)\\_>[   \n]\\)")
    119.   (defconst py-block-re "[ \t]*\\_<\\(class\\|def\\|for\\|if\\|try\\|while\\|with\\|lock\\|struct\\)\\_>[: \n\t]"
    120.   "Matches the beginning of a compound statement. ")
    121.   (defconst py-minor-block-re "[ \t]*\\_<\\(for\\|if\\|try\\|lock\\|struct\\)\\_>[: \n\t]"
    122.     "Matches the beginning of an `for', `if' or `try' block. ")
    123.   (defconst py-block-or-clause-re "[ \t]*\\_<\\(if\\|else\\|elif\\|while\\|for\\|def\\|class\\|try\\|except\\|finally\\|with\\|lock\\|struct\\)\\_>[: \n\t]"
    124.     "Matches the beginning of a compound statement or it's clause. ")
    125.  
    126. )
    127.  
    128. ;; All files with the .boo extension will now use boo-mode
    129. ;;(require 'boo-mode)                
    130. (setq auto-mode-alist (cons '("\\.boo" . boo-mode) auto-mode-alist))
    131. (setq interpreter-mode-alist (cons '("boo" . boo-mode) interpreter-mode-alist))
    132. ;; define boo interpreter
    133. (setq boo-python-command "booi -")
     
  21. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    I am a Python programmer and Boo looks good to me. Sadly, you lose stuff from the Python Standard Library, when you switch over.

    For example, I was using the ConfigParser module from Python to parse .ini files. What are my options with Unity/Boo? I understand Unity has file reading functions, but where to go from here? Or should I take a look at the ConfigParser module source code and port it over to Boo? Or is .ini file parsing already built into Unity?

    ***

    Yes, that is much better. However, do you have a link to the equivalent of the Boo keywords list here? http://boo.codehaus.org/Keywords+with+examples

    Also, why is this video:
    http://anothervenue.wordpress.com/2011/01/06/bootorial-1-intro-to-boo-scripting-in-unity-3d/
    set to private on YouTube? I'd really like to watch this ...
     
    Last edited: Sep 27, 2012
  22. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    Boo is not Python therefore you cannot really use any of the Python Standard Library.

    You need to switch anything you're used to in the Python standard lib to the equivalent library calls in .NET/Mono.
     
  23. kenaochreous

    kenaochreous

    Joined:
    Sep 7, 2012
    Posts:
    395
    Hi guys, I have a couple of questions about the Boo scripting language. I don't have any plans to switch over to Boo but I'm a bit curious about it. First off why do you use Boo instead of C# or Unityscript?Second what are the benefits of using Boo over Unityscript or C#? I prefer C# myself because of the static typing.
     
  24. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    I use Boo for the superiority I feel for using it. :p
    Actually, I'm just starting to use it more than C#. In my opinion it can be a lot more legible than C#. The biggest mental hurdle I had to cross coming from a C# world was that indentation is not just for prettification. Indentation determines block and scope.
    Once I got past that and a few minor syntax issues, Boo feels a lot cleaner. It is statically typed, but makes strong use of type inferencing, so at times it does appear to be dynamically typed. What I don't have in my Boo code are semicolons and curly braces all over the place. The amount of parenthese is also greatly reduced.
    As an exercise, I recommend translating simple tutorials into Boo. This will quickly point out some of the idiosyncrasies with Boo, and also give you a taste of it.
    I'll leave you with an example of a slightly cleaner version of a common pattern I see. I myself am a huge proponent of not having more than one return path out of a method, so this following code pattern has always bugged me:
    Code (csharp):
    1. void DoSomething () {
    2.    if ( CheckForSomethingElse()) {
    3.       return;
    4.    }
    5.    //do the rest
    6. }
    instead with Boo:
    Code (csharp):
    1. def DoSomething ():
    2.    unless CheckForSomethingElse():
    3.       //do the rest
     
  25. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    EDIT
    (...) Problems solved.
     
    Last edited: Oct 26, 2012
  26. Zulkarnain

    Zulkarnain

    Joined:
    Oct 31, 2012
    Posts:
    8
    Hi all,

    I'm new to Unity and Boo. I'm currently following Lerpz Tutorial, trying to do the DIY bits in Boo instead of the intended UnityScript. Now I'm stuck at the chapter StartMenuGui, trying to convert from the UnityScript to Boo without any knowledge of UnityScript. I searched for UnityScript to Boo converter, but only found C# to Boo converter (I'm not even familiar with C#). So, I'm here to request hints from all the Boo coders;

    Has anyone converted the StartMenuGui.js tutorial to Boo that I can take a peek at? Any hints are appreciated. Thanks
     
  27. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    I would start a new thread in this scripting forum to ask for help converting that script and tutorial.
    Specifically, what problems are you having in the conversion?
     
  28. Zulkarnain

    Zulkarnain

    Joined:
    Oct 31, 2012
    Posts:
    8
    Democre,

    Sorry bout that. I saw this as the official Boo scripting resource and thought this is the only place. I'll create a new thread. Thanks for the reminder.
     
  29. lgentry

    lgentry

    Joined:
    Nov 19, 2012
    Posts:
    6
    Info is out of this world, I would love to read more.
     
  30. jheiling

    jheiling

    Joined:
    Sep 28, 2010
    Posts:
    65
  31. pivotraze

    pivotraze

    Joined:
    Feb 4, 2012
    Posts:
    593
    Also, SharpDevelop has a built in converter.


    And it works great.

    Example:

    C#:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. [ExecuteInEditMode]
    6. [AddComponentMenu("Image Effects/Gamma Correction")]
    7. public class GammaCorrectionEffect : ImageEffectBase
    8. {
    9.     public float gamma;
    10.  
    11.     // Called by camera to apply image effect
    12.     void OnRenderImage(RenderTexture source, RenderTexture destination)
    13.     {
    14.         material.SetFloat("_Gamma", 1f/gamma);
    15.         ImageEffects.BlitWithMaterial(material, source, destination);
    16.     }
    17. }
    18.  
    Boo:
    Code (csharp):
    1.  
    2. import UnityEngine
    3. import System.Collections
    4.  
    5.  
    6. [ExecuteInEditMode]
    7. [AddComponentMenu('Image Effects/Gamma Correction')]
    8. public class GammaCorrectionEffect(ImageEffectBase):
    9.  
    10.     public gamma as single
    11.  
    12.    
    13.     // Called by camera to apply image effect
    14.     private def OnRenderImage(source as RenderTexture, destination as RenderTexture):
    15.         material.SetFloat('_Gamma', (1.0F / gamma))
    16.         ImageEffects.BlitWithMaterial(material, source, destination)
    17.  
     
  32. shinriyo_twitter

    shinriyo_twitter

    Joined:
    Aug 12, 2011
    Posts:
    328
    Hello

    I read the book, "Unity iOS Game Development Beginners Guide"
    There are the line.
    Code (csharp):
    1.  
    2. there are some functions of Unity (not the iOS version) which can only be accessed using Boo.
    3.  
    Do you know what is the some functions?
    And the function can't be accessed by C# too?
     
  33. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    I would assume they are referring to the fact that Boo exposes its own abstract syntax tree so you can write a new language in it if you wanted to.
     
  34. Beef Pop

    Beef Pop

    Joined:
    Dec 6, 2012
    Posts:
    3
    Hey there everyone, I'm just getting into Unity after a spell using ActionScript3 and Python, and a few other languages, to make games in my spare time. I am excited about Boo and am currently reading all I can about it.

    I have found this thread, especially the first couple of pages of it, to be very helpful-- so thanks! I like what I'm reading so far.
     
  35. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    Welcome Beef Pop!
    If you would like to see an entry level tutorial for Unity using the Boo language, check out this tutorial. Think of it as kind of a more practical "Hello world" example. Regardless of the language, it shows some foundational concepts when working Unity. And, because there is a Boo version, it shows foundational use of Boo in Unity.
     
  36. Beef Pop

    Beef Pop

    Joined:
    Dec 6, 2012
    Posts:
    3

    Thanks Democre!
     
  37. jheiling

    jheiling

    Joined:
    Sep 28, 2010
    Posts:
    65
    Hey guys! Am I the only one who thinks it's a terrible shame that Boo gets so little love?
    Why is Unity not advertising Boo??? They offer a language with powerful metaprogramming capabilities, awesome features like slicing, pattern matching, easy string interpolation,... , but they don't tell anyone. It's almost as if they wouldn't know about it's advantages...
     
  38. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    It's certainly a shame that Boo is not used more.

    Then again UnityScript is written in Boo so in some way most everyone is using Boo.

    BTW I am getting ready to release an emacs mode for Boo for those who are interested. I will post something later.
     
  39. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    kind of, UnityScript's lexer/parser uses Boo. So yea, at some level, writing UnityScript utilizes Boo, but more as a tool and not a language.
     
  40. Nariya-Takemura

    Nariya-Takemura

    Joined:
    Mar 16, 2013
    Posts:
    1
  41. The Pokeblader

    The Pokeblader

    Joined:
    Mar 14, 2013
    Posts:
    3
    Um, that page isn't available.....
     
  42. Taugeshtu

    Taugeshtu

    Joined:
    Apr 2, 2011
    Posts:
    21
    Hi there.
    I'm currently exploring different possibilities in boo, and now I'm stuck at converting JSON to hashtable.
    For example, I have:
    Code (csharp):
    1. _json_string as string = '{"y":858,"x":74}'
    And I want to create a hashtable based on that string. It really kills me, because Boo's hashtable declaration isn't just "similar", it's identical:
    Code (csharp):
    1. _h1 = {"y":858,"x":74}
    And, well, making a parser doesn't seems boo-ish enough :D
    So, I was trying to make interactive interpreter work, but couldn't get it into my assembly. Step-by-step instruction would be appretiated, as well as a note on whether it would work on mobile platforms or not.
     
  43. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    I haven't tried this myself, but I wonder if you could do something like this:
    Code (csharp):
    1. import Boo.Lang.Interpreter from Boo.Lang.Interpreter
    2.  
    3. _json_string as string = '{"y":858,"x":74}'
    4. interpreter = InteractiveInterpreter()
    5. interpreter.SetValue("tmp", _json_string)
    6. _h1 = interpreter.GetValue("tmp")
    Cheers,
    Democre

    EDIT: Ah I see you tried the interactive interpreter. What do you mean you couldn't get it into the assembly? It's not there for import?
     
    Last edited: Apr 11, 2013
  44. Taugeshtu

    Taugeshtu

    Joined:
    Apr 2, 2011
    Posts:
    21
    Yes, it can't be imported. With:
    Code (csharp):
    1. import Boo.Lang.Interpreter from Boo.Lang.Interpreter
    I get:
    And with:
    Code (csharp):
    1. import Boo.Lang.Interpreter
    I get:
     
  45. wraylewis

    wraylewis

    Joined:
    Jul 17, 2012
    Posts:
    1
    I know you are all way ahead of me. I'm reasonably new to programming in general. Have had some success following tutorials re C# in Unity. Learning python for other apps. Have read up on boo, and would love to learn it generally, and for unity specifically. However, I use a Mac. And, while MonoDevelop for Unity seems to have boo, my regular mondevelop doesn't, and I can't figure out how to get it. Any help? Boo seems like a great language. Am I out of luck?
     
  46. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    Is there a reason you can't use the MonoDevelop that comes with Unity? AFAIK, the boo plugin for MD has stopped being supported and breaks under MD 3+. Also Unity is not using the latest version Boo (again AFAIK), so to use Boo in Unity it probably is best to use the MD that is bundled with Unity. It should be able to exist alongside your regular monodevelop.
     
  47. CVgames

    CVgames

    Joined:
    Jun 30, 2013
    Posts:
    25
    I joined up and saw this thread afterwards. I could have learned enough lurking here. lol. Great thread
     
  48. mescalin

    mescalin

    Joined:
    Dec 19, 2012
    Posts:
    67
    I wanted to offer something, that although I'd prefer an implementation of iron python, I found this out about boo:

    Boo supports macros so it this code of the bat emulates pythons exec function

    https://github.com/mono/old-code/blob/master/bake/src/Bake/Exec.boo


    in case you where wondering a popular games programming technique is to try and get some sort of messaging system going for commands relating to game events, so scripting system, for people writing there own command interpreting type scripting system, the exec function or macros are of interest.


    the only way to do this with c# is to compile on the fly, I think this is supported on any platform in mono, however a dynamic language would usually be desirable for this type of behaviour.
     
  49. Shammah

    Shammah

    Joined:
    Jul 23, 2013
    Posts:
    3
    While I have created a topic already, I thought I could make post about it here as well.

    I have created aset of Boo tutorials, which can be found at http://protoman.net/index.php?p=bootorial/index
    Any feedback would be gladly appreciated.

    Happy scripting!
     
  50. bamboo

    bamboo

    Joined:
    Oct 9, 2012
    Posts:
    121
    Boo users will be pleased to know that Livity has great support for Boo (even though this first video emphasizes UnityScript):