Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

ICode (AI For Mecanim 2.0)

Discussion in 'Assets and Asset Store' started by DevionGames, Dec 18, 2013.

  1. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    I do not have unity 5 right now, it requires to buy a license, which i have not done yet. Yes this asset is not put on side, i am still working on it.
     
  2. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    Hi, I'm wondering if this supports all Unity platforms? Including the odd ones like Wii-U PSN and stuff like that? At least is there any reason it wouldn't work on these?
     
  3. Deleted User

    Deleted User

    Guest

    I hope you keep this on sale for another couple of days. I will definitely pick it up as soon as I have the $35!
     
  4. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Can not tell much about it, but i do not know any reason why it should not work.
     
  5. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577


    Ok, thanks for the reply!
     
  6. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Hello i am back and i am looking for beta testers for a new version of this asset. If you are interested please contact me on skype: tharon211
     
    Ramsdal likes this.
  7. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    YAY awesome.. glad you are back. Was afraid this package would not get any more "love" ;)

    One quick question now that you are back. How would you recommend handling persistance of the GlobalParameterCollection (in terms of saving/loading). I am not looking for code, just a quick suggestion.
     
  8. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    GlobalParameterCollection is not made to save any data, but if PlayerPrefs are enough for you, you could just add some methods for saving and loading in it. The parameters have a key(name) and the value, so it should be pretty easy to add.

    You could also save/load any parameter using PlayerPrefs.Set or MySQL.Set inside a state machine. But i think it is not a bad idea to be able to save all global parameters at once. I will consider it in the coming updates.
     
  9. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Hi Zerano

    Thanks, that was pretty much what I was going to do (not using player prefs but to a file though). I was just curious if there was something special I should be aware of in this regard, or if it was just a matter of saving values and loading them all to GlobalParameterCollection on load :)

    I would love to be part of the beta test group though I have not reached the "AI part" of my project yet, so the actual testing would be limited for a while - hence people that are in the middle of their AI implementation might be better candidates. Though I am very much looking forward to seeing what the future brings for this asset.
     
  10. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    That would be great, it does not need to be AI at all, any testing would help a lot. Please contact me on skype when you get some time.
     
  11. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    If you have not seen ICode(AI For Mecanim 2.0) is released!
    Big focus was on improving the performance. It is possible to create sub state machines to better organize your fsm's.
    Run states as sequence to delay actions from execution. Improvements for programmers and many more.
    Documentation is updated.
     
    hopeful, Ramsdal and OnePxl like this.
  12. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Awesome, could you elaborate a bit on the follwoing variables:

    SharedPersistent (Variables that can only be constant, if the state machine is persistent.)
    Shared (Only shared variables are possible.)

    What is a shared variable and when would it be used? perhasp give an example of when the two are ment to be used :)
     
  13. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    The attribute Shared is used to allow only variables that are not constant(variables by name, created using this steps or global variables). You can not set the variable value directly in the action. This is usefull if you want to store a value.

    Here is an example action, you can not set the store variable in the inspector, you have to use a "reference" to a variable.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace ICode.Actions.UnityAnimator{
    5.     [Category(Category.Animator)]
    6.     [Tooltip("Gets the value of a bool parameter.")]
    7.     [HelpUrl("http://docs.unity3d.com/ScriptReference/Animator.GetBool.html")]
    8.     [System.Serializable]
    9.     public class GetBool : AnimatorAction {
    10.         [Tooltip("The animator bool parameter name to get.")]
    11.         public FsmString parameter;
    12.         [Shared]
    13.         [Tooltip("Store the result.")]
    14.         public FsmBool store;
    15.         [Tooltip("Execute the action every frame.")]
    16.         public bool everyFrame;
    17.  
    18.         private int id;
    19.  
    20.         public override void OnEnter ()
    21.         {
    22.             base.OnEnter ();
    23.             id = Animator.StringToHash (parameter.Value);
    24.             DoGetBool ();
    25.             if (!everyFrame) {
    26.                 Finish ();
    27.             }
    28.         }
    29.  
    30.         public override void OnUpdate ()
    31.         {
    32.             DoGetBool ();
    33.         }
    34.  
    35.         private void DoGetBool(){
    36.             store.Value = animator.GetBool (id);
    37.         }
    38.     }
    39. }
    The attribute SharedPersistent is mostly used on GameObjects. If the state machine is binded then the variable can be constant and you can drag and drop the game object from the scene to the action field directly. If the state machine is not binded, SharedPersistent works the same was as Shared.

    In this example you can not drag and drop a GameObject to the gameObject field if the state machine is not binded. This is a limitation of unity(you can not have a reference in your project to scene game objects). When the state machine becomes binded, you can drag and drop a game object to this field(it becomes as it would not have an attribute at all.)

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace ICode.Actions.UnityAnimator{
    5.     [System.Serializable]
    6.     public abstract class AnimatorAction : StateAction {
    7.         [SharedPersistent]
    8.         [Tooltip("GameObject to use.")]
    9.         public FsmGameObject gameObject;
    10.  
    11.         protected Animator animator;
    12.  
    13.         public override void OnEnter ()
    14.         {
    15.             animator = gameObject.Value.GetComponent<Animator> ();
    16.         }
    17.     }
    18. }
     
  14. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Thanks for the more detailed explanation and the examples, it did the job ;)
     
  15. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Hi, I bought from your store directly, the link is still 1.6.5
     
  16. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Sorry will be awailible today, please contact me in private and i will give you a voucher for the asset store.
     
  17. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I was running the new Default samples from your website (2.0) version, some of functionality seems not implemented or not U5 ready? Eg. the image effects scripts are from 4x, and e.g MeleeAttack sample, the player cannot mouse click to attack. I checked and the PlayerControl state is not available.
     
  18. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Also reporting, Math.Substract works for float only, not int.
     
  19. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Thanks for reporting, i added a Unity 5 version of the default examples for download.
    How to control Health will come soon in a video tutorial.
     
  20. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    Amazing how far this has come. This now is basically on par with Playmaker.
     
  21. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Thank You!

    UFPS Example for ICode is availible for download.
     
    99thmonkey likes this.
  22. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Math.Subtract is working on FSMFloat, I have to make Math.SubtractInt to work with FSMInt. Is it intended or should there by a better way.

    Also, I notice SetParameter is removed so the previous MeleeAttack sample script does not work. What is the replacement way?
     
  23. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    1. It does not accept diffrent types, because of performance. In ICode, the variables are replaced, so they are usable directly without searching every time you want to acccess it.
    Best way is to create math int actions, i will release them as soon as possible.

    2. Please Read
     
  24. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    2.0.2a
    - Math int actions (ClampInt,DivideInt,MultiplyInt,SubtractInt,SumInt)

    2.0.2
    - SetVariable from script accepts AssignableFrom of variable type.
    - Unity5 AddComponent fix
    - GetObjectProperty action to get properties from UnityEngine.Object
    - SetObjectProperty action to set properties on UnityEngine.Object
    - AnyState was not switching back when switching from a sub state machine.
    - ToString action, converts a variable of type to a string.
    - RestartState action, useful for Sequence states.
    - VariableChanchedEvent for FsmVariables to access from custom scripts.
    - Added IsFinished condition for Sequence execution.
    - Calling NavMeshAgent.Stop() requires a NavMeshAgent.Resume(), when setting destination again in unity5.
    - Added ICodeTrigger, that enables or disables components within range using SphereCollider as trigger.
    - GetProperty supports Arrays and Lists
    - Removed previous version, is availible on request.
     
    Ramsdal likes this.
  25. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Lol it is now my second time updating ICode today :p nice to have you back and active Zerano! ;)
     
  26. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Zerano

    I have tried asking my question on skype without luck so will try here :)

    I have a button that, when clicked, adds a fsm to the character and then handles casting a fireball (animation and such). When all is done the fireball is cast and everyone is happy - except the enemies. Now I have a unused ICodeBehaviour component attached to my character. If I cast more fireballs more will come up - one for each fireball.

    I can of course add an action that removes the component in the end of the state machine, but I just want to know if there is a better way to do it? Am i missing some action, or should I check if a ICodeBehaviour already exists before attaching a new to the player?
     
  27. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Hi, sorry seems like i missed you skype message.
    ICodeBehaviour should get a new method to set a state machine, because there are some initialization required, if you want to replace the current state machine. I will make one for the next release. There should be also a new action for situation like this. Something like ReplaceStateMachine by group of ICodeBehaviour and an option to add a new ICodeBehaviour if it does not exists.

    I think this is a pretty common task and i am going to add this to ICode as soon as possible.

    Thanks!
     
    Ramsdal likes this.
  28. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Sounds good, will get back to this part when it has been added to ICode ;)
     
  29. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    2.0.2d
    - AddBehaviour action(Adds a new ICodeBehaviour and sets the state machine.)
    - gameObject.AddBehaviour(StateMachine stateMachine, int group, bool replaceIfExists) overload method
    - Fixed CopyFields for ScriptableObjects(Helper Utility).
    - SetCursorLockMode and SetCursorVisible action
    - GetElement action for array.(Gets element by index)
    - SetConstraints action for rigidbody.

    2.0.2c
    - GetVariable action to get a variable from other StateMachine
     
    Ramsdal likes this.
  30. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    That was fast ;) Thanks again!
     
  31. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    Hi, I'm trying to follow along the video tutorial where a new FSM is being created to turn the sphere red, and are running into a problem :

    screen-capture-6.jpg

    Under Render.SetColor=>GameObject, I don't get a drop down for "Owner"; "None" is the only listed option. Any insight on what I'm missing? Thanks.

    -Mike
     
  32. Platoniax

    Platoniax

    Joined:
    Mar 22, 2015
    Posts:
    2
    MikeTon, i have the same issue and i have solved it by creating my own "Owner" variable. This variable will be properly instantiated by icode in runtime.
     
    MikeTon likes this.
  33. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    Thanks Platoniax. That does work.

    I'm still interested in how come the built in scene/demos have Owner built-in but, not have to manually set up a variable for; it's easy to misspell. And would be a level of agency, I'd like to avoid if possible.

    -Mike
     
  34. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    I'm also following the tutorial on using trigger boxes to rotate a cube in the scene. It works great, but I am noticing this in the hiearchy:

    screen-capture-7.jpg

    Every time I enter and exit the trigger (yellow box), it adds a new, persistent, UnityEventHandler(Script) to my object on each exit/enter event. I am concerned that this will potentially cause a memory/perf issue?

    Thanks for any insights you can offer.

    -Mike
     
  35. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Fixed the owner issue, it was made when creating a state machine from the editor toolbar.

    Thanks for reporting UnityEventHandler issue, going to fix it soon.

    2.0.3
    - Fixed unity 5 warnings
    - Created State Machines using the editor toolbar had no Owner variable.
    - Fixed rigidbody actions, call was not removed from proxy.
    - Default examples update(smooth of ik scenes)
    - Fixed Ik actions, call was not removed from proxy.
    - OnEnterState method for actions.
    - IsPointerOverGameObject condition
    - ICodeMaster to hide/show components on a game object.
    - Fixed InstantiateRandom action
    - Random.RangeInt action
    - Photon Addon update
    - AddBehaviour action(Adds a new ICodeBehaviour and sets the state machine.)
    - gameObject.AddBehaviour(StateMachine stateMachine, int group, bool replaceIfExists) overload method
    - Fixed CopyFields for ScriptableObjects.
    - SetCursorLockMode and SetCursorVisible action
    - GetElement action for array.(Gets element by index)
    - SetConstraints action for rigidbody.
    - GetVariable action to get a variable from other StateMachine
    - MouseLook action based on Standard Assets
    - SmoothMouseLook action based on Wiki
    - MonoBehaviour script converter help editor
    - Math int actions (ClampInt,DivideInt,MultiplyInt,SubtractInt,SumInt)
     
    MikeTon, hopeful and Ramsdal like this.
  36. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    I've always wondered about Visual Script's Performance
    I mean Visual Script is easy to use but have issue for Performance Especially mobile

    I am planning to make mobile game (Hack and Slash RPG Game)

    I have to choice Icode for Visual Script or Just only C# Script

    I think You can give answer to me..

    Because You make Icode and RPG KIT 2.1

    So you know a lot about it?

    I would like to have two questions

    1) If I use RPG KIT 2.1 for making Hack and Slash mobile RPG Game .. Is it the right choice?

    2) If making the same game.. one use ICODE and the other make game just using only C# Script

    Approximately .. Will there be any difference in performance between the two?

    as a percentage 50%?
     
    Last edited: Mar 23, 2015
  37. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    402
  38. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    You need to rebake the navmesh, if you are getting a navmesh error, if not please let me know what error you get.
     
    Wrekse likes this.
  39. akhil96

    akhil96

    Joined:
    Oct 12, 2014
    Posts:
    32
    hi i am new to this tool and i am interested in this tool also,but i have a question

    when i saw the description of icode and playmaker,i found that both can do the same tasks.
    Both are visual scripting tools also.
    so what is the difference between the two?
    or if we have anyone of these,is there a need for other one?
     
    Wrekse likes this.
  40. Wrekse

    Wrekse

    Joined:
    Oct 6, 2014
    Posts:
    3
    Hi everyone,
    yes that's a good question i'm not too in the visual scripting
    but i have both playmaker and iCode (and others..) and was wondering
    if i had too use one which would it be (because i have to use one intensively
    to see if i'm not missing something particularly in the domain of workflow/productivity)?

    What i think i know is :
    - Playmaker will always be maintain and updated.
    - Playmaker has more stuff in it.
    - Playmaker works.
    - playmaker is ugly.
    - playmaker makes programmer feel like xxxx when there're using it especially in a team

    For those who use iCode over playmaker why!!??
    I'd like to know for example if it is more comfortable
    or if the supposed increase workflow it permits is better than playmaker...
     
    akhil96 likes this.
  41. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Hard for me to comment too much on PlayMaker.

    I bought ICode back when it was AI for Mechanim, because I wanted a solid AI system and it seemed to suit my needs. I very much hope that focus will remain on AI as the primary sales argument, though I use the system in many other aspects of the game - just like you would playmaker.

    I am very happy with ICode at the moment, though I must admit that I have not released anything using ICode yet so cannot talk about performance really - so far it works good...

    Also, it is worth noting that I own both playmaker and ICode. I perfer ICode, maybe because that was what I used first, in my mind the interface of ICode is also more to my liking.

    But I see that it is on sale currently for next to nothing, so hurry and grab it and test for yourself ;)
     
    akhil96 likes this.
  42. akhil96

    akhil96

    Joined:
    Oct 12, 2014
    Posts:
    32

    so if both plugins solves the same purpose why playmaker was given as third party integration for icode?

    Are the features of icode less compared to playmaker?
     
    Wrekse likes this.
  43. Wrekse

    Wrekse

    Joined:
    Oct 6, 2014
    Posts:
    3
    Thx Ramsdal,

    ok you seem an educated user and from what i read there is no obvious
    difference between iCode and playmaker.

    So i guess i'm gonna use both with simple behaviour and see how it goes with lots
    of units in the scene, i'll tell you which was the more intuitive to use
    and if a difference in performance i should see it rapidly.

    And what about the question from akhil96? For example say i use Behaviour Designer i understand
    why i could couple it to playmaker but if use iCode i'm not so sure playmaker is needed.
    Could the answer just be that you have previously made playmaker behaviour that are working well
    and you just want to keep them and make it compatible with iCode.. Perhaps it's just a way to say
    that if the situation present itself that you gathered playmaker and iCode Tree, you will be able
    to integrate them both on your project, is that it?

    Thanks
     
    akhil96 likes this.
  44. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    That sounds very nice, I would be very interested in hearing the results! I think that one of the reasons I chose to use ICode was because I am a coder and wanted to keep much in scripts to keep it as efficient as possible. However it has changed a bit and I am curious about performance (though I have not encountered any problems yet).

    I am not quite sure that I understood what you meant. But since PlayMaker and ICode are both FSMs they can be used in more or less the same situations. Playmaker actions could likely be adapted to ICode and the other way around. I would not use both in a project I think, though as previously stated my experience with PlayMaker is rather limited.

    I do believe that ICode is better for AI, at least i find it very intuitive to use. And if necessary it can be coupled with Behavior Designer (Behavior Trees), in that case you could harness the combined power of BTs and FSMs (though again, this could also be done using PlayMaker).

    But for me this was initially an AI decision, when the asset was heavily focused on AI (and PlayMaker is more "all-round"). However at the moment I use it not only for AI but also for other things such as spells and usable items.

    Just to add my thoughts on those points...
    1. PlayMaker editor is dll, ICode is open source, so there is always the option to continue development or change to fit your needs. However I do believe that PlayMaker will continue to be maintained and it also has a bigger user base.
    2. True, but in my world not as much dealing with AI as ICode (at least not as good).
    3. So does ICode (I have not had any problems yet at least)
    4. ICode look like the unity Animator window, I like it (and agree that PlayMaker is not too pretty in comparison).
    5. I am a programmer (or at least think of myself as one) and I am okay with ICode, but as I mentioned previously I would also like to minimize the visual scripting at the start of my project.

    Edit: Forgot to say that perhaps Zerano should put in his 5 cents, though it can of course be hard to be impartial...

    Wow my longest post to date I think ;)
     
    Last edited: Apr 4, 2015
    akhil96 likes this.
  45. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    I have not much experience with playmaker, so i can't say that much. I hope that other people that used both can jump in and tell us their opinion. This helps a lot to improve ICode!
     
  46. akhil96

    akhil96

    Joined:
    Oct 12, 2014
    Posts:
    32
    Hi,
    i would like to have *GameDataEditor* as a 3rd party integration for icode.
     
  47. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    Hi i dont see a* demo to download pls upload
     
  48. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    The Troll prefab in the examples seems to be broken ?
     
  49. DevionGames

    DevionGames

    Joined:
    Feb 22, 2010
    Posts:
    1,624
    Is availible for download.
    Fixed

    2.0.5
    - Photon Cloud simple ai example
    - Copy All actions/conditions using context click on the list in inspector
    - Fixed serialization of OverrideVariables when creating prefabs.
    - Improved Pick action.
    - Fixed AndroidInput preventing from build on other platforms
    - Fixed OverlapSpehere action -> target is not required
    - Transitions are reorderable
    - MoveInFormation action for NavMeshAgent
    - Updated A* Support package(Extended Move action).
    - Updated Default Examples(Troll was missing)
    - Impoved Raycast action.
    - Simple example for A* addon.
    - OverrideVariables helper.
    - Fix for OnClick condition Type `Button' does not contain a definition for `onClick'
    - SetEnabled action for classes extending from Behaviour
    - ComponentAttribute can be specified with Type-> will only list components that extend from this Type.
    - AndroidInput actions(http://docs.unity3d.com/ScriptReference/AndroidInput.html)
    - ICodeBehaviour inspector information(StateMachines, States, Actions and Variables count)
    - ICodeBehaviour inspector quick edit for variables.
     
    Ramsdal likes this.
  50. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Wow some nice new additions! Great work...