Search Unity

[RELEASED] Fury Framework - RPG/RTS Creator

Discussion in 'Assets and Asset Store' started by andorov, Dec 23, 2011.

  1. SolInvictus212

    SolInvictus212

    Joined:
    Aug 10, 2011
    Posts:
    50
    Ah, yes, that fixed it. Thanks!
     
  2. spazn

    spazn

    Joined:
    May 14, 2012
    Posts:
    3
    Is there a way to make the AI walk to random positions instead of just standing idle? I know you can make them move to random positions, but I want them to walk not run. Is this possible with the current state of the framework?
     
  3. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    Yes, quite easily.

    Create a custom debuff, something like "StatusDecorativeSlow," that slows down the speed of the entity to 50%. Use the AI controller to apply this decorative debuff to the entities when they are "wandering" around. The minute combat starts though, you should remove this debuff so they fight properly.
     
  4. Itszuvalex

    Itszuvalex

    Joined:
    May 24, 2012
    Posts:
    2
    Hey! Just want to say Awesome Framework, and I'm a buyer!

    However, a quick question. In the tutorial, after an enemy spawn kills one of your units, they never again (those creeps present in that spawn who were participating in killing said unit) will attack your other unit. Is this due to Units not resetting to Idle after killing the unit they were ordered to attack? Or is this a fault in the AI logic present for the tutorial itself?

    So what I'm asking is, for coding an AI do I need to check to see if their target is dead, or should it automatically switch back to idle so I can just check for those units not already actively attacking something?
     
  5. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    I believe this was an issue with the underlying mechanism that dealt with units entering their idle states -- it was a bug in the actual framework. The product you purchase off the AssetStore should have this issue fixed. If you're still running into it; let me know.

    Thanks for purchasing :)
     
  6. SolInvictus212

    SolInvictus212

    Joined:
    Aug 10, 2011
    Posts:
    50
    Thanks for being so responsive on this thread!

    With the weapons there is a pre-delay, post-delay, and cooldown time.
    Is there a way to override a function on the weapon (or the unit) in order to perform burst-style attacks?
    For example, firing three fireballs with .1 'cooldown' between them, then waiting a full second or so before firing three more times quickly.
     
  7. SolInvictus212

    SolInvictus212

    Joined:
    Aug 10, 2011
    Posts:
    50
    Never mind, figured it out myself. It was a really simple addition.
    I added a "BurstPrefab" to the included RangedWeapon, instantiate that and pass it the ArrowPrefab. The "Burster" then fires the ArrowPrefabs with an IEnumerator.
     
    Last edited: May 27, 2012
  8. neuraltoys

    neuraltoys

    Joined:
    May 23, 2012
    Posts:
    9
    hi andorov,
    your framework seems pretty impressive. I am following the tutorials right now to get familiar with it and build a quick prototype.
    I just went over the first two tutorials to create a map, put a basic unit on it and use the A* pathfinding for it.

    However I am experiencing a strange issue, maybe anyone else had the same problem:
    when I click the play window and the cursor gets locked
    -------------
    if (Hud.TriggerLMB || Hud.TriggerRMB) Screen.lockCursor = true;
    -------------
    then I cannot move the mouse anymore at all.
    I have tried logging the mouse position:
    -------------
    UnityEngine.Debug.Log (Input.mousePosition);
    -------------
    and it is actually blocked (does not change anymore).
    I am not sure where this is coming from as I am not experienced with Unity but it doesn't happen in the original tutorial scene

    EDIT: nevermind, it was a change I made to the SimpleHUD script :) sorry for the useless post.
     
    Last edited: Jun 4, 2012
  9. lirazshilk

    lirazshilk

    Joined:
    Jun 2, 2010
    Posts:
    14
    This framework is exactly what i was working on for a long time, had many problems and little time to address them.
    And in some way, when you create such things and doesn't get any payment on the way, things turn out to be even more difficult.

    My plan was very forward, creating the framework and then deploying it as a web player strategy online game for the web.
    It is stunning to see how you managed to get this done at a very short time, as a software engineer i am very impressed.

    Unfortunatly, you diminished my wishes to be the first one to make that step. now i have nothing to do but watch your creations flourish, and of-course buy this badass product!!, even tough it hearts deep inside!!!

    I have some features in my framework that are still, i suppose, not available on your framework.
    What about the fog of war? and buildings? resource gathering? workers/collectors that build/collect/fight a bit?
    but, you are so fast that probably you already got them covered :p

    Wish you the best, and please consider making this your full-time job effort! i am sure it would pay nicely
     
  10. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    How can you make enemy units run away from you? For example, like they got fear status on typical RPG.
     
  11. Itszuvalex

    Itszuvalex

    Joined:
    May 24, 2012
    Posts:
    2
    sanpats - I would recommend making a new status effect with the Fury.Database.Status.IOrderable interface. This prevents the unit from being ordered around while still allowing it to have orders given to it by the engine. Then, just give it random move orders at random times to random locations around it while it has the fear effect on it.
     
  12. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Thanks
     
  13. lirazshilk

    lirazshilk

    Joined:
    Jun 2, 2010
    Posts:
    14
    How would i implement tree harvesting?

    I thought about an ability for harvesting, and a Tree deposit with a queue of tokens being chopped off.
    Well, i don't see an example of extending the Deposit class, and it seems to be inaccessible from the Ability class end cast method.

    And for some reason, Deposit.OnCreated is not being called at all - i checked and it is attached to the tree

    While Unit.OnCreated is actually being called, so setting the tree as a Unit solves it, but seem to the wrong way to address this

    UPDATE: How do you set a unit to be neutral?
     
    Last edited: Jun 7, 2012
  14. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    The Behaviors namespace is not meant to be modified (unless you have source code and really know what you're doing.) What you should be extending is the Database.Deposit class. The Database namespace contains all user data AND logic.

    You can't set a unit to neutral, but you could make it invulnerable. You're right though; thats not the right way to go about things. I'll take a look into why Deposit.OnCreated is not being called.
     
  15. Aldebaran2012

    Aldebaran2012

    Joined:
    Jun 10, 2012
    Posts:
    5
    Hi andorov,

    I purchased your Fury Framework in the past days, btw is very good !!. I have a question for you, how to do for ModifyHealth to Unit without have than to do click in the icon for this. I mean how to do ModifyHealth to Unit direct into C# code. Thanks !!

    Greetings !!
     
  16. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    You can call the ModifyHealth function *any time* for *any reason* as long as you know the Unit whose health you want to modify. You can do it in the update loop, on a game event, on a button press. Whenever you feel like it :)
     
  17. Aldebaran2012

    Aldebaran2012

    Joined:
    Jun 10, 2012
    Posts:
    5
    Thanks for your answer andorov.

    But do you can show some with C# code for a clearer idea :).

    unit.ModifyHealth(10, null, null);

    This is my code, but not work :(
     
    Last edited: Jun 12, 2012
  18. Aldebaran2012

    Aldebaran2012

    Joined:
    Jun 10, 2012
    Posts:
    5
    My scene is this, I have a cube, when a Unit enters into the cube the Health for the Unit Up.

    Thanks !!
     
    Last edited: Jun 12, 2012
  19. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    In order to use the ModifyHealth method, you need to have 3 things.

    1) The amount of health you want to update.
    2) The unit whose health you want to update.
    3) The "ChangeSource" (either a Weapon, Token, Status or Ability) that will be registered as having caused the change.

    The first step is to create the ChangeSource. I'd suggest creating a dummy Ability (an ability is a ChangeSource); name it whatever you want. Drag this ability into a field for your cube. Then use Unit.ModifyHealth(10, null, YourChangeSourceHere) and everything should work. Note this procedure is very similar to setting up the Health Pots in the tutorial, the difference being that you need to set up some kind of a ChangeSource for this.
     
  20. Aldebaran2012

    Aldebaran2012

    Joined:
    Jun 10, 2012
    Posts:
    5
    Thanks a lot andorov !!
     
  21. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    In your examples, you showed how to use Intelligence stat, but the stat is depended on equipments. I want to do something similar to typical RPG where there are character own base stats. I think I can do it with a GameObject captaining these base stat values, or put them in a token, or attach them as generators. But I thinking extending Unit class would be more elegant.

    The questing is, can I extend the Unit class? will the Commander still recognize it?
     
  22. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    You couldn't extend the class in your own project and still have commander recognize it. You'll have to edit in the fury source code. If you do add fields, you must also come up a way to synchronize them (if you are making a multiplayer game). You can piggy back on the built-in state updates, if you like.

    The other alternative is to use lots of extension methods, which may also look equally elegant. Its up to you!

    I'm also doing a source code update tonight as I've made lots of small tweaks that improve the overall stability and consistency of the engine, so make sure you have the latest source.
     
  23. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    One of the easier ways but less elegant is to put a StatContainer token in the first slot of unit's stack and access the values from there.

    I wonder how to use extension method to do this, because I cannot create new field with it.
     
  24. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    One other way is to assign a custom UserTag to your unit. Then, you can develop an extension method like this:

    Code (csharp):
    1.  
    2. public static MyCustomUserTagType MyFunctionName(this Fury.Behaviors.Unit myUnit) {
    3. return myUnit.UserTag as MyCustomUserTagType;
    4. }
    5.  
    Then you can throw whatever you want in it! If you're making a multiplayer game, you may want to set up some custom method to synchronize this tag, which shouldn't be too difficult. In fact, you could keep all sorts of custom data in a UserTag if the token system becomes too cumbersome.

    Note that in my game, Warband (http://www.kongregate.com/games/dreadware/warband), I utilize a similar system whereby I store lots of custom unit data into serializable tag. At the start of the fight, I make sure everyone gets all the data, I unpack it and then use it through out the combat period. It works quite well!
     
    Last edited: Jun 18, 2012
  25. neuraltoys

    neuraltoys

    Joined:
    May 23, 2012
    Posts:
    9
    Thanks for all your hints and the tutorials.

    I am trying to make a building that trains troops. So, I created a new unit definition for the building, with move speed 0 and turn speed 0, then I added an ability train, very simple:

    Code (csharp):
    1.  
    2. class Train : Fury.Database.Ability
    3. {
    4.     public Fury.Database.Unit Unit = null;
    5.  
    6.     public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position)
    7.     {
    8.  
    9.         Fury.Behaviors.Manager.Instance.CreateUnit(this.Unit, caster.Owner, position, null);
    10.     }
    11. }
    12.  
    and then created a definition for TrainWarrior that implements script Train and the Unit is warrior.
    Now, even if I set RequiresTarget = false, it still doesn't work unless I target a unit. If I just target an empty position, the blue bar appears above the building but it doesn't decrease at all, so the ability is never completed.
     
  26. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Thanks! I grabbed the idea better now. May I ask what do you use to implement GUI in Warband, Unity GUI or other third party stuff? And What is the method you used in saving game data, serializable?
     
  27. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    The unit is trying to "walk over" close enough to cast the ability, but it can't walk. Simple solution? Increase the ability range by a lot!
     
  28. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    I use a combination of UnityGUI and some custom-built GUITexture nonsense. Its.. really bad and clunky and the minute Unity releases their new GUI, I'm rewriting the whole thing :)

    I save data by using System.Serialization.Runtime.Binary.BinaryFormatter.
     
  29. neuraltoys

    neuraltoys

    Joined:
    May 23, 2012
    Posts:
    9
    thanks, that worked
    I thought the distance was calculated in addition to the radius, but it's probably from the centre

    I would like to implement some commander level resource, like gold to buy troops. Is there anything like tokens per commander available? If not, I can implement my own scripts but I was hoping I can reuse something else.
     
  30. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    Yep. Commander.Controllers contains a TagController and a TokenController!
     
  31. neuraltoys

    neuraltoys

    Joined:
    May 23, 2012
    Posts:
    9
    sorry, but I cannot figure out how to manage the tokens of a commander.
    the unit (IUnit interface actually) has CreateTokenStack, ModifyTokenStackState and RemoveTokenStack

    how can I do those for the commander?
     
  32. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    Hmm, it seems like you're using an older version of Fury. I may not have updated the trial materials. I will do so soon and let you know.
     
  33. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    I trying to make a realtime with pause RPG. Do you think setting Time.timeScale to 0 will have any negative effect with Fury Framework?
     
  34. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    It shouldn't but that isn't something I've tested thoroughly. Most of the calculations in the game use Time.deltaTime; there may be a few corner cases that you have to touch up. I'll help you as best as I can and mirror those changes in official code as I feel timeScale is something important that should be supported.
     
  35. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    As far as your Tutorial Scene go, it seems to work perfectly. I can order my unit while pause and everything else stop during the time. If I catch any issue when I use more in-depth features, I will report back.

    Simple code that do the trick for anyone who want it.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class PauseGame : MonoBehaviour {   
    6.     // Update is called once per frame
    7.     void Update () {
    8.         if(Input.GetKeyDown(KeyCode.Space))
    9.             if(Time.timeScale == 0)
    10.                 Time.timeScale = 1;
    11.             else Time.timeScale = 0;
    12.     }
    13. }
    14.  
     
  36. SolInvictus212

    SolInvictus212

    Joined:
    Aug 10, 2011
    Posts:
    50
    I'm trying to implement a buff that will increase a player's range when he is in a certain location. But I can't find any way to modify range (IRange or whatever) in Fury.Database.Status.
    So I also tried just setting it on the unit, but Properties.Weapon.Range is read-only.

    How could I go about modifying an individual units range temporarily?
     
  37. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    Hey, it looks like that's a possibility I never considered, though implementing it in source code would not be too difficult. I will be updating the engine over the weekend and I'll work in something like IIncreasedRange.
     
  38. Uttpd

    Uttpd

    Joined:
    Feb 27, 2010
    Posts:
    114
    The tutorials are great source is available so..
    I´m looking in to this plug-in to help build a 2D simple adventure game. I´m fairly new to unity and have no scripting knowledge.
    Using 2D toolkit i´v been able to port 2D assets image / animations to Unity, fairly straight ford.

    this considered:
    Would this framework allow me to impalement basic functionality, to build upon without scripting roadblocks?
     
  39. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Will you update only the source or both the source and the dll in asset store?
     
  40. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    androrov,

    Any suggestion on how to implement a resurrection spell? Is it possible to restore a destroyed unit?

    I think this is important in any RPG. :)
     
  41. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    You can implement a deposit (gravestone, in game) upon death that has all the data necessary to create the unit again. This can be done all server-side.
     
  42. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    So I just add the unit component and set all the necessary parameter, right?
     
  43. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    Actually, on death, you can "save" the Unit's dying state by caching the dead unit behavior (Fury.Behaviors.Unit). It will be unsafe to use any Unity-specific things like Unit.transform or Unit.renderer, but you can still use Fury-specific things like Unit.Properties, and recreate a mirror copy when required.
     
  44. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Thanks androrov.
     
  45. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Another question, is it possible to have a unit got two status effect simultaniously? Like got poinsoned and stun or lignting shock at the sametime.
     
  46. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    Yep!
     
  47. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Yep, Ive already found that out myself. I also want to make some of my status implementations continue indefinitely until manually removed. For example, got diseased until cured by A potion or a spell. Is there any elegant way to do it? Can I just set the Duration to null? Last question, how can I prevent the same status effect to be added multiple time.

    Thanks.
     
  48. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    You can set the duration to a very high number, like 10000000. Due to the way precision works, that will actually last forever. The same status effect cannot be added multiple times, newer status effects override older implementations; they "refresh."
     
  49. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I am playing around with the evaluation version and have a few questions before I decide to buy this or not. I managed to spawn a 3rd unit by duplicated the code for the warrior and whatnot. Is there a different way of doing this or if I have, say 20 units, will I need to have that code duplicated 20 times? I imagine some sort of while loop would do the trick but want to make sure that is the right way to go before I start messing around too much.

    Also, I tried to add my own unit by duplicating one of the others and when I try to start a game with the new unit, it locks up at "Starting pathfinder" and I can't do anything but stop the game - well I can scroll the camera. I am able to use the provided units with no problems (but have to restart unity if I had placed my own unit in the Game Start script). I updated the "Unit" script on the duplicated warrior prefab with the new unit and the new unit (in the unit folder) is pointing to the duplicated prefab and I put the new unit in the game start script on the Trigger. It spawns but I cannot select any units. Is that just a limitation of the evaluation or am I doing something wrong?

    Thanks!

    edit: Oh, and there are prefabs that have a blank layers. What layers do I need to add?
     
    Last edited: Jun 27, 2012
  50. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    All standard programming techniques are supported; and loops are as standard as we can get ;)

    Code (csharp):
    1.  
    2. for (var i = 0; i < 5; i++) {
    3. Fury.Behaviors.Manager.Instance.CreateUnit(...)
    4. }
    5.  
    Will work just fine! Never, ever duplicate your code. Duplication/copypasta of code is #1 warning sign in programming of a bad design.

    Look in the debug log. The trial version is limited to 5 distinct unit definitions. You may have duplicated a unit definition and went over the limit! Whenever something "unexpected" happens, the console log should provide you with some clues. At the very least, you can copy paste the errors and I'll help you sort it out.

    The engine itself doesn't care about layers, but the user interface (SimpleHUD.cs) needs them to distinguish between the terrain and "units." I believe the project is set to configure Layer 8 as the "Units" layer. Just give Layer 8 a name, like "Units," and the "blank" layers should automatically update.