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. Dismiss Notice

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v8.0 : advanced damage system]

Discussion in 'Assets and Asset Store' started by reuno, Dec 18, 2014.

  1. steelhamsterstudio

    steelhamsterstudio

    Joined:
    Mar 15, 2018
    Posts:
    29
    @reuno I found some problem with SFX and FX in default script if the player starts spamming "fire button" it plays FX and SFX right on the button pressed not when weapon used.

    Finally, I found the way to make combo chain smooth and it doesn't be interrupted by other abilities. Now I need make customizable caused force and damage to each attack separately.
     
    Last edited: May 3, 2018
    VisamP and Muppo like this.
  2. Prog-Maker

    Prog-Maker

    Joined:
    Mar 6, 2017
    Posts:
    20
    I'm sorry, but I found a little inaccuracy in the code. In the MMMovement script yield return 0 is better to replace with yield return null?
    This code creates garbage because the int with a value of 0 is boxed
     
  3. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @skayster, @Muppo > Thanks for the suggestions! Most of these were already on my list, I'll rearrange priorities based on that.
    @Prog-Maker > Thanks for reporting this, I'll fix it in the next release!
    @steelhamsterstudio > That sfx thing looks like a bug indeed. Thanks for mentioning this! Let me know if you need an urgent fix for that.
     
    steelhamsterstudio and Muppo like this.
  4. AbsurdMcMan

    AbsurdMcMan

    Joined:
    Apr 11, 2018
    Posts:
    3
    Re. the gliding :D glad to see this recommendation, this is what I've tried and setting it to -1 has been working quite well (if with a few small bugs).

    Things I've been having to fiddle with to get working are 1) stopping the glide when hitting the floor and walls (code added below - not perfect for now, but more or less working); 2) not allowing you to glide when already touching the floor (imagine this will involve a bool for IsGrounded?); and 3) there seems to be a bug when pressing the Jetpack / Glide button and on the floor where the character starts to Jetpack / Glide and gets stuck a couple of pixels above the ground (if anyone has any thoughts on this and whether it will likely be solved by adding in a check for IsGrounded, that would be great!)

    Have added this into the existing Jetpack code under ProcessAbility for the floor and walls:

    //added - stop JP glide when touching the ground from gliding animation
    if (_controller.State.IsCollidingBelow && (_movement.CurrentState != CharacterStates.MovementStates.Jetpacking))
    {
    TurnJetpackElementsOff();
    }
    //added - stop JP glide when touching the left wall from gliding animation
    if (_controller.State.IsCollidingLeft && (_movement.CurrentState != CharacterStates.MovementStates.Jetpacking))
    {
    TurnJetpackElementsOff();
    }
    //added - stop JP glide when touching the right wall from gliding animation
    if (_controller.State.IsCollidingRight && (_movement.CurrentState != CharacterStates.MovementStates.Jetpacking))
    {
    TurnJetpackElementsOff();
    }

    Anyway, completely new to coding (and game design in general) and loving this engine so far for how intuitive it's proving to be! Going to give it another week or so to fiddle around and if no major issues arise it's going to get a solid 5* rating from me :)
     
    reuno likes this.
  5. prethon

    prethon

    Joined:
    Mar 14, 2017
    Posts:
    19

    That's all I need, a sword combo system.
     
  6. Prog-Maker

    Prog-Maker

    Joined:
    Mar 6, 2017
    Posts:
    20
    Ok. See also scripts - CharacterDive, CharacterJetpack,
     
    reuno likes this.
  7. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
  8. breeme

    breeme

    Joined:
    Mar 17, 2014
    Posts:
    21
    Hello. Thank you for a wonderful engine.

    I am trying to add 3D characters based on "Solider3D". And I have only one problem.
    In "Solider3D", the character is always looking sideways against the camera, but in my case the character is always watching the camera.

    How can I solve it?
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @breeme > The best way to do this is to nest your model one level below your character, inside an empty gameobject. You can then turn it however you want, and you separate your model from the logic. That's how most 3D examples in the engine are made, and general good practice :)
     
  10. breeme

    breeme

    Joined:
    Mar 17, 2014
    Posts:
    21
    It is perfect as I wanted. Thank you very much! :)
     
    reuno likes this.
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
  12. steelhamsterstudio

    steelhamsterstudio

    Joined:
    Mar 15, 2018
    Posts:
    29
    @reuno I have a question about Damage On Touch and melee weapon. Sometimes enemy's knockback is not in the right direction relative to the player. I also try to customize knockback force for each attack, but when I try to set different force to the Vector2 it doesn't take any result and uses the default parameter. How can I solve this problem?
    damage area.jpg Character's damage area

     
    Last edited: May 6, 2018
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @steelhamsterstudio > I just gave it a try with v4.5.1, the MinimalSword weapon, and a Blob enemy, and it works just fine. Changing the Damage caused knockback force has the expected result. Give it a try. Not sure why it wouldn't work in your case, I'd need more details.
    As for the knockback direction, right now it "pushes" CorgiController equipped characters (which I guess is the case for your enemy here) in the opposite direction of their current speed, which I understand doesn't fit your use case at all. I can add an option to sort this out.
    But please, if you think you've found a bug, please use the support email, it's very hard for me to keep track of things otherwise, I get way too many requests, and if there was indeed a bug it'd be hard to follow up. Thanks!
     
  14. steelhamsterstudio

    steelhamsterstudio

    Joined:
    Mar 15, 2018
    Posts:
    29
    @reuno I do not think it's a bug, in fact, all works fine, but I try to find out what conditions affect this situation. I think I'll find the right way to take more control on it, thanks for the answer.;)
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @steelhamsterstudio > Let me know if the knockback force thing persists though, because if changing the vector doesn't have an effect, that'd be a bug :)
    I'm gonna add more options for the knockback direction though, that's a great suggestion. Let me know if you want this before the next release.
     
  16. skayster

    skayster

    Joined:
    Aug 12, 2017
    Posts:
    46
    A knockback that stuns the enemy would be amazing :)
     
    reuno likes this.
  17. cursedtoast

    cursedtoast

    Joined:
    Apr 27, 2018
    Posts:
    62
    Hey reuno,
    Super interested in your engine. It looks great from what I've seen. Very nice job.

    I do have a question on if this is appropriate for the kind of game I am planning to build. I know this is non-physics based, which is great for most platformers. I am planning a 2d puzzle platformer. For example, some of the puzzles will require grabbing a orb/ball object and rolling it down a slope, so it lands in a slot designed for the orb object.

    Does CE support some basic physics like objects rolling down slopes? Most of the puzzles I can think of aren't heavily physics based, so I don't want to make a strictly physics based game if Corgi can get the job done. Thank you.
     
  18. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @cursedtoast > The character controller is indeed non physics based.
    But that doesn't mean you can't have physics in your scene for other stuff. There are a few examples of that in the engine actually. Grenades for example are standard Unity physics powered. So really as long as you're not expecting your character to, for example, apply weight on a platform to have it crash somewhere, you'll be just fine. And if it's just a ball rolling around, that should be no problem at all :)
    I hope this answers your question!
     
    cursedtoast likes this.
  19. cursedtoast

    cursedtoast

    Joined:
    Apr 27, 2018
    Posts:
    62
    @reuno Thank you very much for the incredibly fast reply (I wasn't planning on checking back on the forums until tomorrow)!

    Excellent, that's actually really good to know. I am going to make a purchase shortly. Very excited to learn the engine tonight.
     
    reuno likes this.
  20. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @cursedtoast > You're welcome, good luck with your project!
     
  21. supermarten

    supermarten

    Joined:
    Oct 12, 2014
    Posts:
    9
    Hello again,
    I have pauses/freezeframes in my game when getting hit etc. I do these by temporarily changing Time.timescale to 0.
    I've noticed that WasGroundedLastFrame gets set to false when time is stopped so sometimes my player interprets this as if it had just been grounded after the timescale is resumed.

    Is there something in the engine that could cause this, and in that case do you have a workaround?
    or is it on my side?
     
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @supermarten > Interesting question! My guess is that most of the calculations happening in CorgiController are based on Time.deltaTime (which you basically kill), but run at Update (which keeps on running). So typically here I can see how it'd consider that you weren't grounded last frame. I'm adding freezeframes and better time control options to the next version anyway (it's ready, just not plugged in yet), I'll fix this as well! Thanks for reporting this.
     
  23. supermarten

    supermarten

    Joined:
    Oct 12, 2014
    Posts:
    9
  24. MisterDeum

    MisterDeum

    Joined:
    Apr 14, 2015
    Posts:
    24
    I am actually quite late to the suggestion party, but I mostly agree with the folks here.
    What would be nice would be :
    A patrol pattern more "realistic" walk take a break walk take a longer break and so on"
    A zone where you can limit the patrol would be cool too.
    Detection would be nice at least something where you can command to the IA to do something specific by knowing when the IA sees the player instead of rushing to him whith the walk on sight. A parameter or something that you can get when he sees you.
    Make him less sticky to the character once reached and more natural once he tries to it you. Make him take a step back.
    And of course a combo system but I know you are working on it.

    I will see if there is something else but all of this should elevate the Corgi IA that is quite simple for now.
    For future updates a ledge grab and stairs would be cool but we already talked about that. And don't forget about limits for a room and not just limits for an entire level, this would help the castlevania feel, the camera stopping at the edge of a room and you can continue to walk in a mini hallway to exit.

    Thanks a bunch. Your efforts are always appreciated. Going to buy the corgi endless runner now for an entirely new project.
     
    reuno likes this.
  25. MisterDeum

    MisterDeum

    Joined:
    Apr 14, 2015
    Posts:
    24
    I experiencing something strange too with that. When your character is hit, he goes back a bit but when he is attacked again without moving he goes a bit forward making him do the yoyo for each attacks. I would think the player should always goes back instead of coming back and forth. Maybe I am doing something wrong.
     
  26. skayster

    skayster

    Joined:
    Aug 12, 2017
    Posts:
    46
    Speaking of less sticky AI, it would be nice if when follow on sight turns on the AI stops at 1x distance, but only starts following again when the player is at 2x distance. That way it would eliminate that weird follow pattern at the very end of the raycast.
     
    Last edited: May 8, 2018
    MisterDeum likes this.
  27. MisterDeum

    MisterDeum

    Joined:
    Apr 14, 2015
    Posts:
    24
    Oh yeah and there would be a return to patrol mode and zone once the player is out of sight for a certain amount of time, maybe something that we can get from a property to customize the IA behavior too.

    That will be all. Thanks.
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @MisterDeum > Regarding damage, you're not doing something wrong, the system is doing what it's been designed to do, but it needs more options to fit all possible needs, and I realize now that what I went for isn't necessarily the most common use case :) I'll add more options in the next release. And thanks a lot for all the suggestions!
     
    MisterDeum likes this.
  29. breeme

    breeme

    Joined:
    Mar 17, 2014
    Posts:
    21
    Hello, I have a easy question.
    Where can i replace image of "Inventory Selection Marker".
    It is display the default image, when i play game.
     
  30. Shturmovik

    Shturmovik

    Joined:
    Nov 5, 2014
    Posts:
    29
    Inspired by recent discussions about AI: any other users of Opsive's Behavior Designer out there? I'm currently working on integrating this with Corgi, so let me know if this catches your interest. I may have stuff to share.
     
    reuno likes this.
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @Shturmovik > I've never used it myself but I've only heard good things about it. I'd be happy to know more about how it went.
    @breeme > You can simply remove the existing one and add your own. All you need is the InventorySelectionMarker component on it.
    But the default one is just a simple sprite with an animator, you can simply replace those from the inspector.
    I'm not sure why it'd revert to default though, unless you haven't disabled or updated the animator, in which case it'd be quite normal :)
     
  32. Shturmovik

    Shturmovik

    Joined:
    Nov 5, 2014
    Posts:
    29
    Regarding the Behavior Designer integration, I'd be happy to share the code when it's a bit more stable. I'm working on getting a set of BD tasks together that more or less mimics what's available in the official add-on packs (movement, tactical, formations) as well as the integration with Opsive's own Third Person Controller. This should make it possible to create quite complex AI systems based on ammo availability, current health status, aggression level and so on. My results so far have been well worth the effort, but it's still work in progress.

    Only problem is that I've modified the Corgi code base heavily to handle a combat system in true 3D for a 2.5D project (sounds stupid, but it makes sense in context) and have replaced all audio components with FMOD stuff - but it should still be possible to make most of the BD integration work in a plain vanilla Corgi project.

    If anyone out there is interested, I'll try and get it into shape for general use in the near future, otherwise I'll wait until after the gameplay prototype I'm working on is finished.
     
  33. breeme

    breeme

    Joined:
    Mar 17, 2014
    Posts:
    21
    I can found it! Thank you!
     
    reuno likes this.
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @Shturmovik > Now I think I'm more interested in seeing your true 3D combat system (and its context)! Seems exciting!
     
  35. lmgginspace

    lmgginspace

    Joined:
    Nov 22, 2012
    Posts:
    34
    I'm thinking about buying the corgi engine, but I have a question.
    It's compatible with Unity 5.6?
    Because it's not clear. In the asset store page, it says unity 5.3+. In the update log in the last updates it states Unity 2017 is needed.
    Which is the true answer? We are limited to Unity 5.6 where i work.
     
  36. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    As fas as I know, it's compatible but you will miss all the stuff added before that version.
    If you have the chance, use a separated installation of 2017 because last updates do worth it.
     
    reuno likes this.
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @lmgginspace > You'll learn more about that in the first, highlighted question of the FAQ :
    http://corgi-engine.moremountains.com/corgi-engine-contact#faq
    But basically each Engine version comes with a Unity requirement.
    5.6 will get you v4.0 of the Corgi Engine (IIRC).
    So it's "compatible", in that you'll get this old version, but it may come with a few bugs that have been fixed in subsequent updates, and if you stick with 5.6 you won't get the new stuff, that usually relies on new Unity features such as the Tilemap for example.
    Alternatively you can grab the latest via a 2017/2018 install, and try to just remove the "new" stuff.
     
  38. jalex01x

    jalex01x

    Joined:
    Sep 26, 2017
    Posts:
    5
    Hello, and thank you for writing Corgi Engine!

    I just purchased it yesterday and am working on an exciting new project, the controls are super tight and I love them!

    There is a particular mechanic that I am trying to figure out how to implement inside of your engine, and I'm not sure if it's already supported. I know the demo had pushable crates but I'm looking for something a little different.

    The ability to pick up a block and throw it, but this block also has collision that the player can jump on and use to reach higher platforms. A good example of this is spelunky where you can pick up things and throw them as a weapon, or in legend of zelda where you can pick up pots and throw them.

    I was able to make this work with standard unity physics but I'm not sure how to approach it from the corgi engine's controller and collision methods? How can I have my character "throw" a block after picking it up? (That's the part im having trouble with)

    I know this is a bit of a physics simulation problem, I just need really simple directional throwing. If this is beyond the scope of the help thread I understand.
     
  39. Ssssilk

    Ssssilk

    Joined:
    Jul 28, 2014
    Posts:
    12
    Looking for a Corgi Engine expert for a paid, freelance project.

    (Apologies if this shouldn't be posted here, but looking for people specifically comfortable with Corgi engine.)

    Looking to create a 2d action platformer-- the initial goal will be to integrate a custom, Spine-animated character and to create a *small* test level as a Phase 1.

    Please PM any relevant examples and I'm happy to provide many more details.

    Thanks!!
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @jalex01x > That's a very good question.

    Let me just clarify a few things (you may already know this but maybe it'll be useful to others). The Corgi Engine's controller is not physics based, it's raycast based. That's the whole point of the engine, and what makes its strength. The good thing is it'll give you tight controls and collisions, and overall more control over how things behave, the downside of course is your character won't be able to natively push stuff (but there's an ability for that), or tilt a platform using its weight, that kind of stuff.

    But that doesn't mean you can't have physics in your game! The grenades for example, thrown by the grenade launcher demo weapon, are physics based, and work just fine. So in your case I'd do just that. I'd say your problem has two aspects : grabbing and holding an object, and throwing it.

    The first part can be done in many different ways, the easiest could be to have the character trigger with the object somehow (direct collision, entering a zone), and automatically or on the press of a button, have the object move above its head maybe, and then parent it to the player. That way it'll follow the player around and it'll look like the player is carrying it. For that you'll want your object to have physics properties normally, but you'll turn its rigidbody to kinematic when it gets picked, rendering it immune to gravity and easy to manage.

    Now for the throwing, you could simply turn it non kinematic on the press of your "throw" button, and add a force to it. Again that's how the grenades work so you can look at that for reference. The object will fly in the air, fall down, maybe bounce a little, and if you've set it up properly (platform layer mostly), you'll be able to climb on it (the pushable blocks would be a good basis for that).

    I hope this helps!

    @Ssssilk > You can (and should) absolutely post that kind of things here, it's completely ok.
    You may want to try your luck in the jobs section of the forum as well (I guess there's one?).
     
    wagnerps and jalex01x like this.
  41. breeme

    breeme

    Joined:
    Mar 17, 2014
    Posts:
    21
    I am using on 5.6.5f1.
    no problem now.
     
    lmgginspace and reuno like this.
  42. jalex01x

    jalex01x

    Joined:
    Sep 26, 2017
    Posts:
    5
    I have been working on this all night, really trying to get it to work here! :)

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ChestPickup : MonoBehaviour {
    6.  
    7.     private Rigidbody2D rb2d;
    8.     //private bool carrying = false;
    9.     public Transform carryPoint;
    10.     public GameObject objcarryPoint;
    11.  
    12.     void Awake()
    13.     {
    14.         rb2d = GetComponent<Rigidbody2D>();
    15.     }
    16.  
    17.     void FixedUpdate()
    18.     {
    19.  
    20.         if (Input.GetButton("Player1_Shoot"))
    21.         {
    22.             //Draw raycast to the right, layer 9 only tested for collision(Player)
    23.             Physics2D.Raycast(transform.position, Vector2.right, .7f, 9);
    24.             Debug.DrawRay(transform.position, Vector3.right, Color.red, .7f);
    25.             //Draw raycast to the left, layer 9 only tested for collision(Player)
    26.             Physics2D.Raycast(transform.position, Vector2.left, .7f, 9);
    27.             Debug.DrawRay(transform.position, Vector3.left, Color.red, .7f);
    28.  
    29.             RaycastHit2D hitR = Physics2D.Raycast(transform.position, Vector2.right);
    30.             RaycastHit2D hitL = Physics2D.Raycast(transform.position, Vector2.left);
    31.             if (hitR == null)
    32.                 Debug.Log("hitR null");
    33.  
    34.             if (hitL == null)
    35.                 Debug.Log("hitL null");
    36.  
    37.             if (hitR.collider == null & hitL.collider == null)
    38.                 return;
    39.            
    40.             else
    41.             {
    42.                
    43.                 //transform.position = carryPoint.position;
    44.                 carryPoint.SetParent(transform);
    45.                 rb2d.isKinematic = true;
    46.  
    47.             }
    48.         }
    49.     }
    50. }
    51.  
    I am getting the error
    Code (csharp):
    1. Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
    2. UnityEngine.Transform:SetParent(Transform)
    3. ChestPickup:FixedUpdate() (at Assets/Scripts/ChestPickup.cs:44)
    How can I access the cloned Player that corgiengine makes whenever the levelmanager respawns you? I need to parent to that instantiation instead of the actual prefab which is what im currently coded to do.
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @jalex01x > As explained in the documentation, you can grab its reference via the LevelManager.
    LevelManager.Instance.Players[0]

    Just search for it, there are multiple examples of that throughout the asset.
     
    jalex01x likes this.
  44. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Parenting is the key, indeed.
     
    Mindjar and AtomDesign like this.
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @Muppo > I love this tiny dude of yours.
     
    Muppo likes this.
  46. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Thank you.
    Wait to see the others in the town, all rodents.
     
    skayster and reuno like this.
  47. jalex01x

    jalex01x

    Joined:
    Sep 26, 2017
    Posts:
    5
    It took me way too long, but I got the first half of my solution working for the pick-up and throw box.



    Turns out I was using layermasks wrong, I was trying to pass "9" into the Raycast but I needed to write 512. I was getting so confused why it wouldn't detect the player!
     
    wagnerps, skayster and reuno like this.
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @jalex01x > Congrats!
    Another way to handle layermasks is to have a "public Layermask myLayermask" in your ability.
    This will translate into a handy dropdown in your inspector. Then you can simply pass that value to the raycast method. No more unreadable int!
     
  49. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    I'm working on a shooter where the player will need to both crouch behind cover and fire from a prone position. For that reason, I need to update the Crouch/Crawl states so that they persist after the key is released. In other words:

    Idle --> Press Down --> Crouch
    Crouch --> Press Down --> Crawl
    Crawl --> Press Up --> Crouch
    Crouch --> Press Up --> Idle


    I studied the code and dox, and it looks like I only need to make three changes

    1) Change "Handle Input" on CharacterCrouch.cs (line 55) to check down button and current state and set state "crouching" or "crawling" as needed

    2) Add an up button and current state check to "Handle Input" on CharacterCrouch.cs (line 55) and set state to "crouching" or "idle" as needed

    3) Add "is not crawling" and "is not crouching" state checks at lines 75 and 76 of CharacterLadder.cs


    Am I missing anything? Is there a better way to do it? Thanks in advance.
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,870
    @Boom_Shaka > I guess the best way to know would be to try it :) It's quite hard to tell otherwise.
    Note that "crawling" in the context of the engine means "moving while crouched", which I understand can be a bit misleading.
    So I'd suggest creating another ability to handle all that, it's usually much faster, as it's really a different feature. You can use the Crouch ability as a base, but it seems like something quite different. Anyway, the only good or best way to do things is the one that works for you.