Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v6.6 : ability split, recoil, hitscan...]

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

  1. Askins

    Askins

    Joined:
    Jul 3, 2017
    Posts:
    12
    Is that the box collider on the Jumper? I've just tried a circle collider on the RetroJumper and it's still having the issue weirdly. Though this was just by playing in the game editor, I'm not testing with a build or anything.
     
  2. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    @Askins > Yes, all I did was lower the Y offset a bit in order to not let player go between this and platform collider. Didn't test in a build too.
     
  3. Meowx

    Meowx

    Joined:
    Oct 10, 2015
    Posts:
    28
    Feature request - could we get a third trigger mode, "charged"? Like Link's sword or Mega Man's buster; hold down to charge with a separate animation state and then release to fire (if you've held the button long enough).
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @Meowx > That's already doable, that's what the DelayBeforeUse on weapons is for. You can decide whether you want that to be interruptible or not, and you can have separate animations play at every step of the attack cycle :)
     
  5. Meowx

    Meowx

    Joined:
    Oct 10, 2015
    Posts:
    28
    Oh, great! I thought that was for the attack having a delayed start after it got the command to start. Thanks!
     
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @Meowx > It's also for that :)
     
  7. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    @reuno , I'm trying to achieve this kind of platforms:


    At first I thought on using Auto Rotate as a base but it seem as a bad idea now. Can you add this to the features list if you don't mind? I'll continue working on it, tho.
     
    Boom_Shaka likes this.
  8. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    124
    @Muppo - have you tried a custom AI action? Transition/decision would either be a timer (time in state) or player proximity (distance to target)....or both?
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @Muppo > I'll add them to the list, thanks for the suggestion!
     
  10. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    @Boom_Shaka > In fact, a real coder helped me with this, writing this code, but platform goes nuts before the first rotation and I'm trying to figure out how to fix it.

    Edit: code rewriten by the coder, all working nice now.

    @reuno > Thank you.
     
    Last edited: Nov 19, 2018
    Boom_Shaka likes this.
  11. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    173
    Hey folks! I'm wondering if I can slot this plugin into a little project I'm working on. I have a question first...

    Does this support 3D movement on the Z-axis? Or is it something I can add?

    The game I'm making would benefit from all the jumping & platforming mechanics, but I also need to be able to move back and forth along the Z axis.

    Here's what I mean: https://imgur.com/TfDT1SD
    (it's a Half-Life demake :D )

    Can Corgi use 3D colliders and rigidbodies?
     
  12. Qianfulong

    Qianfulong

    Joined:
    Mar 15, 2017
    Posts:
    7
    Hi all,
    does anyone have experience with cinemachine and the corgi engine? I managed to incorporate the "LevelManagerCinemachineBased" script made by Prog-Maker from the extension Git (https://github.com/reunono/CorgiEngineExtensions). Though it is generally working the parallax somehow is not working properly. Some of the parallax elements jitter / lag relative to the other elements while others behave like expected, though all elements are setup the same way. Did anyone else try out that script yet in conjunction with the corgi parallax feature? Maybe Prog-Maker himself might give me a hint here? Cheers in advance folks!

    Edit: All right, i found the problem even though i do not understand it. I added the Cinemachine Cameras after building the level so all parallax elements already were in place. For some elements this worked but like described above for some it didn't. So i tried to remove the parallax component from the problematic gameobjects and immediately added the parallax component again, using the exact same settings as before. Magically that fixed the problems. Parallax behaving like it should. So mind integrating your cinemachine brain into your levels before adding parallax elements :)

    Edit2: Hopes up too soon. Even thought problems were gone for a short moment, after starting the editor play mode again problems reappeared... I have no idea what's happening here. It does not behave deterministic here. So returning to my initial request: If anyone has experience with cinemachine in general or within corgi i'd be happy to get a hint on this...
     
    Last edited: Nov 19, 2018
    Boom_Shaka likes this.
  13. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    Well, I found this today using polygon collider 2D



    I can't reproduce it with default characters so I'm sure this is not a bug and only happens with mine. My player have Level Bounds component disabled, but already tried on enable and this still happens.

    It seems player is rocketed up in the air when trying to jump in corners, no matter how many degrees the angle have. The game object is located on the Moving Platforms layer and it doesn't have any Tile Map components at all, is just a regular moving platform.

    Any clue on how to fix this?
     
  14. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    Answering to myself: it was just the wrong setting on Detach Method.
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @Muppo > I'm glad it's working now. Thanks for sending additional info, I'll look into it to make sure there's no bug.
    @CrowbarSka > No, there's no movement on the Z axis, otherwise it would be 3D, not 2D. And it doesn't work with rigidbodies, that's the whole point of the engine actually :) But you might be interested in the TopDown engine, maybe, because the game you describe isn't a 2D platformer, it looks more like a top down action game.
    @guidkal69 > I never tried it but I highly doubt the parallax scripts would work out of the blue with Cinemachine. They've been designed to work with the default CameraController. If you change the controller, you'll need to modify these as well. I plan on integrating Cinemachine in the engine as the default controller, as I absolutely love this package. I'm just waiting on Unity to add proper support for packages in Asset Store assets, because right now it's non existent, and leads to a lot of problems. As soon as they add that, I'll gladly add support for it.
     
  16. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    Whoever is willing to assist me, I have a quick question. Maybe I am missing the part where I use some code from the engine.

    What i need is just simple trigger. I have a transparent box with a 2DCollider. When the Player goes trough it I wanted a GameObject to appear/disappear. The problem is that no matter what I tried the Player based on one of the Corgi Presets doesn't register the collision with the box. The box does have the Is Trigger tick. I made a small script, which I place on the box to detect the Player and enable the GameObject. Even tried the opposite. I really though its gonna be really simple, but maybe I have to do it some other way. Thanks.

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class EnableObject : MonoBehaviour
    6. {
    7.     public GameObject Zone;
    8.  
    9.     void OnCollisionEnter2D(Collision2D col)
    10.     {
    11.         if (col.gameObject.tag == "Player")
    12.         {
    13.            Zone.SetActive(true);
    14.             Debug.Log("Collided");
    15.         }
    16.     }
    17. }
     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @kriyordev > If your box is set to trigger, you might want to use OnTriggerEnter2D instead. There are multiple examples of this throughout the engine. A simple search will pop you many results. You can look at the LevelRestarter class for a barebones example of how it works. Note that this is nothing specific to the engine, it's just standard Unity :)
     
    KriYorDev likes this.
  18. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    Yes I am still learning to actually make use of the Corgi scripts. I took the LevelRestarter, changed it to just activate/deactivate the zone. Worked like a charm. OnCollisionEnter2D was from my first attempt, so I forgot to try OnTriggerEnter2D. Thanks a lot!
     
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
  20. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    173
    Right, it kind of is! I have most of my other mechanics figured out, I was just looking for a stable character motion controller. :D
     
    reuno likes this.
  21. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    Was this added in some way? I looked over the documentation, but didn't find any info on switches specifically. Apparently it was planned for version 2.2. I am asking just to know if should go about to make those trap systems myself with the AI on a basic level or MovingPlatforms at parts.

    Thanks!
     
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @kriyordev > I think that's the ButtonActivated zone and all that went after that? There are now many tools and examples of how to have zones that the user can activate and that trigger stuff (chests, doors, etc). But I'm not sure if that's what you're referring to. That'd be the Keys, doors and chests section of the documentation, among other places.
     
    KriYorDev likes this.
  23. wedgiebee

    wedgiebee

    Joined:
    Aug 9, 2016
    Posts:
    8
    Hi, just bought the plugin a couple days ago and love how reliable the platforming feels! Great work!

    I've encountered an issue with moving platforms and was wondering if there are any workarounds or if I've set up something incorrectly.

    It's a very specific case, but basically if I have a MovingPlatform moving along the floor and I stand to the right side of it, when it touches me I fall through the floor! This does NOT happen when I stand to the left side.

    Corgi_MovingPlatformBug1.gif

    NOTE: This is what happens when the character is sized at 1x1 units! When the character is sized at 1 unit wide and 2 units high, this DOES NOT happen, so hopefully that gives some clues as to what the problem might be...
     
    Last edited: Nov 21, 2018
  24. cardcastleusa

    cardcastleusa

    Joined:
    Mar 20, 2018
    Posts:
    7
    Was having an issue with the Initialization()

    Basically when I used the Auto Builder for AI or Player everything would work as expected. Except when I tried to play. I would get the error of null in the foreach loops in EarlyProcessAbilities(), ProcessAbilities() and LateProcessAbilities().

    It seemed like the Initialization() was not being called in the virtual awake(). I was able to fix the issue by placing an if statement in each of the ProcessAbilities Functions


    Code (CSharp):
    1.  
    2. if (_characterAbilities != null)
    3.             {
    4.                 foreach (CharacterAbility ability in _characterAbilities)
    5.                 {
    6.                     if (ability.enabled && ability.AbilityInitialized)
    7.                     {
    8.                         ability.EarlyProcessAbility();
    9.                     }
    10.                 }
    11.             }
    12.             else
    13.             {
    14.                 _characterAbilities = GetComponents<CharacterAbility>();
    15.             }
    16.  
    Not sure if anyone else was having these errors.
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @wedgiebee > That interaction is simply not supported by default :) There's no behaviour for that, and you'd have to implement the one you want. The fact that it works under certain circumstances is just coincidental. That kind of interaction falls under what I consider to be "physics" interactions, and while they're easy to handle with raycasts on something like a flat ground, they'd become really messy when on a slope for example, so I'm not trying to push the engine in that direction, Unity's physics would be much more suited for something like that. Depending on the behaviour you expect, implementing a behaviour for that can be fairly easy (or very hard). If you just want to be pushed on flat ground, creating a new ability that casts a ray, detects the platform, and adds to your controller the same speed would be quite simple and the way to go.

    @cardcastleusa > I've never heard of such errors, and I'm not sure how to reproduce, all my automated auto-builder tests are positive.
    I just did a manual test just to be sure : fresh install of the latest version of the engine (5.2), added a sprite in a scene, added a Character component to it, pressed the "Autobuild Player Character", pressed play, everything's fine, no error.

    I'm glad you fixed your problem, but if you've got a minute to spare please send me more details (asset version, Unity version, steps to reproduce the problem) on the support email, and I'll have a look at it!
     
  26. wedgiebee

    wedgiebee

    Joined:
    Aug 9, 2016
    Posts:
    8
    Ah got it :) Thanks for the suggestion! Yeah, for my use case I'm only working with flat surfaces, no slopes, so I'm gonna try that out! I much prefer the way your engine feels to how Unity physics feels, so gonna try my best to get this to work :p Thanks again ~
     
  27. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @wedgiebee > If that doesn't work out let me know, I'll see what I can do :)
     
  28. ehuvio

    ehuvio

    Joined:
    Nov 4, 2014
    Posts:
    13
    I just installed the Corgi and watched some AI videos. There's a mention of advanced AI methods, but there are no scripts where the video mentions they should be.
     
  29. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
  30. Worlz

    Worlz

    Joined:
    Nov 25, 2015
    Posts:
    2
    Hello,

    first of all the Corgi Engine Asset is a great and convenient tool. But while upgrading from v5.1 to v5.2 I came across a very strange bug.

    First, I upgraded Unity from the LTS 2017.4.15f to Unity 2018.2.15f1, than I upgraded Corgi from v5.1 to v5.2.
    In one of my levels build in v5.1, I placed some pushable box prefabs in the scene. After upgrading to v5.2, I changed those prefabs to work with the new push/pull mechanics.
    My level had 8 moveable boxes, but only 6 of them would function probably. Some boxes would not be pushed or pulled at all. I tried quite a lot of workarounds, from deleting the existing prefab to create a new prefab to set up the movable box prefab completely new, nothing seems to fix the problem.
    The strange part is, if I would copy an existing prefab from the hierarchy and use it, it would function properly until I save and switch the scene.
    After reloading the scene, the newly created moveable box would stop functioning.

    Digging deeper, I realised that switching between Force Binary and Force Text influence the functionality between moveable boxes.

    Finally, I found a fix for it, but it's rather ugly. I severed the connections from each box with the prefab and everything works fine. Every box is pushable/pullable.

    But this is rather inconvenient.

    Did someone else came across this bug?
    Did you find any other way to fix the bug?
    I hope my description is precise enough.

    Thank you in advance :)
     
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @Worlz > Thanks for reporting this. I'm pretty sure I've fixed this bug for the upcoming release (it's a very weird one). If you can wait until the next release that's great, if not, drop me an email on the support email and I'll see if I can send you just the updated files.
     
  32. ehuvio

    ehuvio

    Joined:
    Nov 4, 2014
    Posts:
    13
    Thanks for the tip. After upgrade everything seemed to go right. But when I set up a character and put it on scene, it jumps off from level - so it doesn't stay where I set it and drop to floor. Any ideas? Another thing is that I want to create trigger points where AI character randomly changes direction, falls of from platform or jumps - or any combination of these. What would be best solution to create such?
     
  33. ehuvio

    ehuvio

    Joined:
    Nov 4, 2014
    Posts:
    13
    I removed the level bounds from AI character and then it didn't jump off level. Still another question. I would like the AI characters to change directions when bumping on each other. How would you do that?
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @ehuvio > You'd need to create a new AI Action for this I guess.
    Edit : or maybe just use the existing ones and have the enemies layer as an obstacle layer on decisions. That could work too.
     
  35. ehuvio

    ehuvio

    Joined:
    Nov 4, 2014
    Posts:
    13
    Thanks for the answer. What about those trigger positions?
     
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @ehuvio > Trigger positions? I'm not sure what you mean :)
     
  37. ehuvio

    ehuvio

    Joined:
    Nov 4, 2014
    Posts:
    13
    With trigger positions I mean a trigger placed on level in which - when an AI character comes by - it triggers a script that randomly affects AI characters action. Like move off platform, turn around or jump. And with witch it would be easy to tweak the values different choices. Like .50 to jump and .25 to turn around and to fall off.
     
  38. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    @ehuvio , you can use JumpOverride as reference for that then add a randomizer. As far as I know, it could look similar to this

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using MoreMountains.Tools;
    5.  
    6. namespace MoreMountains.CorgiEngine
    7. {  
    8.     public class BehaviorModifier : MonoBehaviour
    9.     {
    10.         public bool MoveOffPlatform;
    11.         public bool AnyOtherAbility;
    12.  
    13.         protected int RandomNumber;
    14.  
    15.         ///
    16.         public virtual void OnTriggerEnter2D(Collider2D other)
    17.         {
    18.             AIWalk _aiwalk = other.GetComponent<AIWalk>();
    19.             if(_aiwalk != null)
    20.             {
    21.                RandomNumber = Random.Range(0,[/* here goes the number of abilities you want to modify minus one */]);
    22.  
    23.                 if (MoveOffPlatform && (RandomNumber == 0))
    24.                     other.GetComponent<AIWalk>().AvoidFalling = false;
    25.  
    26.                 if (AnyOtherAbility && (RandomNumber == 1))
    27.                     other.GetComponent<AIWalk>().AnyOtherAbility = false;
    28.             }
    29.         }
    30.     }
    31. }
    32.  
    Is that what you're looking for?
     
    reuno likes this.
  39. Worlz

    Worlz

    Joined:
    Nov 25, 2015
    Posts:
    2

    Thank you for your help, I'll wait for the next release :)
     
    reuno likes this.
  40. AbhishekRaj

    AbhishekRaj

    Joined:
    Dec 1, 2016
    Posts:
    143
    Hello everyone,

    I am a Unity developer who is developing games from the last 3 years and I also have a bit of experience with C++. I have bought Corgi Engine because I always wanted to build a simple 2D Side Scroller, something on the lines of Flappy Bird but not the same because we have enough copies of that.

    I am facing issue of not knowing where to start? Corgi is absurdly feature rich and I think that it makes it very much complicated for beginners. I can't even describe how frustrated I am feeling because of not understanding anything about Corgi.


    Can anyone please help me with that? Some tips/suggestions or simple tutorials about Corgi. I have seen the video tutorials but I couldn't understand how to put all that into one and produce a game which can at least have a menu and a Gameplay scene.



    Thanks in advance
     
  41. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @AbhishekRaj > I'd suggest starting with the documentation, that even contains a "Getting started" section. And then dedicated sections and tutorials about each feature of the engine. Maybe start with the one that interests you the most. There's also a very entry level tutorial by Unity themselves about the engine, you might want to have a look at it.
    I'll also add that for something as simple as Flappy Bird (which isn't really a platformer) something like the Corgi Engine sounds a tad overkill :)
     
    AbhishekRaj likes this.
  42. AbhishekRaj

    AbhishekRaj

    Joined:
    Dec 1, 2016
    Posts:
    143
    Thanks for your advice. I will look up the tutorials which you mentioned. I sincerely hope that I understand more about Corgi Engine and use this incredibly awesome asset in the future.

    Is it an overkill? I never thought about this aspect. Do you suggest to develop such a game without the Corgi Engine? Actually, I have Zero experience with unity 2D so all these questions are from a noob's point of view:D
     
  43. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    124
    Do particle systems' 2d colliders work out of the box with Corgi? In other words, can I add a damage on touch script to a game object that has a particle system with the 2d collider module active or do I just set Corgi variables/call events using OnParticleCollision in my own script?
     
    Last edited: Nov 25, 2018
  44. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @AbhishekRaj > Flappy Bird has to be one of the easiest game to make. I wouldn't use any framework to do so, native Unity is more than enough to handle that.
    @Boom_Shaka > I don't think this will work out of the box, no, you'll need a script for it I reckon. But I've never tried it, so I may be wrong.
     
    AbhishekRaj and Boom_Shaka like this.
  45. ehuvio

    ehuvio

    Joined:
    Nov 4, 2014
    Posts:
    13
    Hi, is there an existing way of detecting AI character's direction? Or do I have to set some getters?
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @ehuvio > As explained in the documentation, you can look at a character's controller for info about its direction (its Speed, among others). This goes for all characters, AI or not. No need to add any getters :)
     
  47. shyamlondonconsolidated

    shyamlondonconsolidated

    Joined:
    Apr 1, 2018
    Posts:
    36
    Hi Reuno,

    I am trying to understand trigger event and listen events;

    In the LevelManager.cs, a playerdeath event is trigged;
    MMEventManager.TriggerEvent(new CorgiEngineEvent(CorgiEngineEventTypes.PlayerDeath));

    I have a scoremanager script which I want to listen for the player death event and essentially add some score, or save a PlayerPref score function


    public virtual void OnMMEvent(CorgiEngineEvent deathEvent)
    {
    if (deathEvent.playerdeath == "PlayerDeath")
    {
    // DO SOMETHING
    Debug.Log("Do something here!");
    totalScore += 100;
    }
    }

    I am unsure what the highlighted playerdeath needs to be.

    Kind Regards,

    Shyam
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @shyamlondonconsolidated > That should be something like this (if I get what you're asking) :
    if (deathEvent.EventType == CorgiEngineEventTypes.PlayerDeath)

    You'll find many, many examples of these events being used in the engine.
    The AchievementRules script specifically looks for PlayerDeath events, for example.
     
  49. JAMiller

    JAMiller

    Joined:
    Apr 2, 2009
    Posts:
    74
    Hello,

    Really liking CorgiEngine and have been able to get a huge start on my game in just a few days. I've run into one problem with the 'non-physics' based controller, I don't know how to resolve. Is there any way to get the movement to 'slide' when encountering sloped walls and ceilings? For example, using the FlyingCopter character and flying into a 45 degree wall it will get stuck, rather than sliding along the collision.

    Any advice on how or where to implement this kind of sliding?

    Edit: I saw reuno's advice here on ground sliding, seems like it may be similar (except mine deals with any platform ceiling or wall you collide with, not what you are standing on).
     
    Last edited: Nov 27, 2018
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,841
    @JAMiller > That's not something that is built-in.
    I see a bunch of different ways you could implement that :
    - modify the controller to handle that (not the easiest, but probably the cleanest)
    - have an ability add / modify the direction based on the angle you collide with (easier, safe)
     
unityunity