Search Unity

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v6.1 : auto scrolling levels, and more]

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

  1. JAMiller

    JAMiller

    Joined:
    Apr 2, 2009
    Posts:
    73
    Thanks, I am looking into modifying the controller. Unfortunately I have no experience with non-physics based controllers so it will be a learning process.

    If I could add on more thing, I notice there are inconsistencies with the flying & sliding in general:

    When colliding horizontally-45 it slides fine but then gets stuck on the bottom:


    When colliding up-45 it slides for one pixel at a time (stair stepping kind of)


    When colliding down with the floor it does not slide unless facing towards the ground


    I realize this is not a flying engine but a platformer engine. However I'm trying to make a platformer where flying is a big part of it, and there are lots of 45 degree angles so the inconsistent movement when colliding is not good. At this point I would even prefer no sliding at all from any angle to be consistent.

    If I can't figure it out I may look into pausing the corgi physics controller and using Unity physics-based movement when flying to get smoother results.
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @JAMiller > The "inconsistencies" come from the fact slopes and ceilings are handled differently. It is indeed a platformer engine. I wouldn't recommend it for a flying game. Actually if everything "flies", the TopDown Engine would be much better suited. If it doesn't, and it's only a punctual thing in your game, then either implement the changes I recommended, or indeed turn off the controller for a more simple one, a platformer controller is overkill if you just want to move around freely.
     
  3. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    I am in need of some assistance. I have manged to create various intractable platforms, but there is one that gets me an error I really couldn't decipher. I made a falling trap where the trap itself is an AI. It detects the player and moves with a chosen by me speed down. If it hits the Player he dies and the Trap as well. If the Trap touches my Platform ground, however everything stops. The trap has all the necessarily AI scripts, with just a small amount of Health. The problematic part is the DamageOnTouch script I added. I added the Target Layer Mask to Player & Platform, so when it hits a Player, the Trap takes and gives damage thus killing the Player and being Destroyed right after. This works. When it hits the Platform I get this:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. MoreMountains.CorgiEngine.DamageOnTouch.SelfDamage (Int32 damage) (at Assets/CorgiEngine/Common/Scripts/Agents/Damage/DamageOnTouch.cs:269)
    3. MoreMountains.CorgiEngine.DamageOnTouch.OnCollideWithNonDamageable () (at Assets/CorgiEngine/Common/Scripts/Agents/Damage/DamageOnTouch.cs:252)
    4. MoreMountains.CorgiEngine.DamageOnTouch.Colliding (UnityEngine.Collider2D collider) (at Assets/CorgiEngine/Common/Scripts/Agents/Damage/DamageOnTouch.cs:197)
    5. MoreMountains.CorgiEngine.DamageOnTouch.OnTriggerEnter2D (UnityEngine.Collider2D collider) (at Assets/CorgiEngine/Common/Scripts/Agents/Damage/DamageOnTouch.cs:152)
    I tried adding Health to the Platform too, as I thought maybe it crashes because the Trap can't deal the damage specified to the Platform as it did with the Player, but only take it when it hits the Platform. Didn't work. So yeah anything would be of help. I just want the Trap to be able to hit the Player and mutually kill each other and in case it missed it gets destryed but the Platform stays. Don't want to lose my ground.
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @kriyordev > I'm afraid it's impossible to tell what might be wrong in your code from just that error. I would suggest using the debugger to see what is actually null at that moment in time, as the error tells you, and fix things from there.
     
    KriYorDev likes this.
  5. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    116
    Hi! If I want use only the inventory system, what folder I need to import? thanks!
     
  6. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    104
    Maybe add a DamageOnTouch script to your platform and have it only target your trap? Your trap would only target the player. Just a thought.
     
    reuno likes this.
  7. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
  8. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    Hmm ok. Will continue to poke around.

    P.S. I haven't changed any code btw. Its just the way I described it and I use only the stock Corgi scripts.
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @kriyordev > Sure, but using the debugger to understand what's not working, in your code or the way you assembled the components, is still the best way to figure out what's wrong. Context is everything when it comes to a bug, and just that error, out of context, is not enough to do so.
     
  10. henkesky

    henkesky

    Joined:
    May 23, 2015
    Posts:
    36
    @reuno I was trying to set up more than one animations/ability for a particular weapon(to be able to perform more than one type of skill/ability with my sword), but it seems it can only have one melee weapon script and therefore one animation/skill. Is there a way i can add more than one skill to a particular melee weapon ?
    I tried to make another version melee weapon script with a different name and attach it to the weapon, so it can serve as a different skill, but it seems like character handler weapon only accepts gameobject with weapon melee weapon script.

    I have also noticed that my melee animations are played only half way. It starts, plays half way then stops immediately.
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @henkesky > A few remarks :
    - as explained in the documentation, the CharacterHandleWeapon expects a Weapon (whatever its type). Your script probably doesn't inherit from Weapon. It should.
    - if your animations only play halfway, you need to setup a better animator. There's probably another animation that cuts your attack animation. Unity has some good documentation about it.
    - each weapon has its own animations. If you have, for example, a sword, and want it to do multiple attacks, you can either setup a combo weapon, or create multiple weapons, both are viable options.
     
  12. henkesky

    henkesky

    Joined:
    May 23, 2015
    Posts:
    36
    @reuno Actually i did(i mean inheriting from weapon), but i mistakenly forgot to apply prefab.

    As for the animation, i noticed that i have to hold it down for like 3 secs for the animation to play completely, if i just press the button it plays half way. It doesn't even work at all for some of my clips. Just attempts to play then stops immediately. As for setting the animator correctly, am actually using corgi animator, i only changed nthe clips.

    I mean having the ability to use multiple different attacks, without having to switch weapons. I achieved this by using CharacterHandleSecondaryWeapon, and using an empty gameobject as the weapon. Now this is still not enough, i want the at least to be able to use 3 attacks, so am looking at creating CharacterHandleTertiaryWeapon . Now the problem is, does corgi engine allow creating two inventories in one project, whereby one will serve a purpose of actually equipping different weapons while the other will serve a purpose of secondary and tertiary weapon which in the actual sense are skills/abilities.

    Finally, for some reason, while trying to set damage area for my weapons, i can't see the colliders(the rectangular or circle collider) for the area size
     
    Last edited: Nov 29, 2018
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @henkesky > As explained in the documentation, I wouldn't recommend using the demo animators for all situations. They're based on an "any state" pattern, they're just for demo purposes. Each character is unique and deserves its own animator, there's no silver bullet when it comes to animators. So again, I'd check your transitions, it's highly likely your attack transition gets interrupted. Setup better transitions :)
    And yes, if you want more attacks, extending CharacterHandleWeapon into more Secondary (already in)/Tertiary etc is the way to go. And you will also need more inventories in that case, and maybe a few tweaks to the code depending on what you want to do, but that's all supported, yes.
    And I don't know why you wouldn't see the colliders, they're native Unity components.
     
  14. m039

    m039

    Joined:
    Nov 28, 2016
    Posts:
    1
    Hi @reuno! When I move my character onto a one way platform, he jumps up to the skies. Do you know what is it and how can I fix it?

    To reproduce this bug I took the MinimalLevel scene, added two OneWayPlatform200x25 and changed scale of Rectangle from (0.3, 0.3, 0.3) to (1.0, 1.0, 1.0). The result you may see on the attached gif. On the gif, I'm using only keys for moving left and right, not jumping.

    screencast 2018-11-29 19-15-44 (1).gif
     
    Last edited: Nov 29, 2018
  15. shyamlondonconsolidated

    shyamlondonconsolidated

    Joined:
    Apr 1, 2018
    Posts:
    35

    I have added that function into my script as well as onEnable and disable like so;

    Code (CSharp):
    1.      
    2.     public class ScoreManager : PersistentSingleton<ScoreManager>, MMEventListener<CorgiEngineEvent>
    3.  
    4. /// OnDisable, we start listening to events.
    5.         protected virtual void OnEnable()
    6.         {
    7.             this.MMEventStartListening<CorgiEngineEvent>();
    8.             TimedRewards.GetInstance().onClaimPrize += OnClaimPrizeTimedRewards;
    9.         }
    10.  
    11.         /// OnDisable, we stop listening to events.
    12.         protected virtual void OnDisable()
    13.         {
    14.             this.MMEventStopListening<CorgiEngineEvent>();
    15.             TimedRewards.GetInstance().onClaimPrize -= OnClaimPrizeTimedRewards;
    16.         }
    17.  
    18.  
    19.         public virtual void OnMMEvent(CorgiEngineEvent corgiEngineEvent)
    20.         {
    21.             if (corgiEngineEvent.EventType == CorgiEngineEventTypes.PlayerDeath)
    22.  
    23.             {
    24.                 Debug.Log("player died");
    25.  
    26.             }
    27.  
    28.         }
    29.  
    However when the player dies by the KillPlayerOnTouch, I am not getting the Debug.Log player died?
     
  16. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @m039 > That's normal, you'd need mid height one way platforms to handle this scenario (they're in the asset, check out the documentation, and use the support email if it doesn't work). Scale has nothing to do with it by the way :)
    @shyamlondonconsolidated > I can't guess why your code doesn't work, maybe you didn't add it to your scene properly, maybe it's something else (from what I see it seems ok code wise). The event gets fired properly, and you can see that in the classes that listen to it. Do a fresh install, die, and you'll get an achievement for it (Death is only the beginning). This is triggered via the AchievementRules class, that listens to this very event.
     
  17. pharaway

    pharaway

    Joined:
    Nov 30, 2018
    Posts:
    6
    quick question: I want to completely kill gravity for everyone all at once. How would I do that? Not trying to change the direction like with zones or anything, just set it to zero. Sorry if this is an extremely obvious question, just can't seem to find the answer.
     
  18. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @russelleray100 > Go through all characters and set their controller's gravity value to zero.
     
  19. pharaway

    pharaway

    Joined:
    Nov 30, 2018
    Posts:
    6
    Yep, I'm blind. I found it. Thanks for the quick response.
     
    reuno likes this.
  20. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
  21. Kektastic

    Kektastic

    Joined:
    Apr 6, 2018
    Posts:
    6
    I'm not exactly sure if this is intentional (nor if this has a "fix"), but when I'm testing my game (using mario as a test cause I don't have any other sprites to use at the moment) and making sure all the animations work properly, I noticed there's one frame where the game says it's jumping, but also grounded. (The white texture is a testing platform, but you can see the raycasts reaching far enough to touch them.)

    upload_2018-12-1_2-9-14.png

    Because of this, I find instances of the animation failing to transition to Jump (because for one frame, the animation switches to crouching and has no transition to jump), though I managed to fix that specifically by adding extra conditions to crouch.

    upload_2018-12-1_2-17-45.png

    I figured I'd make note of this as I'm not entirely sure if this is indeed intentional or not, and if there was a way I could prevent the character from being both grounded and jumping (even if it is for one frame).
     
    Last edited: Dec 1, 2018
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @Kektastic > That is because at this exact frame you are indeed jumping and grounded, that's by design, and I wouldn't recommend changing it (although it can of course be done by extending the CharacterJump ability).
    You'll indeed need more conditions, as you did, that's the solution :)
     
  23. carolinemariast77

    carolinemariast77

    Joined:
    Nov 24, 2018
    Posts:
    5
    Sorry my english and my stupid question! AM am a very very beginnner.
    When player die automatically respawn at check point now.
    I want when player die to see an intermediate screen (where to put many, many advertisements :).

    sorry again!
     
  24. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @carolinemariast77 > One way to do that would be to listen to the PlayerDeath event and display your intermediate screen on death. Or you could extend the LevelManager to implement that there.
     
  25. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    226
    @reuno A little request: Add volume and FX slidders on the Start Screen settings pop-up, or an example on the MMInterface sample scenes.
     
  26. carolinemariast77

    carolinemariast77

    Joined:
    Nov 24, 2018
    Posts:
    5
    My Last Stupid Question! And my english!

    I have 3 scene(No level selection). My player finish 1st scene, now is in scene 2. When restart the game from Start Screen (Start Screen Script) and hit Play, my player begin from First Scene.
    I want my player to start where he's left (Scene 2).
    How do I do that? It is Hard?
     
  27. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @Muppo > Sliders would be nice indeed, I'll add that to the todo list!
    @carolinemariast77 > How hard something is depends on your skills, not mine, I can't answer that for you. What I can tell you though is that the Corgi Engine comes with examples of progress save. You can look at the documentation to learn more about it, and at the RetroAdventure demo scenes for an example of it in action.
     
  28. ZayLong

    ZayLong

    Joined:
    Jun 2, 2013
    Posts:
    31
    @reuno

    Loving the framework, Had a design pattern/best practices question.

    What's the preferred way to add additional gauges/bars?

    On one hand, the health bar/ammo display is updated/bound to a player via the GUIManager

    but on the other hand, you have the MMHealthBar that seems to do the same thing in a self-contained script, though I do notice only enemies have it; Seems it would work just as well for a player.

    Say I wanted to add a stamina gauge or something. (like in beath of the wild)

    Should I just extend the GUIManager to update this bar and add an UpdateStaminaBar, as there is an UpdateHealthBar?
    Or should I just extend/copy the MMHealthBar script?

    The framework as a whole is pretty agnostic, but there's intent with how this is handled and I kinda want to stick with the established design paradigm.
     
    reuno likes this.
  29. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @ZayLong > Good question!
    So you're absolutely right, the MMHealthBar would work just as well for the player. The only reason it's done as it is right now is to show more than one way to do things, so now you have options :)
    Behind the MMHealthBar, that specifically works for health is the MMProgressBar class. This one is quite easy to use, you just have to call a one liner method to update it (at update, once when the value changes, it's up to you). If you were to create a gauge for this, that's how I'd do it. Extending the GUIManager would be one way to update it, another would be to create an additional GUIManager that only handles your own stuff, might make things easier, and it won't have any significant impact on performance.
     
    ZayLong likes this.
  30. SkyMan77

    SkyMan77

    Joined:
    Jan 15, 2018
    Posts:
    17
    Hi, i'm thinking about making a Sonic fangame, and i ended up thinking that your Engine might help. However, will it work, with curves and loops?

    Thanks for reading.
     
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @SkyMan77 > While it's certainly doable, it doesn't have loops, and is generally aimed at a tighter gameplay style than Sonic. So really I'd say the answer depends on your programming skills :)
     
  32. DoenitZ

    DoenitZ

    Joined:
    Oct 23, 2012
    Posts:
    16
    Hi everyone! Question, has anyone faced something like this?

    I had just bought the asset, to do some experiments, and I am facing this problem right out of the box, can't even add a simple weapon because of this...
    I have tried playing with the handles, checked the IK code to see if there was something weird there that is causing this behavior, also tried a simple IK script on my model to be 100% sure that it's not something that the model has.
    Also noted that the weapon itself, has a continuous transform rotation, coming maybe from the aim script, but unsure for now. If this is something that someone else faced, and have some insights, I will appreciate it

    Thank you all!
    Besides this little thing (that is probably my fault anyway), great asset!
     

    Attached Files:

  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @DoenitZ > Does the problem happen on any of the demo characters? If yes, where? If not, have you tried comparing with them? If the problem persists please use the support email and provide more info.
     
  34. Mindjar

    Mindjar

    Joined:
    Aug 13, 2013
    Posts:
    28
  35. DoenitZ

    DoenitZ

    Joined:
    Oct 23, 2012
    Posts:
    16
    @reuno > Thank you for the quick reply. I've just sent you a message through the contact section on your site. Let me know if I can send you something else to solve the issue.
    At the moment this only happens on my models (I've tried several, same issue all the time, weapon spinning out of control)
    I've seen that some people here fixed it by moving the handles, but that didn't happen on my end, it just keeps spinning out of control. Also if I disable the IK, the weapon on the idle state points at 90 degree in the Z axis, while when moving, it points correctly where it should.
    Anyway, hope this gives more insight on the issue
    Thank you again!
     
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @DoenitZ > I've answered you via email already :)
     
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    I'm happy to announce that the upcoming new version will include the most requested feature ever, and by far, of these past 4 years :

     
    Meowx, NathanG, Havok_ZA and 7 others like this.
  38. Reactorcore3

    Reactorcore3

    Joined:
    Nov 27, 2018
    Posts:
    15
    Ledge grab!
     
    reuno likes this.
  39. skayster

    skayster

    Joined:
    Aug 12, 2017
    Posts:
    46
    Noooooo way! <3<3<3<3<3
     
    reuno likes this.
  40. steelhamsterstudio

    steelhamsterstudio

    Joined:
    Mar 15, 2018
    Posts:
    29
    It's awesome news. I can't wait to start tasting new features!
     
    reuno likes this.
  41. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    226
    *tries hard to not surrender and update the engine to 5.3*

    Just kidding, waiting to see the new stuff as anyone!
     
    reuno likes this.
  42. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    104
    Can you please clarify what the "Enabled" boolean on each pool element does/means on the Multiple Object Pooler? IE: does it mean that element is inactive if unchecked? Thanks in advance mmmultiplepooler.png
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @Boom_Shaka > An enabled object can be pooled, otherwise it can't.
     
    Boom_Shaka likes this.
  44. vitomoroz

    vitomoroz

    Joined:
    Nov 19, 2018
    Posts:
    2
    I faced the same issue with boxes not being able to be pushed or pulled at all. But I don't see any relation to prefab stuff. My playable character succesfully links to a pushable object, when it comes close enough. But then nothing happens. So I spend some time debugging and that's what I found out.

    Pushable object takes a force instantly from a pusher. But this property is zeroed every frame by CorgiController, so the force equals to zero unless MovementBehavior is processed. That's why this bug happens, when Unity calls Pushable.Update() before Character.Update().

    Hope this will help to fix this issue in a next version.
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @vitomoroz > Thanks for your feedback! As I told the original poster, this has already been fixed and the fix will be included in the upcoming v5.3 :)
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    I'm glad you all like the upcoming ledge climb. Here's more of it.

     
    steelhamsterstudio, gurayg and TonyLi like this.
  47. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    226
    That retro corgi looks really cute.
    Can you tell us more about the other new features?
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,234
    @Muppo > Not many other new features for 5.3, but a lot of bugfixes and a few enhancements. I'll post the changelog as soon as it's ready (it's in beta right now).
     
  49. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    161
    WHat's the way to display current lives in the hud ?
     
  50. vitomoroz

    vitomoroz

    Joined:
    Nov 19, 2018
    Posts:
    2
    Thanks for your reply! Great support quality :)

    By the way, I have another question about pushable stuff. I know Corgi is not a physics based engine, but it looks like with new pushable implementation in 5.2 (Pushable + CharacterPushCorgiController) colliding with objects with the same layer is now needed.

    Most common use case for Pushable is for crates. But it's not trivial to make two or more crates to collide that way.

    What do you think about this? Maybe it's planned for future releases?
     
unityunity