Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  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. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @RadTT > There are already labels in the engine that allow you to differentiate between decisions and actions. I'm guessing you're running an older version. They look like that :

    upload_2019-1-25_12-26-35.png
     
  2. captnhanky

    captnhanky

    Joined:
    Dec 31, 2015
    Posts:
    97
    Thank you!
     
  3. RadTT

    RadTT

    Joined:
    Nov 9, 2016
    Posts:
    7
    @reuno ah hah! I was on 5.2.

    Now that I'm updating, this reminds me of another thing I wanted to ask about. Given that the CharacterStates class uses enums, how would you recommend going about extending this to add custom states? My current solution was to update the class directly, which will of course get overwritten when I update and I'll have to track these updates separately. Any better solution?
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @RadTT > Unfortunately no, there isn't a better solution. In the current state of C#, enums can't be extended, and I haven't found a design pattern to substitute to this one that wouldn't turn things too complex unnecessarily. I'm open to suggestions, as this, and part of the InputManager, for the same reason, are the only parts of the engine that can't be easily extended, and I'd of course love to improve that. So modifying the base class and keeping track of your changes when updating using version control is the recommended way of doing things for now.
     
  5. RadTT

    RadTT

    Joined:
    Nov 9, 2016
    Posts:
    7
    @reuno thanks for the quick replies. If I can think of a good solution I'll throw it out there. For now, updating the class directly isn't too big of a deal, and it's good to know that this restriction is only found in a couple places across the engine. Thanks for the help!
     
    reuno likes this.
  6. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Hi,

    I think there is a bug with inventory management when used together with PickableWeapon. I would like the player to be able to pick up a weapon and use it right away, and show up in the Weapon Inventory. If I added both PickableWeapon and InventoryPickableItem, the weapon will be added to the inventory, but not equiped. If I tried to equip it through the inventory screen, it will try to swap itself by calling CharacterHandleWeapon.ChangeWeapon() and ended up destroying the its own gameobject.

    Any suggestion on how to get my desired behavior?

    Thanks, Allen
     
  7. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @achan_unity > Please use the support email if you think you've found a bug.
    In this case, that's not a bug, that's just not how these classes work.
    The PickableWeapon is not meant to work with inventories, quite the opposite. It's to be used when you don't have one, and you just want your player to equip a weapon when colliding with the picker (think the flower power up in Mario).
    To get what you're after you'd just need a simple class that calls Equip once the object's been picked. Extending InventoryPickableItem for that would be the way to go.
     
  8. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
     
  9. Mindjar

    Mindjar

    Joined:
    Aug 13, 2013
    Posts:
    29
    @Boom_Shaka @reuno - Thanks guys!
     
  10. captnhanky

    captnhanky

    Joined:
    Dec 31, 2015
    Posts:
    97
    Hi!

    I just pressed reset in the unity input manager.
    Now there is an error:
    ArgumentException: Input Axis Player1_Horizontal is not setup.
    ..but there is no player_1 in the settings.

    How can I restore the corgi settings?

    Thanks
     
    Last edited: Jan 27, 2019
  11. Mcg

    Mcg

    Joined:
    Mar 28, 2012
    Posts:
    114
    hi @reuno I'm getting strange behaviour when using a 3d animated character with gravity fields/zones, I've replicated the same character settings from the rectangle player just however I seem to consistently get strange behaviour like these gifs but not when using sprite renderer based characters and wondering what can be causing this?



     
    Last edited: Jan 27, 2019
  12. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @captnhanky > Make a fresh install of the engine, grab the settings from there. Or use version control and roll back to before you did that change.
    @Mcg > I'm not sure what's wrong here, but I'm pretty sure it has nothing to do with animation. You're probably missing another setting. I'd need more info to be able to replicate and help. Please use the support email for questions like this, thanks.
     
  13. Ryofougere

    Ryofougere

    Joined:
    Feb 14, 2016
    Posts:
    1
    HI !
    I just came here for a little question, and by searching the answer i didn't found it yet. Sorry as i am sure someone must had the same question.
    I am using your engine for our next prototype and i was wondering why it has 15 animations with one frame each for the jump animation.
    Is that the way you do to have an evolution in the animation depending on the lenght of the jumping time?
    As an animator, i felt a little bit surprised but in the same time if it is that, i am sure to be able to create a really nice jump feel.

    Thanks a lot for the answer, hope you understood my question

    best regards

    Rinaldo
     
  14. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    Hi here, is there a feature about spring?:) I am making a spring for character bounce-jump...
     
  15. captnhanky

    captnhanky

    Joined:
    Dec 31, 2015
    Posts:
    97
    Hi!

    Is there a dedicated place for making suggestions for an upcoming version of the corgi engine?

    Thanks!
     
  16. lsflet

    lsflet

    Joined:
    Aug 15, 2014
    Posts:
    6
    Hi I am now trying an enemy attack AI with animation
    I am following
    https://corgi-engine-docs.moremountains.com/advanced-ai.html
    to create a Patrol->Attack AI for detecting and attacking player , which exactly the same logic with the example above.

    then I follow
    https://corgi-engine-docs.moremountains.com/weapons.html
    to create a melee weapon to make a attack of punch which integrating a 1.2 seconds length animation

    At the melee weapon script, I set the transition parameter of the attack animation to the Start Animation Parameter.
    Under Damage Area Timing, I set Initial Delay as 0.3 seconds and the Active Duration as 0.9 seconds to fit my animation.
    For the attack animation in animator, I already set the transition as Fixed Duration and no exit time.

    At runtime , there have two problems:
    1. The attack animation cannot be played completely, it just play about 0.3 seconds , but the damage area timing is triggered as my config correctly
    2. After attack once, it cannot keep attack/patrol as expected ( like the RetroSwordsman), it just return to Idle state.

    Thanks for the support and sorry for my poor english and simple questions.
     
    Last edited: Jan 28, 2019
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @Ryofougere > That's a blend tree (https://docs.unity3d.com/Manual/class-BlendTree.html).
    @Bagazi > I don't know what you mean exactly. There's a jumper class, if that's what you're after.
    @captnhanky > Yes, please use the support email for that.
    @lsflet > You probably need to setup your animator's transitions differently. All the engine does is update animator parameters. What you do with them is up to you (and just standard Unity at this point). If your animation doesn't play til the end, another transition is interrupting it. Make sure it doesn't happen. And if the brain works for the swordsman and not your character, then I'm guessing you're missing a decision, or something is setup differently. Comparing with the swordsman might help, as without any info it's impossible for anybody but you to guess what's wrong here. Please use the support email if the problem persists.
     
  18. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    I think what @Bagazi ask for Sonic like spring prefabs with sound, animation and all that stuff, not just the jumper on the demo.

    by the way, some posts before, I stated that my Jumper issues were solved replacing the box collider with a circle collider. Still having that random behaviour where Jumper script doesn't apply the set force some times. Can't find why yet.
     
    reuno likes this.
  19. Negrat

    Negrat

    Joined:
    Oct 1, 2013
    Posts:
    11
    Hi reuno,

    I noticed that the AI Brain component shows you the current state of the AI. It would be great if we could have something similar for the character controller so we can monitor our character states.
     
  20. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @Negrat > It already does for the controller :
    upload_2019-1-28_12-43-38.png

    And also for the Character (which is a different thing) :
    upload_2019-1-28_12-44-7.png
     
  21. Negrat

    Negrat

    Joined:
    Oct 1, 2013
    Posts:
    11
    Thank you! I'm feeling so stupid right now :)

    I've tested it a bit and I've found out that there is no "attacking/fighting/shooting" state. I was wondering what is the reason for choosing this.

    What I'm trying to do is to make a melee combo like described below:

    A melee attack (and its animation) has two phases:
    - the character is in the idle state
    - 1st phase - the actual attack: the attack starts and ends when the hit its delivered
    - 2nd phase - the recovery: the character returns to the initial pose, the attack ends here.

    If the player presses the attack button during the 2nd phase, the character should go directly to a new attack.

    Hope it makes sense, english is my second language.
     
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @Negrat > It'd be a very bad design pattern to have a "attacking" state in a context where you can equip any number of weapons and use them all at once, while jumping/dashing/whatever. And you can not only attack, but also be waiting between attacks, reloading, etc. That's why it's much better to have that state on the weapon instead. That way you can be jumping and reloading weapon1 and preparing an attack on weapon2.
    And I don't see what's preventing you from setting up an attack like the one you describe right now. Don't hesitate to look at the documentation and examples of combo weapons included in the asset, that'll explain all there is to know about weapons and will give you more info on that subject.
     
  23. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    240

    Might I suggest how they deal with the enums problem in this architecture talk? It's actually quite elegant and you could do a lot of things that would make it more friendly for non-programmers. I've used this pattern a lot and eliminated most any enum that I expected to extend.

    The talk about enums is about 45 minutes into the video.

     
  24. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @ScourgeGames > That's a great pattern, and the one I use something quite similar at work and for my own stuff.
    Unfortunately, I tried that in the engine at some point and had to revert, people didn't understand it and it made things way too cryptic and hard to use for beginners.
     
  25. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    240
    That is a bummer. It is a really good pattern. But I completely understand wanting to keep it simple for beginners. The engine is really attractive to beginners (even though some pretty advanced stuff can be done with it), and making it harder to use is not such a great idea.


    I am enjoying the code you have written and have learned a lot just from seeing how you created so much. Advanced developers or even mid level coders can extend things quite easily.


    Good stuff.
     
    reuno likes this.
  26. zmatiaki

    zmatiaki

    Joined:
    Nov 21, 2018
    Posts:
    13
    Hey Guys,
    Thanks for the tips. I will look into it and get back to you!
     
  27. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Thank you Reuno for the help so far.

    Right now, I have the same Weapon used by both the Player and the Enemies - and I set the Target Layer Mask to cover both Player and Enemies. The issue with that is that Enemy can now hit other Enemy. I suspect I have to extend DamgeOnTouch class that was initiated by the Weapon to check for Friends vs Foes.. but is there a better way?

    Thanks,
    Allen
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @achan_unity > A much better and easier way would be to have two weapons, each with their own layer mask, even if they look the same and have the same properties otherwise.
     
  29. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Yeah, I know.. but I am hoping my game will have lots of weapons - and maintaining both version kind of tedious and make weapon drop difficult (as I have to remember to drop the right version). Your idea gives me a new idea though. I extended the MeleeWeapon class and added 3 new LayerMasks (Friends, Enemies, Common) and overrode the SetOwner() and CreateDamageArea() function to check the owner and set the TargetLayerMask accordingly. It works!
     
  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
  31. Negrat

    Negrat

    Joined:
    Oct 1, 2013
    Posts:
    11
    Thank you reuno and sorry for the late reply! Job :(

    Could you give me a starting point for the melee setup? How would you approach this?
     
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @Negrat > As I said, look at the combo weapon examples, they're already doing pretty much what you're after. You can also look at the weapons documentation, it details how to go with it.
     
  33. BeardRetro

    BeardRetro

    Joined:
    Mar 30, 2014
    Posts:
    4
    I'm have an issue with getting doors to work with keys and I'm not sure if there's something unrelated that I'm not seeing somewhere.

    I've been building on top of the Retro Clouds demo scene (duplicated it and swapping out assets, etc) and I'm trying to add doors now. After looking at the documentation and creating keys/doors in the same way that was in the documentation and in the tutorial video, my "Opening Zones" on my doors won't open with the key that has the appropriate Key ID. I've changed my key assets to target the RetroInventory that's already in the scene and the keys are showing up in my inventory when I pick them up. They just won't open any door that they're supposed to. When I turn off "Requires Key" on my Key Operated Zone, the doors open just fine.

    I've taken a look at the Minimal Keys demo scene and even copied and pasted those assets into my own scene (again, changing the target inventory to the actual inventory in the scene itself) and the door stops working. I've tried everything that I could think of. I even tried using the RetroYellowKey that's already in the scene to open a door that I made (changing the required Key ID for the door) and it still didn't work. I have a feeling there's something going on with the Key ID, I just can't seem to sort out what could be causing the doors to ignore the key with the ID that they're looking for?
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @F1GHTOFFYRDMNS > Does the problem happen in the key demo scene as well? No changes made? If not, it may be a good starting point. Without more info I don't know what could be the problem here. If that persists drop me a line on the support email, thanks.
     
  35. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    is there any reason for the player character to jump and still be stuck in the animation when landing on a collider?
     
  36. DMRhodes

    DMRhodes

    Joined:
    May 21, 2015
    Posts:
    81
    Hey there. I could use a tip please. My character uses individual body parts instead of a sprite sheet so I'm having issues with the rectangle animator. Basically I have the default idle animation facing to the right but also an idle left animation for when the player faces the left. When I face right everything is okay, but when I turn left it constantly stutter flips back to the right. I would like the character to continue facing the direction the player moved him in though.

    What would you suggest? Thank you for your time.
     

    Attached Files:

  37. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    I had the same issue...check your animator and make sure all your states are finite. I'd recommend making a new one and not using the one that came with the package.
     
    Last edited: Feb 1, 2019
    reuno likes this.
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @o0neza0o > Never heard of that issue, I'd need context to be able to help. On what demo can I reproduce the problem?
    @Candy-Bomber > Either disable flip on your Character component, or have both animations facing right, and let the Character component flip the left one. And in any case you'll probably want to use a different animator graph, this "any state" pattern is really for demo purposes, nothing more.
     
    DMRhodes likes this.
  39. DMRhodes

    DMRhodes

    Joined:
    May 21, 2015
    Posts:
    81
    Ah, thank you. I somehow missed the obvious flip character checkbox. Derp. Everything is working now.
     
    reuno likes this.
  40. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Hello, I have an object that will break and re-appear in game. I added a death effect and a respawn effect, which works but the problem is those effects did not go away, instead more are being added and the replay the effect endlessly. Is there an option to destroy the effect or do I have to write someone to make it go away?

    Thanks, Allen
     
  41. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @achan_unity > That's native in Unity, you can set that from your particle system settings. Alternatively you can use a script to do that.
     
  42. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Thanks. I saw the MM Auto Destroy script - which I can add to the death effect.

    On the other, I saw in the code Health.cs, there is a line around DamageEffect that says
    "// When the character takes damage, we create an auto destroy hurt particle system".. Looking at the code, I don't understand how the auto destroy is being achieved as it appears those effects are hanging around.

    This is all it does:

    Instantiate(DamageEffect,transform.position,transform.rotation);
     
  43. pry_bar

    pry_bar

    Joined:
    Mar 9, 2017
    Posts:
    8
    I encountered the same problem in Unity 2018.3.4
     
  44. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @achan_unity > I'm not sure I understand your question. Yes, the health script just instantiates an effect. It has nothing to do with auto destroy, and it shouldn't. That's handled, as mentioned before, either via another script, or via the particle system native way of auto destroying.
    @z_gangan > Please use the support email if you think you've found a bug, and provide some details (version you're running, steps to reproduce), thanks.
     
  45. pry_bar

    pry_bar

    Joined:
    Mar 9, 2017
    Posts:
    8
    Ok, I sent the mail.
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
  47. pry_bar

    pry_bar

    Joined:
    Mar 9, 2017
    Posts:
    8
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @z_gangan > The hint succeeded? What does this mean? I think I got your email though, but as I answered, please provide at least some info, I have no idea what you mean to say, or how to reproduce your problem.
     
  49. pry_bar

    pry_bar

    Joined:
    Mar 9, 2017
    Posts:
    8
    Please forgive me if I make any errors; my English is a little weak.
    https://imgur.com/RAMN7Bx <----Look This Here's a demonstration.
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,960
    @z_gangan > Once again, please use the support email to report bugs, and please explain your problem, I don't see nothing wrong with this video. Press play and you'll see your damage area just fine.