Search Unity

[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. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    How to implement combination key in corgi-engine?
     
  2. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    Only all of those assigned keys simultaneously pressed to trigger something,especially on gamepad:)
     
  3. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Bagazi > Like you would in any other Unity project, there's nothing specific to the engine in that regard. Test for two presses instead of one (if you're just after two presses combinations, it can get more complex than just that).
    @Freezey45 > Whether that would be easy or not depends on your skills, but I'd say it's definitely not the most complex task.
    Basically you'd have to first come up with rules, but one way to do it would be to :
    - create a new ability
    - have that ability log the y position ever time you go from grounded to airborne
    - everytime you go back to grounded from airborne, look if the new y difference between now and when you went airborne is above a certain threshold
    - if it is, apply (proportional?) fall damage
    Coincidentally, this is one of the new features of the next update, drop me a line on the support form if you want to test it before it releases.
     
    Boom_Shaka and javi_unity402 like this.
  4. hippobob

    hippobob

    Joined:
    Feb 26, 2017
    Posts:
    33
    Excuse me, I'm a fool.
    I want you to teach me. How to make a character jump down by swiping down the screen on the phone.
     
  5. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @hippobob > There's a JumpStart method you can call on CharacterJump when you detect a swipe. The best way to do it would be to extend CharacterJump, and just override its HandleInput method, that's all you'd have to do.
     
    hippobob likes this.
  6. Freezey45

    Freezey45

    Joined:
    Apr 22, 2019
    Posts:
    2
    Thanks. I have just purchased the engine and started to play with it.

    WOW..... This is amazing. Saves so much time on the basics.
    I will drop you a line when I have made a prototype of the game and Yes I would then like to try the new feature.

    Thanks Troy
     
    reuno likes this.
  7. KOPEW

    KOPEW

    Joined:
    Jul 30, 2019
    Posts:
    27
    Hi dudes!
    Do someone know can I native create like 2nd enemy coalition / layer?
    I mean the tag (?) which makes enemy type-A to be evil for enemy type-B and for the Player. Tried to mutate ally class, but I couldn't
     
  8. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Use TargetLayers to identify your factions and then write a script that sets them as AI targets if they are within a certain range.

    Not sure if that would be a resource hog and you'd have to figure how to keep enemies focused on a single target, but that's where I'd start.
     
    KOPEW and reuno like this.
  9. KOPEW

    KOPEW

    Joined:
    Jul 30, 2019
    Posts:
    27
    Aww, kinda hard for me. but thanks)
     
    Boom_Shaka likes this.
  10. Cambesa

    Cambesa

    Joined:
    Jun 6, 2011
    Posts:
    119
    I'm trying to make a rigidbody block the player from moving through it. It's a block that can move by physics itself but the player should not be able to push it by walking against it but that's happening. How would I set up the gameobject so corgi just sees it as a platform it can walk on without moving it when the player walks against it? Marking the block's layer as platform or moving platform does not work.

    Creating a sub-object with a larger collider, marked as platform and without rigidbody still causes the parent rigidbody to be pushed by the player.
     
    Last edited: May 11, 2020
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Cambesa > Uncheck the Physics2DInteraction checkbox in CorgiController (it's under the Default Parameters dropdown).
     
    Cambesa likes this.
  12. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Understood. Still, this is a good problem to work on. Even if you can't solve it, you might be able to come up with a workaround. If nothing else, you'll learn something that you can apply elsewhere.

    1. Do your Unity homework. You'll want to research tags/layers and how to access scripts/variables on the same and/or different objects (not related to the engine).
    2. Review the Corgi advanced AI to see if there are decisions/actions you can use out-of-the-box
    3. Experiment with the advanced AI to see if you can write your own decisions/actions based on the examples (refer to the Corgi API doc for public methods/variables)
    4. Map out the behavior first - write down exactly what you want it to do in as many different situations as you can imagine. I like to do it in flowchart format using lucidcharts (free) but you can use pen and paper if you want.

    I hate when people say "it's not that hard" because that's all relative, but I suspect that your biggest challenge will be step 4 -- AI can be tricky and you can find yourself created unintentional behavior loops.
     
    reuno likes this.
  13. ea8786

    ea8786

    Joined:
    Apr 22, 2020
    Posts:
    2
    Hey I bought Corgi a while ago. I can do a little coding but I am still learning. What do you suggest I do to make a game similar to this.


    Now I want to add I also have playmaker, and game creator. I really like game creator( I have all the modules). So therefore I have 4 major questions.

    1. How would I go about changing the corgi controller to offer the movement like in beat em ups.
    2. How would you suggest I bridge the game creator scenes with the Corgi scenes. (some 2d, and some 3d.) (Mostly 2d but the towns, and a some boss fights are 3d.
    3. If Instead are the scripts for power ups and gravity easily or at least not extremely difficult to attach to other engines like game creator?
    4. How would you recommend I switch camera views (on triggers I guess once I enter a different zone) but to also constrain the movement/boundaries in the z axis. in the 2d gameplay areas (some will be beat em up (small z axis movement), some will be like what your trailers show (no z axis movement), and then some will be completely 3d like

    Do you suggest I make a controller or controller variants for each type of zone.
    Sometimes I would like the camera switch to be fluid like

    So that it allows the player multiple challenges from both 2.5d and 3d depending on the circumstance.
     
  14. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @ea8786 > I always suggest picking the right tool for the right job. Streets of Rage 4 is an excellent game, but it's not a platformer, it's a top down beat em all. Both genres have little in common in terms of core mechanics, so picking a 2D/2.5D platformer solution like the Corgi Engine to create one is probably not the best choice. Likewise, that Sonic video is 3D gameplay, not 2D.

    The TopDown Engine would be a better starting point for that top down thing.
     
  15. Cambesa

    Cambesa

    Joined:
    Jun 6, 2011
    Posts:
    119
    Here's a way to shorten the if else statement in Character.cs if you're interested
    upload_2020-5-13_18-55-45.png
     
  16. daniloamf

    daniloamf

    Joined:
    Jan 5, 2020
    Posts:
    3
    Hello, recently i was trying to implement some sort of game over screen in my game, but since i dont wanted to load a new scene only with the game over UI that i created, i was trying to figure out how to make it work with what the engine already gives me, here is what i did, i modified the kill() method on the health script, since the only thing that matters to me when killing the player is the vibration, then i called my game over funcition, it worked fine but when i try to restart the scene using the restart button that i created, a lot of components of the player were destroyed, and the scene doesn't start as it was suposed to start, what did i miss? i thinked that erasing everything from the kill() method would work, but seems like the way that the engine handles the player death it's messing with what i'm trying to do, do you guys have any advices about what to do or what am i missing?
     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @daniloamf > You'll find plenty of examples of scene reloading within the engine, I'd recommend looking at them for reference. Note that this isn't done any differently than in any standard Unity project. I wouldn't recommend modifying or erasing the Kill method though, it's not responsible for scene reloading.
     
  18. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Hi reuno, for Corgi Engine can you please add my feature request for proper 3D-physics support in your list (just like how TopdownEngine has separate character controllers for 2D and 3D).

    Right now it's very limiting with Corgi Engine to use 2D physics while creating a 2.5D/3D platformer game.

    Thanks.
     
    Alexflame108 likes this.
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @dev_2051 > I can add it to the list, but it's never been requested so far.
    If more people request it, it'll make it higher up the list.
    That said, the engine is designed for 2D gameplay, not 3D.
    I'm not sure what's limiting about it at the moment (there's absolutely no difference between 2D and 3D assets as far as the engine is concerned), could you clarify?
     
    Alexflame108 likes this.
  20. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Corgi Engine is not able to handle platform characters movements with Z-depth as all the physics are handled by 2D-raycasts and 2D box colliders. If there are separate controllers for 2D and 3D physics then i guess Corgi can become fully functional 3D platform engine.

    But as you said Corgi-Engine is strictly designed for 2D game-play only, that explain all 2D physics based movements.
     
    Alexflame108 likes this.
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @dev_2051 > I think if I were to to do a 3D platformer solution I'd create an entirely separate one. The core mechanics are too different between a 2D and 3D platformer (much more than they are in 2D/3D topdown). It'd become a very complex and confusing codebase if a single one was handling both. But your interest is well noted :)
     
    Alexflame108 and dev_2051 like this.
  22. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    I'm trying to make a melee weapon attack. It's a sword that the player will swing. (unity 2019, 2d, side scrolling type game)

    I followed the documentation to set it up, with all the steps.
    I have set up the MeleeWeapon game object, and I am using the pre-made rectangle animator parameters.

    I have a 14 frame animation for this attack which is set up in the animator so that "Any State" transitions to it, with the conditions set up so it uses the attack bool parameter.

    In-game, when I press E while idle, nothing happens.

    When I press E while walking it plays about 3 frames of the attack animation.

    I've been struggling with this for a while. Tried everything I can think of(which isn't a whole lot, like changing the durations and exit times, animation speeds, unchecking transition to self, transition times etc.)

    Also: For a weapon you swing, do I need to have the meleeAttackStart parameter reference the first few frames of my whole attack animation, and then an "in use" parameter and animation which has the rest of the frames?

    Any help would be appreciated.
     

    Attached Files:

    Last edited: May 16, 2020
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @jjkrr > As explained in the documentation, the "any state" pattern works ok for a demo, but for production I recommend using a more traditional approach. It's likely the cause of your issue here, another transition must be interrupting. I'd recommend looking at how the RetroCorgi's animator is setup, it's a better example of how you can do things. Coincidentally, it's got a sword melee attack as well.
     
    jjkrr likes this.
  24. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    Thanks very much, I'll take a look at that
     
  25. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    Would I make the melee weapon game object itself a child of the player, and then in the attack animation create a melee weapon position property so the weapon position moves with the sprite in the slashing motion?
     
  26. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @jjkrr > Sure, that could work. It's up to you really, the engine doesn't do any animation, all it does is send and update animation parameters. The rest is just standard Unity animator, nothing specific. So the engine will handle any setup you want.
     
  27. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    Thanks.
    As for the jump, in the retro corgi animator, the jump animation is only one frame, but if you want more frames you have to use a blend tree?
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @jjkrr > No, you don't have to use a blend tree, a blend tree is useful if you want (for example) height based transitions. Again, you can setup your animator any way you want, there's no restriction in the engine, and nothing specific as well :)
     
  29. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    Oh okay. Thanks :)
    I've set it up but is the animation frames don't play, the character does move on the y axis up into the air however. Is there anything you can tell I'm missing in this screencap?
     

    Attached Files:

  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @jjkrr > No, I can't tell just from that screenshot. My guess is another animation is interrupting your jump anim. Simply look at your animator at runtime and you'll see which one. Then make sure it doesn't. I'd recommend reading Unity's documentation about transitions, it'll probably help.
     
  31. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    Ok thanks for your help.
     
    reuno likes this.
  32. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    Is there a way to stop the player from stutter-stepping on slopes and uneven ground platforms?
     
  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @jjkrr > I'm not aware of any stutter, and without any info or context it's hard to guess what your issue may be. Please use the support form and provide more info, I'll be happy to check it out for you.
     
  34. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Unity Learn is free right now and their animations tutorials are REALLY helpful.
     
    jjkrr likes this.
  35. jjkrr

    jjkrr

    Joined:
    Dec 3, 2018
    Posts:
    23
    I had accidentally put a position transition for the boxcollider2d offset into the walk animation that was moving the offset, which in turn was causing the stutter step on platforms.
     
    Boom_Shaka and reuno like this.
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @jjkrr > Glad you figured it out.
     
  37. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    Is possible to integrate Corgi with the New Input System?
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @wagenheimer > Yes, it's possible. Right now the recommended way is to extend the InputManager to do so.
     
  39. C4RL4

    C4RL4

    Joined:
    May 19, 2020
    Posts:
    3
    Heyy, I need a lil help, sorry if this was answered before, but I read the documentation and searched the forum and couldn't find anything
    So I tried creating a new AI Action DamageDash by just taking the AI Action Jump and replacing all 'jumps' with 'damagedashs' as well as the 'JumpStart()' with 'InitiateDash()'. The game runs now but the character doesn't dash and I get the error 'NullReferenceException: Object reference not set to an instance of an object'
    I'm sure I'm doing something obvious wrong but I'm very new to coding and still quite bad, so I'd appreciate a little help~

    Also btw the engine is incredible and even for a beginner like me really intuitive to use :)
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @C4RL4 > The first thing you'll want to do is identify what that error is referring to. There's probably a line in the console stack it's pointing to. Look at that. Then look at that line, and identify what is null. Then figure out why it's null (it's likely a variable you never initialized, or you're trying to grab a component that isn't there maybe. And move on from there :)
     
  41. C4RL4

    C4RL4

    Joined:
    May 19, 2020
    Posts:
    3
    thx for the fast reply first of all :]
    so the error lists all of these* but I'm honestly not sure what to do with that.. the only thing I can think of is that maybe because it's a derived class of the normal dash and all the functions are in there, it has problems accessing them?

    *
    MoreMountains.CorgiEngine.CharacterDash.ComputeDashDirection () (at Assets/CorgiEngine/Common/Scripts/Agents/CharacterAbilities/CharacterDash.cs:165)
    MoreMountains.CorgiEngine.CharacterDash.InitiateDash () (at Assets/CorgiEngine/Common/Scripts/Agents/CharacterAbilities/CharacterDash.cs:151)
    MoreMountains.CorgiEngine.CharacterDamageDash.InitiateDash () (at Assets/CorgiEngine/Common/Scripts/Agents/CharacterAbilities/CharacterDamageDash.cs:31)
    MoreMountains.CorgiEngine.AIActionDamageDash.DamageDash () (at Assets/CorgiEngine/Common/Scripts/Agents/AI/Advanced/AIActionDamageDash.cs:44)
    MoreMountains.CorgiEngine.AIActionDamageDash.PerformAction () (at Assets/CorgiEngine/Common/Scripts/Agents/AI/Advanced/AIActionDamageDash.cs:34)
    MoreMountains.Tools.AIState.PerformActions () (at Assets/CorgiEngine/ThirdParty/MoreMountains/MMTools/Tools/AI/AIState.cs:92)
    MoreMountains.Tools.AIBrain.Update () (at Assets/CorgiEngine/ThirdParty/MoreMountains/MMTools/Tools/AI/AIBrain.cs:71)
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @C4RL4 > My guess would be that you didn't initialize your dash component.
    As I said, you should try to identify what variable is null in your code, and figure out why. I don't think the issue is on the engine's side here, it's likely on yours.
     
  43. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Check the character jump script and compare it to the advanced AI example - that will give you a better understanding of how the AI accesses and executes the ability.

    Review the character dash and/or damage dash scripts as well and see how the dash is executed.

    Don't forget the API Document - it shows you how the code is structured and is easier to search/navigate than the Unity UI or script editor (imho).
     
  44. KOPEW

    KOPEW

    Joined:
    Jul 30, 2019
    Posts:
    27
    Hi!
    Can I make a very small delay after pushing a jump button (like 0.1s) and how? It's for animation at first, because now it's like jump animation starts with 2nd frame somehow. I can see it, cuz my character sets crouch for a few secs (.anim) but in game after pressing jump he skips crouching and jumping already "stretch"
     
  45. KOPEW

    KOPEW

    Joined:
    Jul 30, 2019
    Posts:
    27
    And anyway about animation, but not about very small delay after pressing jump button. Like "Jump knight" vut not so much)
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Cunny-Lang > >that's not something that's built-in (the engine encourages tight gameplay, delay before jumps are not something I'd recommend in most situtations), but you can easily implement that by extending the CharacterJump ability.
     
  47. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    Pre-jump/Post-jump animation support. I've requested this too in the past. I think it's very useful for enemy characters, which is my use case. Also useful for certain platform games that could be a perfect fit for Corgi, such as Another World/Flashback.
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Grafos > I haven't forgotten about that, and it's coming :)
     
    javi_unity402 and Grafos like this.
  49. pandemik

    pandemik

    Joined:
    Mar 23, 2017
    Posts:
    11
    hello @reuno Ive been having trouble getting my lives to work or show on mobile devices yet its working perfectly in the editor, is there something that im missing?
     
    Last edited: May 25, 2020
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @pandemik > I suppose that depends on why it's not showing. Could be that your UI doesn't resize properly, or it's a z position issue, or something else.