|
Post by shadex on Jun 2, 2017 16:38:31 GMT
Shades of Insomnia Presents:
Shades Spell System 2.1
License
Welcome to the new Spell System 2.0. We are releasing this under CC-BY-SA, It's our wish that it's free to use, modify or adapt even in commercial products. All we ask is that you list us in the credits or provide some type of attribution. Also if you want to create and release a modified version of this system, it must always remain free. This way, we can all create better games... The games we want!
A few months ago Insomniac and I started working on the Spell System 2.0. It was kinda done in the first month, but we are the Undisputed Kings of Feature Creep.
In the new system you will find a massive amount of new tools, systems and options to not only bring to life a functional Spell System for your game, but one that has a fast setup, workflow and can easily be extended to do just about anything. In addition to just the spells, we are including Ranged AI capable of casting a number of spells, A Main Menu / Load Level System based off of SQL Lite or EasySave2.
We included a resist system that mitigates damage based on damage types. We included Magic Weapons, We included Teleports, and Creature Summons, Scripts to increase spell size by level. We even created a leveling system with point allocation upon level up. Oh and an entire attribute system that can hook into other existing systems. Oh yea, and fire breathing Iguana's! Like i said, Kings of Feature Creep.
Please have a read under the documentation for instructions. To get the the system, please download our github release for the latest version. (https://github.com/ShadesOfInsomnia/SpellSystem)
Install Instructions:
Installation Requirements / Order - Ensure using Unity 5.6+ (ideally 2017.1+) - Install Invector Melee 2.3+ or Shooter 1.2+ 3rd Person Controller - Install Unity Post Processing Stack (or remove from the camera in the demo scenes) - Check Edit->Project Settings->Player->Other Settings.....to view the demos as intended set colour space to linear - Install easysave2 if owned (if not don’t import CharacterDataEasySave2.cs), SQLLite is included in the package as a free alternative - Install the latest spell system git hub release, download and extract the zip from the releases page, then copy the entire invector folder into the project assets folder, you will be prompted to overwrite two files, these are the item enums for spells and are mandatory. - To run the mainmenu_lobby scene, add the level1 and level2 scenes to the build settings. - If you’re running a non-windows OS then you will need to download the appropriate SQLLite dll or not import it and use easy save2, see www.sqlite.org/download.html
Features List
• Centralized spawn class linked to the pooler, including spawns on birth, death, body removal, spell hits & explosions, trapped objects, proximity triggers, and more
• Player and AI magic enabled character creation wizards for easy setup • vInventory integration for spells, including custom AI item manager • Leveling system with data abstraction layer, modifiable attributes, resistances & formula’s • Main menu system linked to the data abstraction layer • SQLLite/EasySave2 abstract data layer implementation (easy to clone for other data formats) • Character information screen • Attribute System with Point Spending • Magic weapons and armour with damage and resist types linked to the levelling system • New Damage System with Damage Over Time, and various Damage Types • Damage Mitigation System including resist types • Weapon trails effects • Custom animation on AI instantiation • Status effects aka burning, poisoned, frozen etc • Generic AI without modifying the Invector core (Experimental) • Ranged AI for Invector Core AI capable of spell casting or arrow shooting. • Feed vWaypoints into the animator and trigger actions • 600 free gems unique to this asset (uses the Unity Gem Shader) • Merge LOD levels from simplygon output onto singular bone structure • Character equipment material changer (across multiple LOD levels • Generic ragdoll builder which works from bone chains • Archery and Thrown weapon System • Complete custom-made spells and Skills Examples, free for commercial use • Custom Emissions Shader • Shield Bash System • Custom inputs for spells • Magic Projectile Script with homing and advanced targeting systems • Custom hand effect’s • Animator based multi-layered spell casting system • Custom Spell Sounds • Physics Based Spells • Gold and Object Collection System that shows in the Character Screen • Custom Scripts to do everything from Raise the Dead to Heal. • Basic Character Creation System (Name, Axis, Class, Race and Alignment)
• Full pooling system, automatic or pre-warmed
Spell Examples
Menu With Conditions and Magic Weapons Examples
Generic AI
Reserved for Later
|
|
|
Post by shadex on Jun 2, 2017 16:39:08 GMT
--------Depreciated-------- Below is v1 of the system. For v2 read the above post
I've know some people have been interested in a magic system for the controller. One of my wishes is that we will eventually have a shop system, quest system, Magic system, armor system and leveling system for the controller. I want to take a second and acknowledge the massive amount of hard work therindu has put in to his quest system and his new shop system. While he's been working on his shop and Quest system, I've been working on my magic system, and we have been trading idea's back and forth. I really hope to see either people extending this system, or hopefully even working on something like an armor system. Updates 06/02 - Added homing to custom projectile script, with option to always hit, or aim at where the target was when the projectile is cast. (The enemy of the spell system is no longer unlevel ground!) 06/07 - Added layer collision and custom height adjustment to Projectile script. (Now you can choose where it hits on lock-on!) 06/09 - Really bad Alpha release! 06/10 -Remade tutorial with sound. 06/15 - Added Projectile/knockback tutorial The Magic System The magic system is designed to be modular, to work with anything that has an animation state. This means it works out of the box on pretty much any AI system (ice creature control, Invector's humanoid AI, etc). It can be attached to any animation. It does not even require an Input, as you can attach it to your 2nd weak sword attack and it will work out of the box. That being said, i made a simple custom input that casts the spells using f1-f5. I've been trying to hook it into the inventory system. This would allow for spells to be equipped, found, bought (therindu's shop system) etc. How it Works The system is made up of a State Machine Behavior script, which spawns 3 gameobjects. Hands <GameObject> which is designed for trails is actually attached to the animations hands itself. This happens on start. The 2nd effect (Body) spawns a <GameObject> at the root position of the animator (centered at the feet basically). The third is the projectile, which is spawned at MagicSpawn (A transform you set on a script on the player or AI). You have a start and end time, so that you can configure when the Body effect or the projectile effect happen. Note: It should act similarly to baking the functions into animation events, however when i tested this method, it's was unreliable due to frame skipping, and some spells where never casted, or casted late. Now each Spell <GameObject> is designed to be modular. For a projectile, all you need is a rigidbody, a projectile script and either a damage script or a collision script that spawns an explosion with a damage script on it. This means you can use your own custom systems, or vProjecile and vObjectDamage. To further customize the spell, you can add simple rotation scripts, parenting scripts, physic's scripts, etc, to gain additional effects. Oh and you will want to destroy the object a few seconds after making it, so vDestroyObject works lovely. Oh... and I have a working Bow And Arrow :p Types of Spells Point Blank Area of Effect (Done) Projectile Area of Effect (Done) Fixed Distance Area of Effect (Done) Beam Single Target and AoE (Done) Grenade with/without timer (Done) Throw Weapon (Done) Bow and Arrow (kinda sorta done) Single target projectile (Done) Enchant Weapon (WiP) Single Target Heal (Done) Heal over time (Done) AoE Heal (Done) Summoning (Done) Magic Shield (WiP) Damage Over Time (Works on all spells) Front Magic Shield (Done) Transformation (WIP) It is compatible with nearly every spell asset on the asset store. For best results Hands take Trails, Body takes Explosions or Buff type particle effects, and projectile takes Weapons, Balls, or anything you want to send at the enemy If there is a specific type of spell not included, or if there is a spell from another game that you want to know if it will work with the system, please feel free to comment in the thread. Here are some video's of the spell system in action. Physic's Test Video Placeholder Spell Type Test Video Placeholder Let me know what you think! -Shade Ok, here is the deal. I am releasing the Spell System Today. It's in alpha state, as there are still bugs i am working on, and features i am implementing. For example, the "always hit" boolean on magic system projectile is not working as intended, and when you use magic attack behavior you have to fill in all public gameobjects even if you are not using an effect. (Simple create an empty gameobject and put it in there with a v Object Destroy set to .1) I am releasing it far from complete, as i know a bunch of people want to get to using and testing this, and hopefully someone may contribute a code fix or a feature here or there. I have included a sloppy, crappy tutorial. As i have a few things to do, and did not want to wait an extra few weeks to release it, you will have to deal. The code and tutorial are as follows below.... For Magic State Behavior script, make you go to the animator, find a state, and click Add Behavior -> new, and Type the name in. This is important because it's not a monobehavior, but a state machine behavior script. Magic Attack Behavior Script
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngineInternal;
public class MagicAttackBehavior : StateMachineBehaviour {
[Header("CASTING PARTICLE EFFECTS")] public GameObject HandParticleEffect; // Prefab of the particle system to play in the state. public AvatarIKGoal attackLimb; // The limb that the HandParticleEffect should follow. public AvatarIKGoal attackLimb2; // The limb that the HandParticleEffect2 should follow. [Tooltip("Time to Kill Hand Particle Effect")] //public float TTKHand; //old time to kill hands, changed and now is automatic on state exit private Transform HandParticleEffectTransform; // Reference to the instantiated prefab's transform. private Transform HandParticleEffectTransform2; // Reference to the instantiated prefab's transform. // collision effect [Header("SPELL PARTICLE EFFECTS")] [Tooltip("Particle Effect")] public GameObject particle; [Tooltip("Particle Effect")] public float TimeToDestroyParticleEffect; [Tooltip("normalizedTime of Active Damage")] public float startParticleEffect = 0.05f; [Tooltip("normalizedTime of Disable Damage")] public float endParticleEffect = 0.9f; private bool isActive; //public bool IsParented = false;
//public GameObject SpellIndicator;
[Tooltip("Use explosions physics")] public bool UseMPhysics; public float radius; public float power;
public GameObject projectile; protected Transform ProjectileSpawnpoint;
//private ParticleSystem particleSystem; // Reference to the instantiated prefab's particle system.
protected GameObject clone; protected GameObject clone2; protected GameObject HandParticleEffectInstance; protected GameObject HandParticleEffectInstance2; protected Transform MagicSpawn;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { MagicSpawn = animator.GetComponentInChildren<MagicSpawnSetup>().MagicSpawnPoint;
// If the particle system already exists then exit the function. if (HandParticleEffectTransform != null)
return;
// -----HAND PARTICLE EFFECT LOGIC------ // Otherwise instantiate the HandParticleEffect and set up references to their components. isActive = false; HandParticleEffectInstance = Instantiate(HandParticleEffect); HandParticleEffectTransform = HandParticleEffectInstance.transform; //Hand 2 HandParticleEffectInstance2 = Instantiate(HandParticleEffect); HandParticleEffectTransform2 = HandParticleEffectInstance2.transform;
//UnityEngine.Object.Destroy (HandParticleEffectInstance, TTKHand); //UnityEngine.Object.Destroy (HandParticleEffectInstance2, TTKHand); // particleSystem = HandParticleEffectInstance.GetComponent <ParticleSystem> (); Debug.Log ("particle system running"); }
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { isActive = false;
UnityEngine.Object.Destroy (HandParticleEffectInstance); UnityEngine.Object.Destroy (HandParticleEffectInstance2); //particleSystem.Stop(); }
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (stateInfo.normalizedTime % 1 >= startParticleEffect && stateInfo.normalizedTime % 1 <= endParticleEffect && !isActive) {
clone = Instantiate (particle, animator.rootPosition, Quaternion.identity) as GameObject; isActive = true;
UnityEngine.Object.Destroy (clone, TimeToDestroyParticleEffect);
if (UseMPhysics == true) { Vector3 explosionPos = animator.rootPosition; Collider[] colliders = Physics.OverlapSphere (explosionPos, radius); foreach (Collider hit in colliders) { Rigidbody rb = hit.GetComponent<Rigidbody> (); if (rb != null) rb.AddExplosionForce (power, explosionPos, radius, 3.0F); // Debug.Log ("-- YES Physics -- "); }
} else if (UseMPhysics != true) { // Debug.Log ("-- No Physics -- "); }
} // Activeate this after you activate the first particle effect (not the hands) MUST be a value greater then startParticleEffect else if (stateInfo.normalizedTime % 1 > endParticleEffect && isActive) { //Debug.Log ("--STATE 2-- "); //Debug.Log (isActive); //if (clone2 != null) { clone2 = Instantiate (projectile, MagicSpawn.transform); //Projectile spawn point clone2.transform.parent = null;
isActive = false; //}
}
}
override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { //Debug.Log("On Attack Move "); }
override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//MUST SET THE LAYER TO IK. GO TO THE ANIMATOR, CLICK LAYERS, CLICK THE IK BUTTON TO THE RIGHT OF THE LAYERS.wwwwww // OnStateExit may be called before the last OnStateIK so we need to check the HandParticleEffect haven't been destroyed. if (HandParticleEffectTransform == null) return;
// Find the position and rotation of the limb the HandParticleEffect should follow. Vector3 limbPosition = animator.GetIKPosition(attackLimb); Quaternion limbRotation = animator.GetIKRotation (attackLimb);
//Hand 2 Vector3 limbPosition2 = animator.GetIKPosition(attackLimb2); Quaternion limbRotation2 = animator.GetIKRotation (attackLimb2);
// Set the particle's position and rotation based on that limb. HandParticleEffectTransform.position = limbPosition; HandParticleEffectTransform.rotation = limbRotation;
//hand 2 HandParticleEffectTransform2.position = limbPosition2; HandParticleEffectTransform2.rotation = limbRotation2;
}
} Magic Spawn Setup
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class MagicSpawnSetup : MonoBehaviour {
public Transform MagicSpawnPoint; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } }
Magic System Projectile
using System.Collections; using System.Collections.Generic; using UnityEngine; using Invector;
public class MagicSystemProjectile : MonoBehaviour { public GameObject particleOnCollision; public float speed = 10f; public Transform SpellTarget; public bool AlwaysHit; public LayerMask CollidesWith = ~0; public float HeightAdjust = 1; //Adjusts height from bottom of enemy. 1 is body, 1.5 is head depending on model [HideInInspector] public Vector3 temp; public int layer; void Start() { SpellTarget = GameObject.FindWithTag ("MainCamera").GetComponent<vLockOnTargetControl> ().currentTarget; var coll = GetComponent<Collider>(); //SpellTarget.position.y = SpellTarget.position.y + HeightAdjust;
temp = SpellTarget.localPosition; temp.y = SpellTarget.localPosition.y + HeightAdjust; //SpellTarget.localPosition = temp;
//yield return new WaitForSeconds(0.1f); coll.isTrigger = false; if (AlwaysHit == false) { transform.LookAt (temp); } }
void Update() { if (AlwaysHit == true) { transform.LookAt (temp); } transform.Translate(Vector3.forward * speed * Time.deltaTime); //transform.Translate(temp * speed * Time.deltaTime); }
void OnCollisionEnter(Collision other) { //if (particleOnCollision != null) //if (other.gameObject.layer == CollidesWith) //if (CollidesWith.value; 1<<layer) if(CollidesWith == (CollidesWith | (1 << layer))) //if(((1<<other.gameObject.layer) & CollidesWith) != 0) //if (CollidesWith) { GameObject impactParticle = Instantiate(particleOnCollision, transform.position, transform.rotation) as GameObject; Debug.Log (other.gameObject.layer); }
Destroy(gameObject); }
} Spell System Input
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class SpellSystemInput : MonoBehaviour {
[Header("SpawnPoints")]
public Transform test2; [Header("Ignore Stuff Below")] Animator anime; private MagicAttackBehavior exampleSMB; //public GameObject SpellInd; //public GameObject SpellInd2; public int MagicID;
public int MID1; public int MID2; public int MID3; public int MID4; public int MID5;
// Use this for initialization void Start () { anime = GetComponent<Animator> ();
exampleSMB = anime.GetBehaviour<MagicAttackBehavior> (); } // Update is called once per frame void Update () { if (Input.GetKeyDown ("f1")) {
//Charge spell logic goes here! //Debug.Log ("F1 is held down"); //SpellInd = Instantiate (exampleSMB.SpellIndicator, MagicSpawnPoint.transform); } // MagicID's int should be replaced with a variable that is set when you equip a spell if (Input.GetKeyUp ("f1")) { //Debug.Log ("F1 is held up"); anime.SetInteger ("MagicID", MID1); //trigger magic ID to select the spell anime.SetTrigger ("MagicAttack1"); //Trigger the Magic State //Destroy (SpellInd); //Debug.Log (MagicID); } if (Input.GetKeyDown ("f2")) { //Debug.Log ("F2 is held down"); //SpellInd2 = Instantiate (exampleSMB.SpellIndicator, MagicSpawnPoint.transform); } if (Input.GetKeyUp ("f2")) { //Debug.Log ("F2 is held up"); anime.SetInteger ("MagicID", MID2); //trigger magic ID to select the spell anime.SetTrigger ("MagicAttack1"); //Trigger the Magic State //Destroy (SpellInd2); } if (Input.GetKeyDown ("f3")) {
//Debug.Log ("F3 is held down"); //SpellInd2 = Instantiate (exampleSMB.SpellIndicator, MagicSpawnPoint.transform); } if (Input.GetKeyUp ("f3")) { //Debug.Log ("F3 is held up"); anime.SetInteger ("MagicID", MID3); //trigger magic ID to select the spell anime.SetTrigger ("MagicAttack1"); //Trigger the Magic State //Destroy (SpellInd); //Debug.Log (MagicID); } if (Input.GetKeyDown ("f4")) {
//Debug.Log ("F4 is held down"); //SpellInd2 = Instantiate (exampleSMB.SpellIndicator, MagicSpawnPoint.transform); } if (Input.GetKeyUp ("f4")) { //Debug.Log ("F4 is held up"); anime.SetInteger ("MagicID", MID4); //trigger magic ID to select the spell anime.SetTrigger ("MagicAttack1"); //Trigger the Magic State //Destroy (SpellInd2); } if (Input.GetKeyDown ("f5")) {
//Debug.Log ("F5 is held down"); //SpellInd2 = Instantiate (exampleSMB.SpellIndicator, MagicSpawnPoint.transform); } if (Input.GetKeyUp ("f5")) { //Debug.Log ("F5 is held up"); anime.SetInteger ("MagicID", MID5); //trigger magic ID to select the spell anime.SetTrigger ("MagicAttack2"); //Trigger the Magic State //Destroy (SpellInd2); }
}
//For Inventory Event System to set Magic ID to the Animator. public virtual void ChangeMagicID(int value) { MagicID += value; anime.SetInteger("MagicID", MagicID); //Debug.Log (MagicID); if (MagicID < 0) MagicID = 0; } }
Magic Physics Script
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class MagicPhysics : MonoBehaviour {
public bool UseExplosion; public float radius = 5; public float power = 250f; public float height = 3.0f; public ForceMode forceMode; public LayerMask applyForceLayer; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (UseExplosion == true) { Vector3 explosionPos = gameObject.transform.position; Collider[] colliders = Physics.OverlapSphere (explosionPos, radius, applyForceLayer); foreach (Collider hit in colliders) { Rigidbody rb = hit.GetComponent<Rigidbody> (); if (rb != null) rb.AddExplosionForce (power, explosionPos, radius, height, forceMode); // Debug.Log ("-- YES Physics -- "); } } } }
Crappy Tutorial Video (Updated with Sound june 10/2012)
Projectile Tutorial w/Knockback tutorial
|
|
|
Post by uberwiggett on Jun 2, 2017 17:56:15 GMT
thoughts are simple, how much and when can I have it?????!!!!
|
|
|
Post by Invector on Jun 2, 2017 18:14:45 GMT
I've never seen a V-bot as powerful as this one - awesome!
|
|
|
Post by steak on Jun 2, 2017 18:27:14 GMT
I see you've also bought the "realistic spell effects 4" pack. :D
I haven't even gotten around to starting to figure out how I wanted to implement them into my game yet, as I've still been working on level designs and NPC interaction.
This looks amazing!
|
|
|
Post by shadex on Jun 2, 2017 18:36:11 GMT
thoughts are simple, how much and when can I have it?????!!!! Free, and pretty soon. I'll put a donation page up if people think it's worth the money. I wanted to go the paid route, cause i like money, but i decided against it. In the end if you use it in your game, give me some credit for it. Besides, like i said, i hope it will spur a few people to release some new add-ons. I am sending the beta to therindu to test it out today or tomorrow. After a sanity check, and a little code clean up, i will release it here. I am stuck on one piece of inventory code, trying to set a variable when an custom enum item is equiped, once i can figure that out, it will be fully integrated into the inventory system.
|
|
|
Post by shadex on Jun 2, 2017 18:40:23 GMT
I see you've also bought the "realistic spell effects 4" pack. :D I haven't even gotten around to starting to figure out how I wanted to implement them into my game yet, as I've still been working on level designs and NPC interaction. This looks amazing! It's designed to work out of the box with just about any spell system, including Realistic Spell effects pack 1-4. Most effects are split into trail randerer's for the hands, projeciles and Explosions. This pretty much allows you to attach a damage script (like vObjectDamage) to the explosion with a sphere collider and your pretty much done. I checked the workflow and it takes me about under a minute to actually prototype a spell, and then it's just adjust it afterwords.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 2, 2017 18:44:28 GMT
shadex can we see the working bow and arrow? :-) spell system looks great!!! Keep up the good work :D
|
|
|
Post by uberwiggett on Jun 2, 2017 18:57:38 GMT
I have the spell effects ready to go, just been building them into shootable wands and staves, being able to actually have an equipable spell system though is perfect and from what I can see in the videos is really hitting the spot. Will definitely offer donation for the effort and credit on any projects I use it in, it looks super good!
|
|
|
Post by shadex on Jun 2, 2017 19:15:23 GMT
shadex can we see the working bow and arrow? :-) spell system looks great!!! Keep up the good work :D OK :p You can change up the arrow, trail effect and all of that. I figure the shooter is a better place to do the bow and arrow system anyways, but it was super easy to setup and i know a bunch of people wanted something along those lines.
|
|
|
Post by shadex on Jun 2, 2017 19:18:09 GMT
I have the spell effects ready to go, just been building them into shootable wands and staves, being able to actually have an equipable spell system though is perfect and from what I can see in the videos is really hitting the spot. Will definitely offer donation for the effort and credit on any projects I use it in, it looks super good! Well the cool thing, is it works with the AI out of the box. Not just invector's, but ice creature control as well, since it rely's almost entirely on state machine behaviors, which the AI's trigger. So it will be easy for you to transfer all of those spells to the spell system for the enemy's as well as the player. I gotta try the Ice bridge soon, and setup a fire breathing dragon. I already have a lizard-man who spits acid.
|
|
|
Post by uberwiggett on Jun 2, 2017 19:26:52 GMT
I see though the attacks all have a lock on, are they able to be triggered much like the shooter mechanics without the lock on?
|
|
|
Post by jrackley on Jun 2, 2017 19:31:16 GMT
shadex , what more can be said. This is amazing and I can not wait to use this. I will not lie we were tempted to go with ootii for a few as we also own that controller and it has bow and swimming and climbing and a magic pack getting released using Realistic Spell Effects 4 as well. But truth of the matter, the Invector controller is far better to use and people like you, tharindu, chronic,uberwiggett, zelda and the rest of this community is what makes this HANDS DOWN the BEST! You guys F@%&!ing rock for real! Now maybe we can start making good progress in our game again which you will all have a free copy to by the way if wanted. Thank you for all of the work you all do, and maybe I can step my game up some if time permits and try to work on the armour system, but I am not as good a coder as the rest of you for sure, we will see though that is how you get good right!
|
|
|
Post by steak on Jun 2, 2017 19:54:52 GMT
Man, if you do release this, it will save me a crazy amount of work. Definitely post some way to donate to you, and I'll gladly throw some money your way
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 2, 2017 20:32:39 GMT
shadex thanks Bow definitely looks cool!!! jrackley absolutely agree, this is a great community!!!!
|
|