Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. 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. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    No problem. You got an email with it.
     
    reuno likes this.
  2. Askins

    Askins

    Joined:
    Jul 3, 2017
    Posts:
    13
    Hi guys I was wondering if anyone on here is having the same problem as me in regards to the Jumper prefabs not being always consistent in its jump heights. For the majority of times the character jumps at the height specified in the Inspector, but every now and then it jumps at half the height and sometimes barely at all. I recorded a video showing the problem here



    To reproduce, I added the main 3 Jumper prefabs (Jumper, Jumper and RetroJumper) into the MinimalLevel scene and set the jump to 5 in the inspector. The issue often happens when the character is going full speed left or right and also when it lands towards the edge of the prefab. Might take a few minutes of testing before it happens.

    Just wondering initially if anyone has the same result as I'm not sure if it's just my machine, logging the speed.y in the SetVerticalForce void in the CorgiController doesn't seem to show anything out of the ordinary and I've tried a few different solutions with no success unfortunately.

    Any help would be greatly appreciated!
     
  3. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    133
    You are talking about the Gameobject under which the model should go right ? (I believe it's called ModelController in the docs). I have actually read that and watched the video too, and have done it this way, but still it does not obey the transform. Maybe I missed something.
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @SpyrosUn > Nesting (in this context) is the idea of having the model one level (or more) below the logic. There are multiple examples of 3D characters included in the asset, have you tried comparing your character's structure with them? As long as you nest your character one level below, there is absolutely nothing that will prevent you from having it face the way you want it to.
     
  5. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    @Askins , it happens to me too on fresh instalations over several versions so, it seems it's that way by default.
    I didn't do anything to change this because I don't need it right now, tho.
     
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Muppo, @Askins > Interesting, looks like I need to look deeper into this then. Thanks for your feedback!
     
  7. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    Sorry not notified this before, I thought it was by design.
     
  8. Askins

    Askins

    Joined:
    Jul 3, 2017
    Posts:
    13
    Ah that's a relief to know it's not just happening on my machine then, thanks for testing it out. For what it's worth it wouldn't normally be an issue but I plan on having levels in the game where you jump between the jumpers so ideally the jumps will be the same height. Thanks again for your help, @reuno if you need me to test anything out regarding this just let me know
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Askins > I'll let you know, just need to figure out why I don't reproduce the issue :)
     
  10. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    216
    Hi, I used the component of Health..
    upload_2018-11-7_12-59-46.png

    Is this DeathEffect gameobject will be released ? I didnot find the "Destroy" funciton ...
     
  11. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi,

    Just wondering what is the best approach to implement a fire/water escape level? where the fire/water is progressing in the level and you need to move fast avoid obstacles before it reach you.

    any ideas about the same?
     
  12. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Bagazi > Released? I have no idea what you mean. This line just instantiates a VFX, there's nothing to release.
    @bravery > A very easy way would be to use the one way level system and an auto moving object (basically a one line script) with a KillPlayerOnTouch/DamageOnTouch component on it.
     
  13. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    216
    I am wondering this Object should be destoryed after the vfx displayed? If many existed invisble vfx gameobjects will slow the game?
     
  14. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Bagazi > Just have your vfx auto destroy after emitting then. You can use the TimedDestruction class included in the engine for that, or if your object is using the ParticleSystem have it auto destroy on stop.
     
  15. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    216
    I see . Thank you very much
     
    reuno likes this.
  16. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    127
    Maybe rotate the original model 90 degrees? Not the model container, but the model itself.
     
    reuno likes this.
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Boom_Shaka > The model container shouldn't be rotated, it's whatever you nest under it that should.
     
    Boom_Shaka likes this.
  18. Guilherme-Otranto

    Guilherme-Otranto

    Joined:
    Mar 12, 2014
    Posts:
    28
    Hi @reuno, great asset!
    I have been playing with it for a bit now and it is quite amazing!

    I do have a (hopefully) quick question:
    Suppose I want to have a 'nerfed' version of the current wall jump ability, where a player would not be able to climb up a single wall with the ability...
    (They would require two opposing walls to really climb)
    So, similar to Mario or Salt and Sanctuary, as opposed to what we have by default, which is similar to Celeste or Hollow Knight.

    I figured the best way to accomplish this would be to 'lock' the directional input for a bit, not allowing the player to push towards the wall (but still allowing them to push away further, if they choose). Is that the way you would go about it?

    Also, I could not find it easily, but is it something that is already implemented and I failed to see?

    Thanks a bunch!
     
    reuno likes this.
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Guilherme-Otranto > No, that's not built-in. And yes, locking the direction for a bit would be exactly how I'd do it :)
     
  20. Guilherme-Otranto

    Guilherme-Otranto

    Joined:
    Mar 12, 2014
    Posts:
    28
    Okay, thanks @reuno !

    In case anyone else is interested, I will document my first step here.

    By quickly studying the CharacterWallJump class I came up with a first solution, which is quick and dirty:
    Code (CSharp):
    1. //If we don't want the character to be able to climb a single wall, keep the input from being used for a while
    2. if (horizontalAxisBlockerTime > 0f)
    3.   StartCoroutine(KeepCharacterFromMoving(horizontalAxisBlockerTime));
    I add the above code at the end of the function WallJump (just before the return statement).
    The Coroutine simply does as follows:
    Code (CSharp):
    1. //Keeps the character in controlled movement for a little bit to avoid the user being able to walljump up  asingle wall (by pressing against it)
    2. private IEnumerator KeepCharacterFromMoving(float time)
    3. {
    4.   _condition.ChangeState(CharacterStates.CharacterConditions.ControlledMovement);
    5.   yield return new WaitForSeconds(time);
    6.   _condition.ChangeState(CharacterStates.CharacterConditions.Normal);
    7. }
    And, of course, horizontalAxisBlockerTime is defined as a public float on this class. Now the user can set a timer to stop all input after a walljump.
    I am using 0.25s and it does what I want: When my char walljumps, if I keep on pressing back to the wall, the characters arrives back a little bellow where he left the wall (Mario style).

    /************************************/

    The obvious problem with this solution: It ignores all other input (e.g., a shoot, a second jump, a movement to the other side, etc).
    My next step: Ignore only horizontal movement towards the wall.
    I did this with the following code:
    On WallJump:
    Code (CSharp):
    1. //If we don't want the character to be able to climb a single wall, keep the input from being used for a while
    2. if (horizontalAxisBlockerTime > 0f)
    3. {
    4.     CharacterHorizontalMovement hm = gameObject.GetComponent<CharacterHorizontalMovement>();
    5.     if (hm != null)
    6.     {
    7.         hm.IgnoreHorizontalInputSide(wallJumpDirection < 0f, horizontalAxisBlockerTime);
    8.     }                  
    9. }
    Then, on the HorizontalMovement class, right after movementSpeed is defined, on the HandleHorizontalMovement method:
    Code (CSharp):
    1. //Multiply for the inputMultiplier if we are moving towards the ignored side
    2. if (ignoringRight && movementSpeed > 0f)
    3.   movementSpeed *= inputMultiplier;
    4. else if (!ignoringRight && movementSpeed < 0f)
    5.   movementSpeed *= inputMultiplier;
    And finally, just anywhere in the HorizontalMovement class:
    Code (CSharp):
    1. //Ignores one side of horizontal movement for a while (called by WallJump to stop player from climbing up single walls)
    2. float inputMultiplier = 1f;
    3. bool ignoringRight = false;
    4. public void IgnoreHorizontalInputSide(bool right, float time)
    5. {
    6.     ignoringRight = right;
    7.     StartCoroutine(IgnoreInputForAWhile(time));
    8. }
    9. private IEnumerator IgnoreInputForAWhile(float time)
    10. {
    11.     inputMultiplier = 0f;
    12.     yield return new WaitForSeconds(time);
    13.     inputMultiplier = 1f;
    14. }
    Okay, this accomplishes what I wanted. I will still improve the code, and tweak it for my game, but this should get any interested readers ready to start with this implementation.
    I decided to leave the first 'solution' here because it might be useful to stop all input in some situations (e.g., getting hit).

    Cheers.
     
    Last edited: Nov 9, 2018
    Muppo and reuno like this.
  21. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    216
    Hi reuno,
    I am wondering is there some message tools for this case:
    I have a component for charater like this:
    upload_2018-11-9_11-34-51.png


    But sometimes I just want to listen some special message on corresponding objects like Role Character while this component would be added to all the character in the scene,so it that possible to send the message to some appointed objects instead of broadcasting? Thanks very much..
     
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Bagazi > I'm not sure I understand your question exactly. This is the recommended way of doing things in the engine, but it's Unity, and you can change that for whatever you prefer. You can use SendMessage for example, if that's your question.
     
  23. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    216
    Yeah, thanks very much ,but the Unity inner message is based on Reflection,which is valid but maybe not with high efficiency,I asked this question to check out if I had missed some existed function in this wonderful engine~
     
  24. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    216
    What I image that is just like the PlatfromMask,which can filter the unconcerned objects or characters during a message delivery
     
  25. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    216

    Maybe I should use some condition judgement on the receiver....
     
  26. Mindjar

    Mindjar

    Joined:
    Aug 13, 2013
    Posts:
    28
    Hi guys, I need some help, maybe someone already found a solution. I want to make an animated GUI windows (pause, level complete, etc.) and I've used leantween for this. But when you pause the game, Time.deltaTime = 0 and every animation stops. What is the proper way to do this?
     
  27. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
  28. Mindjar

    Mindjar

    Joined:
    Aug 13, 2013
    Posts:
    28
    @reuno Thanks for the Time.unscaledTime - that’s what I was looking for! I knew about unscaled property in the animator, but I’m not using it because of performance.
     
    reuno likes this.
  29. hanger102

    hanger102

    Joined:
    Jan 3, 2013
    Posts:
    13
    Hi,

    I just started using the corgi engine and I must say it's been great. But one thing I can't do or find(I should say) is having the player always face the direction of the mouse. I am having all the weapons aim towards the mouse but when I move the player the opposite direction it flips the player. I would like it to flip only with the mouse. Can anyone help? I'm using the 3d hunt scene to test this.

    Thanks!
     
  30. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    127
    Quick question on temporary invulnerability player and/or enemy. I have two use cases:
    1. "brute" use case: object takes the hit and it does no damage. Using "invulnerable" = "true" boolean on the game object health component. No problems there.
    2. "evasion" use case: object avoids the hit altogether (projectiles and melee attacks should "pass through" the game object). Tried using the "invulnerable" layer but noticed AI won't target it. Slight problem there.
    Thought about disabling 2d collider but I don't want to interfere with platforms, so I'm looking at changing the damage layer on the weapons/projectiles themselves. Is there another built-in solution I haven't seen yet?
     
    Last edited: Nov 10, 2018
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @hanger102 > That's not something that is built-in if that's your question. I'd recommend creating a new character ability to handle that. It can target the Face method to do that quite easily.
    @Boom_Shaka > Temporarily changing the layer is exactly how I'd do it.
     
    Boom_Shaka likes this.
  32. Meowx

    Meowx

    Joined:
    Oct 10, 2015
    Posts:
    28
    A feature request for you - ledge grabbing! IE if a character has jumped not quite high enough, they might grab onto the edge of a ledge and pull themselves up, either automatically or with a button press.

    Keep up the awesome work!!
     
  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Meowx > Thanks for the suggestion, I'll add your vote to the todo list (it's already very high).
     
    Meowx likes this.
  34. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    I'm trying to replicate this platform behaviour now but I'm not success yet.


    I've tried a few things but I'm not sure wich method should I override; Move, GetPathEnumerator, Update, all of them?
    A bit of light in this will be great.
     
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Muppo > I think this would warrant an all new class, but I guess it can also be done by extending a MovingPlatform maybe. I can't guess what methods to extend like that though :)
     
  36. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241
    Ouch. Will try again from scratch then.

    This kind of platform (single one, not paired like in the picture), where player weight push it down then it goes up again when player leaves. Can you add this to the suggestion list?
     
  37. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    127
    One more advanced AI question: certain bosses will execute certain moves in a certain order/position in scene periodically in each battle. I'm initiating that by adding "marker" game objects to my scene and having the AI move towards those markers and perform the appropriate action.

    That said, I also noticed several references to _brain.Target, which seems to default to the player? If I set that Target to one of my markers would I then need to set it back to the player for the rest of the scripts to work properly? It might end up being more work than my original solution, but I figured it's worth asking.
     
  38. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    671
    @reuno So I was wondering how easy it is to undo the changes that importing the Corgi Engine into a project does? For example, I know that importing the Corgi Engine makes change to the layers and how those layers interact with physics so those are relatively easy to revert since I know what changed there however I am unsure of what else might have changed that should be reverted if I decide I don't want to use the Corgi Engine for this project anymore.

    Is there some sort of way to figure out all the changes and how to revert them or would I be better off creating a new project and just copying over all the code that is not related to the Corgi Engine?
     
  39. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Muppo > Sure, I'll add this to the list!
    @Boom_Shaka > The brain's Target is set by some decisions (target in range, etc) and used by others (shoot at target, move towards target, that kind of things). So sure, if you have other scripts modify that target, it'll have an impact :)
    @ryanzec > The best way would be to use version control and diff the changes to selectively revert to one or the other. Or if you're not using version control, you can indeed just import fresh settings.
     
    Boom_Shaka likes this.
  40. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    127
    Got it thanks.

    You can also add my vote to Muppo's platform request - it would make for some interesting timing-puzzles.
     
    Last edited: Nov 13, 2018
    reuno likes this.
  41. tathibana9999

    tathibana9999

    Joined:
    Sep 4, 2017
    Posts:
    3
    I'm trying to make 2D platformer games using "CorgiEngine" and "Spine" now.
    I set a character created with "Spine" as a player.
    In addition, we set "SpineEvent" to player character using animation tool "Spine" so that footstep sounds.
    When "Spine" is played with "Unity", footsteps are output accurately, but player characters who set "CorgiController" will not output footsteps.
    Does "CorgiEngine" support "SpineEvent"?
    If an example is included in the demo scene, where is it?

    I am using "CorgiEngine" version 4.5.1.
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @tathibana9999 > No, there is no support for SpineEvents. That is something you'd have to implement, it's very specific.
    The engine is compatible with Spine, as it is with any animation system that works with Unity's native Mecanim, but there is no specific implementation of any proprietary additional layers that Spine or other systems may have.
     
  43. tathibana9999

    tathibana9999

    Joined:
    Sep 4, 2017
    Posts:
    3
    Thank you for your reply.
    I understood.
     
    reuno likes this.
  44. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    127
    Getting deeper into AI and mapping out a process for the enemy to jump up onto a one-way platform if the player is on one and in range. Workflow is:
    1. AI Decision: detect player (done)
    2. AI Action: move towards player (done)
    3. AI Decision: check if player is in range, where range < jump height (done)
    4. AI Decision: check if player is on one-way/moving one-way/mid-height one-way platform (?)
    5. AI Action: execute jump (done)
    I think the answer for step 4 is in Corgi Controller controller script lines 807-815:
    // if what we're standing on is a mid height oneway platform, we turn it into a regular platform for this frame only

    Instead of just checking if the player is on a mid-height oneway platform, I'd also check for the other oneway platforms as well:

    if (MidHeightOneWayPlatformMask.Contains(StandingOnLastFrame.layer))

    if (OneWayPlatformMask.Contains(StandingOnLastFrame.layer))

    if (MovingOneWayPlatformMask.Contains(StandingOnLastFrame.layer))


    and then execute the jump if either of those conditions for the player object (or any object tagged "player") returns true?

    Do I need to include the code on line 810 too? _savedBelowLayer = StandingOnLastFrame.layer;

    Thanks in advance.
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @Boom_Shaka > That sounds right, yes. I don't think you need line 810, but I'd say the best way to know would be to try it :)
     
  46. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi,
    If I want to make the following behavior for an enemy:
    - The enemy is stand-still and if you touch it you will get Damage.
    - If you fire once at the enemy the enemy Damage will get disabled for a 2 seconds only (during this 2 seconds you can use him to jump) and after that the Damage ability will be activated again and his health will be full again.
    - If you fire twice on the enemy the enemy will be destroy.

    any idea how to achieve this using Corgi engine?
     
  47. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @bravery > You'll need to create a specific component for this, as it's quite specific.
    Create your enemy, add a DamageOnTouch on it and configure it properly (target layer mask, damage applied, etc).
    Add a Health component to it, same thing, have its health point match twice the damage applied by your weapon.
    Then create a new class that will register to the Health component's OnHit event. OnHit, have it disable the DamageOnTouch for 2 seconds and restore its health after that.

    Alternatively you could use the Brain system for this but it sounds overkill for something that simple.
     
  48. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Thank you reuno for the quick reply.

    by the way can you point me to any tutorial or article that can have more elaboration on how to do what explained in this sentence you wrote:
    "create a new class that will register to the Health component's OnHit event"
    as according to my limited knowledge there is an event system that come with corgi engine start with MM and can help me on doing this, right?
     
  49. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,885
    @bravery > I don't have a dedicated tutorial for that, but there are examples throughout the engine. This uses Unity's regular delegate system, not the custom events (which is used for more complex stuff). You can learn more about delegates at https://unity3d.com/fr/learn/tutorials/topics/scripting/delegates

    Basically you'll want something like this :

    Code (CSharp):
    1. protected virtual void MyOnHit()
    2. {
    3.    // do something here when you get hit
    4. }
    5.  
    6. protected virtual void OnEnable()
    7. {
    8.   _health.OnHit += MyOnHit;
    9. }
    10.  
    11. protected virtual void OnDisable()
    12. {
    13.   _health.OnHit -= MyOnHit;
    14. }
    15.  
    16.  
    Where you'll have grabbed _health somewhere at Awake or Start.
    So at OnEnable/OnDisable you register/unregister for OnHit, and say that when _health's OnHit gets fired, you want to run your MyOnHit method, in which you can run whatever code you want (in your case that'd be disabling the DamageOnTouch zone and triggering a countdown.
     
  50. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    241

    About this, I found a workaround: just replace box collider with circle collider. Didn't reproduce this issue on my tests.
     
    reuno likes this.
unityunity