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. ScotianWolf

    ScotianWolf

    Joined:
    Feb 3, 2021
    Posts:
    9
    Is there a way to adjust where the bullet shoots from ? For example, using your " Blue Robot " . If I wanted to re-position where the bullet shoots from is there a way to adjust it? Thanks
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @ScotianWolf yes, as explained in the documentation that's something you can set in the projectile spawn section of your projectile weapon's inspector :
    upload_2021-3-26_21-16-50.png
     
  3. TheFoxWolf

    TheFoxWolf

    Joined:
    Mar 28, 2021
    Posts:
    3
    I am currently using the Retro Adventures Controller prefab and I have made slight changes.

    The changes that I have made was changing the Animator on the Retro-Character prefab (And used the one from Corgi 2D) . Everything is working flawlessly except for the shooting.. Any idea on how I would go about making it so that if the Character jumps, he can't shoot as I would like to have my character being only able to shoot if he is on the ground?
     

    Attached Files:

  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  5. TheFoxWolf

    TheFoxWolf

    Joined:
    Mar 28, 2021
    Posts:
    3
    I can't seem to find the functions for Attack / Shoot. Am I looking at the right method?
    thanks
     

    Attached Files:

  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @TheFoxWolf > Select the CharacterHandleWeapon ability, and set Jumping as a blocking movement state for it.
     
  7. muslearningmagic

    muslearningmagic

    Joined:
    Nov 29, 2020
    Posts:
    3
    Hi Reuno. Really great asset. Has saved me loads of time and is simply awesome :) Had a couple of questions please that I was hoping you could help with. FYI - i'm a total noob and this is my first post ever so apologies in advance if any of the below is dumb. I tried doing a search on this thread but couldn't find answers for the below.

    1. I see from the documentation the Corgi engine works with hand-weapon (i.e. character hand follows grip transforms on the weapon) IKs for 3D avatars. Does it also work for Unity's 2D animation package for 2d rigs? The problem i'm having is that I can set up IK and it works great when the weapon is part of the player's object hierarchy but as the Corgi engine has the weapon as a separate prefab and swaps it in and out of the player's hierarchy as and when it is equipped, Unity's 2D animation IK removes the reference to the IK targets (weapon's grip transforms) and the IK won't work. I've tried looking into Unity's documentation to see how the IK target can be changed in runtime via script but unfortunately it is currently beyond my noob coding skills. If there is some setting or workaround i've missed here that would make it work, your advice would be greatly appreciated. Otherwise it would be fantastic if Corgi engine weapon integration with the unity 2D animation package IK functionality can be added at some point in the future please.

    2. I've noticed in the features weapon demo scene, if you pick up the same item quickly (like bullets, each pick up with 25 bullets), it will show the total of bullets as one inventory item (e.g. 100 bullets). However, if there is a delay in picking up the next bullets item, it then gets added as a separate inventory item (e.g. so now I have one bullets inventory item with 100 bullets and another inventory item with 25 bullets). Is there a setting please that aggregates the bullets into one inventory item always irrespective of the item pick up time delay or would this have to be added in the code?

    Many thanks
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @muslearningmagic > 1. The only example right now is with 3D IK, but you could implement 2D IK on the same principles. I haven't done such an example yet because the 2D IK in Unity is still relatively new, the API keeps changing, and most people still don't use it in production for these reasons. But it'd be the exact same logic as the 3D one, and you can look at how it's done for reference.

    2. I'm not aware of that "pickup speed issue", and couldn't reproduce it either (no matter how fast I pick them up, I always end up with a pile of 100 and another of 50). There's nothing in the code that "waits" in any way, it's all instant really, so I'm not sure what the issue may be here, and unless you're picking multiple pickers at the exact same frame, I can't think of anything that could produce this outcome. If the issue persists, please use the support form and provide exact repro steps, I'll be happy to investigate this.
     
  9. muslearningmagic

    muslearningmagic

    Joined:
    Nov 29, 2020
    Posts:
    3
    Many thanks for the prompt response.
    1. Thanks for the pointer, i'll look into it.
    2. I checked again and realized my assumption was incorrect. It was not time related but actually the settings in the minimal demo that gave a max value of 100 for bullets. Therefore once the bullet count hits 100, the next bullet pick up will occupy a new inventory slot and start the count again till it reaches 100. Considering this new realization, can I politely change the question please. Is there an option that turns off this behavior (i.e. no more bullets can be picked up once the 100 is reached and therefore no new inventory slots taken up for bullets beyond the first 100)?

    Thanks again :)
     
  10. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @muslearningmagic > No, there is no such limit at the moment, you'd have to implement it.
     
  11. muslearningmagic

    muslearningmagic

    Joined:
    Nov 29, 2020
    Posts:
    3
    Understood and thanks again for the prompt response
     
    reuno likes this.
  12. TheFoxWolf

    TheFoxWolf

    Joined:
    Mar 28, 2021
    Posts:
    3
    Is there a way to get both the Hearts (From the Retro Adventures) as well health UI from the 2D demo to work at the same time. It seems that when I try and add a health bar , it'll display the health bar only and not the stars. Hope that makes sense
     

    Attached Files:

    • 12.jpg
      12.jpg
      File size:
      67 KB
      Views:
      314
    • 14141.jpg
      14141.jpg
      File size:
      177.9 KB
      Views:
      334
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @TheFoxWolf > There's no example of that (it's not a very common use case), but feel free to implement it, of course.
     
  14. NonhumanStoltz

    NonhumanStoltz

    Joined:
    Dec 6, 2020
    Posts:
    19
    Is there a way to have a gameobject appear only if you have certain items in the characters inventory? I don't mean keys, but like making it where the "next level" game object would only appear if character as X items. I tried to use the conditional event MMtool but I guess it doesn't consider item picking as "destroyed" or "disabled." Course I could just make the picker have a key item in it to, which is fine, but curious if there's a streamlined approach I'm not seeing.

    Which, speaking of the MMtools, is there a tutorial vid on them? I couldn't find anything other than documentation and usually I'm able to figure it out what each MMtool does through trial and error and cross referencing with unity.
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @NonhumanStoltz > You'd need to have a class that checks whether or not that item you're after is in the inventory or not. I'd recommend using the Inventory API to do that, it's a one line check.

    And no, there's no video tutorial on MMTools, it's a ton of helper classes, and they're all commented and documented, but I'm not sure what a dedicated video would look like, they're just helpers and tools, and there's a lot of them :)
     
  16. poliman

    poliman

    Joined:
    Feb 5, 2015
    Posts:
    29
    Hi,

    Has anyone come across a problem using Unity 2D bones and making a player from it.

    To recreate just take demo scene lava and replace Player Spine-space-cat (in prefab ModelContainer) with anything that has even one bone made with Unity skinning. It doesn't have to have an animator, pure object made of psb file with one bone.

    The performance on WebGL drops from 100 to 10 frames.

    I you delete the bone and make an object out of psb file it runs smooth, so i guess it has to be connected with bones functionality

    Are Unity 2D bones not compatible with Corgi build to WebGL?
     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @poliman > Unfortunately in all my tests (unrelated to the engine), I found 2D bones performance to not be production ready yet. That said there's no dependency at all between both, and no link I can think of that would cause bones to perform worse with or without the engine. The engine simply isn't "aware" of bones, it doesn't interact with them at all, so I don't think it's related. Have you tried profiling your game to see what causes this? What's performance of that same bone structure without putting it on a corgi controller?
     
  18. poliman

    poliman

    Joined:
    Feb 5, 2015
    Posts:
    29
    Hi thx for mega fast answer.

    The character has:
    - 6 body parts (every part has Sprite skin script on it),
    - one bone.

    WebGL profiler shows:
    1. When disable all 6 Sprite Skin scripts, fps is ok
    2. When enable 1 Sprite Skin script: https://ibb.co/MkNwGCQ
    3. When enable 6 Sprite Skin script: https://ibb.co/3vd3j8T

    Important: the peak is when you move the Player, when it not moves the fps is as normal

    As you see on pics SpriteSkin.LateUpdate() is the problem.

    I tried on Lava scene and also HisterLevel

    Unity 2020.3.2f1, Windows 10

    If you want I can send you prefab of player that i use, or send you whole project, but it is just clean Corgi package with this one thing added.
     
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @poliman > Again, have you tried measuring the performance of that same bone structure without putting it on a corgi controller, and have it move using a class of your own?
     
  20. poliman

    poliman

    Joined:
    Feb 5, 2015
    Posts:
    29
    The problem is not connected with Corgi. I made a clean project with it and there is the same problem. Sorry will go thru it, maybe another Unity BUG ...
     
    reuno likes this.
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @poliman > Yes, unfortunately, it's indeed a Unity bug in this case. I'd recommend reporting it.
     
  22. poliman

    poliman

    Joined:
    Feb 5, 2015
    Posts:
    29
    For anyone interested in WebGL:
    Issue is just poor Unity 2D skinning/bones system performance on WebGL.
    https://forum.unity.com/threads/2d-animation-is-out-of-preview-for-2019-3.818724/page-5#post-6763879
    Everyone has these issues. So as @reuno said, this system is not ready. I had lots of issues with it in standalone games, but WebGL is horrible performance with one character and few vertices ...

    I used Creature skeletons > Unity but it also has issues with shaders.
    https://www.kestrelmoon.com/creature/index.html
    BTW Creature interface is a nightmare, but has some features for a beginner.

    Finally switched to Spine with all my builds, interface is great, workflow is better than others, and it works in WebGL flawlessly.

    But if I can ask @reuno:
    You say in https://corgi-engine-docs.moremountains.com/animations.html > "Spine" section
    "The “best” way ... Select the SkeletonMecanim"

    1. From Spine point of view http://esotericsoftware.com/spine-unity the best option is SkeletonAnimation.
    Did you manage to have a neat way to integrate their SkeletonAnimation to work with Corgi scripts like you have based it on Mecanim parameters?
    2. If nethertheless we use SkeletonMecanim (As i did for now, coz there is only one issue) pls mention one thing in your docs, (from Spine docs):
    "Compared to the SkeletonAnimation component, SkeletonMecanim requires additional timeline keys at the first frame of an animation if it shall smoothly mix out the timeline state of a preceding animation. See http://esotericsoftware.com/spine-unity > section Required Additional Keys for more information.”

    Again thx for help Corgi is really great piece of software ;)
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @poliman > Thanks for sharing that info.
    1. No, there's no built-in support for proprietary animation systems, that's something you'll have to implement.
    2. I can't possibly add spine doc to the engine, that info belongs on Spine's end, not the engine's, it's basic Spine knowledge.
     
  24. GooseLongCat

    GooseLongCat

    Joined:
    Jan 29, 2021
    Posts:
    4
    @reuno I started to develop my own Metroidvania game 2 months ago, and the Corgi engine has been extremely helpful! Thank you so much for this great piece of software! I have a quick question: I am experimenting with MovingOneWayPlatforms and noticed that the player is 'teleporting' on top of the platform when: jumping from below and close enough to the top of the platform (but feet still below the top of the platform). Tuning the platform box collider 2d to be thinner, and the player controller's raycast offset to be shorter doesn't change much. Is there a way to reduce the 'teleport' distance so that it is less noticeable? Merci d'avance pour ton aide!
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @GooseLongCat > MovingOneWayPlatforms should have an edge collider, not a box collider.
     
  26. GooseLongCat

    GooseLongCat

    Joined:
    Jan 29, 2021
    Posts:
    4
    Thank you so much for the fast reply! I was using a box collider because this was the default collider for the MovingOneWayPlatforms on the FeaturesPlatforms Minimal Scene. I just replaced with an edge collider aligned with the top of the sprite, but I am still noticing this small 'teleporting' on top of the platform. Is there a way to reduce the tolerance for it, so that the controller has to be closer to the top to land on the platform? This is a minor detail, but I was still wondering if we can tune this.
     
  27. GooseLongCat

    GooseLongCat

    Joined:
    Jan 29, 2021
    Posts:
    4
    @reuno this seems to happen when _controller.speed.y < 0 and the bottom of the player's box collider is below but within 0.5 vertically of the edge collider of the MovingOneWayPlatform.
     
  28. GooseLongCat

    GooseLongCat

    Joined:
    Jan 29, 2021
    Posts:
    4
    @reuno I could find the issue! In CorgiController.cs, there's the CastRaysBelow() function, and within it checks collisions against OneWayPlatformMask and MovingOneWayPlatformMask: "if the character is jumping onto a (1-way) platform but not high enough, we do nothing", lines 1060-1067:
    • !State.WasGroundedLastFrame
    • smallestDistance < _boundsHeight / 2
    • OneWayPlatformMask.MMContrains(StandingOn.layer)
    • MovingOneWayPlatformMask.MMContrains(StandingOn.layer) && (_speed.y > 0)
    If above conditions are satisfied, we do nothing, otherwise we snap the player to the platform.

    However, when _speed.y <= 0 we'll snap to the MovingOneWayPlatform anyways since the condition won't be satisfied. Removing the extra _speed.y > 0 condition fixed the issue for me.
     
    Fed81 likes this.
  29. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @GooseLongCat > That's by design, but if you prefer changing that, go ahead.
    Next time please use the support form, it'll be faster than spamming the forum :)
     
    GooseLongCat likes this.
  30. cficara

    cficara

    Joined:
    Sep 27, 2017
    Posts:
    35
    Hi! I updated unity to 2020.3 LTS and noticed MMInformation not only is missing from inspector, but is also hiding the next property below. Here's a screen:



    This affects the whole project. Any idea what's going on? Thanks.
     
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @cficara > Yes, yet another 2020.x bug. I'd recommend sticking to 2019.4.x for now, releases after that are unfortunately packed with issues.
     
  32. damiensenechal28

    damiensenechal28

    Joined:
    May 5, 2020
    Posts:
    1
    Hello!
    I'm using the CharacterAutoMovement Ability to force my character to walk when entering a trigger and I want it to stop when exiting this same trigger but I cant find any ways to stop the AutoMovement even by disable the CharacterAutoMovement Script.
    Is someone having a solution to stop my character from automoving and go back into the input mode when I can control my character back ?
    Thank and good evening !
     
  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @damiensenechal28 > The CharacterAutoMovement ability's got a SetDrivenInput method you can use to set its auto input to anything you want (0 would stop it).
     
  34. mk7gwc

    mk7gwc

    Joined:
    Mar 3, 2016
    Posts:
    27
    Hello. I have a question.

    What should I do if I want to lock the character operation to create a conversation scene etc.?

    Also, are there any reference codes or settings in the assets?
     
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @mk7gwc > If by "lock the character operation" you mean disable input, that can be done easily, either at the character/ability level if you want granularity, or at the InputManager level, setting InputDetectionActive to false.
    I don't know what you mean by "reference codes or settings" in that context though, so I can't really comment on that part. I hope it'll answer your question!
     
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  37. CheMBurN

    CheMBurN

    Joined:
    Dec 13, 2020
    Posts:
    20
    Hi Reuno! Just bought the asset and it seems excellent!

    A quick question (sorry if its already been asked). I imported the asset into an existing project I've been working on for a while now - basically I bought the asset to say goodbye to physics based controls (which was giving me a real hard time) and to implement a controller like yours.

    What is the best way to ease the implementation into an existing project? Basically, I already have an extensive framework set up so I at the moment all I would need is a character controller using the Input System. I would very much prefer not to have to work with the asset's level manager class (from a refactoring perspective) What are the bare minimum components required to get my character to move left and right?

    I don't need a complete solution or anything, just an idea of this is possible and I'll try and proceed from there.

    Ninja Edit: Played around a bit. The minimum components seem to be an Input system manager, Character and CorgiController and CharacterHorizontalMovement. Am I correct?
     
    Last edited: Apr 22, 2021
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @CheMBurN > Like all "complete projects" assets on the store, it's best to install it in an empty project, that's how they're intended to be used. Usually you'll want to port anything else into it afterwards.
    If that's not possible, you'll have to merge all project settings into your project. Any diff tool will do the job for that, they're just text files.
    As for minimum scene requirements, there's a section of the documentation dedicated to that : https://corgi-engine-docs.moremountains.com/minimal-scene-requirements.html
     
  39. CheMBurN

    CheMBurN

    Joined:
    Dec 13, 2020
    Posts:
    20
    Thanks for the quick response!

    Damn how'd I miss that. It says the LevelManager is mandatory however the very basic movement seems to work without it. Is it mandatory if I'm using just the basic movement abilities?
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @CheMBurN > Nothing is really "mandatory" if you replace systems with others. The level manager is only mandatory if you want things to work out of the box. If you reimplement its scope, or replace it with something else, you can do without it.
     
    CheMBurN likes this.
  41. CheMBurN

    CheMBurN

    Joined:
    Dec 13, 2020
    Posts:
    20
    Hi Reuno! Managing to make some decent headway in implementing CE into my project. A quick question, I'm trying to extend the InputManager class to accomodate my own InputActions asset - I've used your BindButton method and added my buttons to the MMInput. However, this still triggers a null reference on the character abilities when it attempts to get button state [if(_inputManager.DashButton.State.CurrentState == MMInput.ButtonStates.ButtonDown)]. Any idea what I might be missing?
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @CheMBurN > No, without any detail, no idea. I'd recommend looking at the "new input system" integration that is included in the engine, for a reference of how to extend the InputManager. There's also a Control Freak 2 extension in the extensions repo you could look at.
     
  43. mk7gwc

    mk7gwc

    Joined:
    Mar 3, 2016
    Posts:
    27
    thanks reuno

    The advice helped me achieve my goal.
     
    reuno likes this.
  44. domm90

    domm90

    Joined:
    Oct 5, 2020
    Posts:
    2
    Hi Reuno. Bought the asset on 12/4/21 and it's my 2nd one from you (I bought the runner engine as well). I've ran into 3 issues regarding the RetroAdventure Demo project, tried checking the detailed documentation (which I recommend everyone should) but couldn't find a solution.

    Unity Version 2019.4.11f1
    Corgi Engine version 6.7

    Issue 1
    I duplicated RetroAdventure1 scene & renamed it as RetroAdventure2 and deleted the original RetroAdventure2. Then when playing & completing RetroAdventure2, clicking next level brings me back to RetroAdventure2. So now, I'm not sure what I must modify to make sure that this duplicated RetroAdventure2 will bring me to RetroAdventure3 when completed. Common sense would tell me to go to the LevelComplete Splash screen and edit the 'Next Level' button, but in it there's nothing to change.

    Issue 2
    Quite a similar issue to above but in RetroAdventureLevel Selection scene. I duplicated Level 5 node and renamed it as Level 6. Changed scene name to RetroAdventure6 in its component. Edited the RetroAdventureProgressManager(in Level Selection scene and Prefab) to add a 6th scene as well. In project section, I duplicated RetroAdventure3 and renamed as RetroAdventure6, then added it in build settings. But completing RetroAdventure6 will bring me to RetroAdventure4 instead of 7. So, I'm stuck there.

    Issue 3
    After completing Level 5, clicking next level will bring me back to the Level Select scene instead of the next level. You mentioned in an older post to ScotianWolf that it's because the exit scene in that level wasn't changed but I can't find that 'exit scene'. Was wondering if you could help on that too?

    Thank you Reuno.
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @tbs9 > Please use the support form to report issues, thanks.

    1. Probably a ProgressManager conflict somewhere.
    2. Probably the same issue as above, make sure all ProgressManagers across all scenes in your flow are consistent.
    3. Same issue as the 2 points above, I'd guess.

    You'll want to make sure all your ProgressManagers have the same settings. They're supposed to be a prefab, but the CharacterSelection and LevelSelection ones aren't right now (the next update uses ScriptableObjects for that instead, so you - and I - can't go wrong anymore). The best way to go is to put the same prefab in all scenes, and edit only once.
     
    domm90 likes this.
  46. domm90

    domm90

    Joined:
    Oct 5, 2020
    Posts:
    2

    Thank you Reuno for the speedy reply! And my apologies, any future issues I'll use the support forum. Have a good day!
     
    reuno likes this.
  47. cficara

    cficara

    Joined:
    Sep 27, 2017
    Posts:
    35
    I'm wondering something and not planning to reinvent the wheel.

    Is there a way to ignore certain bullet collisions at runtime?

    Players and enemies uses the same bullets. I would like the enemy bullets to ignore other enemies but hit the player. I know this can be done by layers and creating specific bullets, but don't want to do two different set of the same bullets.

    It should be easy to do it via code. Not sure where, on the Health() component? Thanks tons!

    EDIT: I see
    _ignoredGameObjects
    on
    DamageOnTouch.cs
    which might do the trick, but this means I need to hack my way in. Is there another way?
     
    Last edited: Apr 29, 2021
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  49. cficara

    cficara

    Joined:
    Sep 27, 2017
    Posts:
    35
    Alrighty, thank you. So, the idea is more or less like this:

    1. Create a script, like BulletIgnore.cs, attached to bullet prefab.
    2. That script grabs the owner of the weapon that is shooting this bullet.
    3. If the owner is an enemy, then IgnoreGameObject for all enemies.
    Something like that? If there's some example, it would be super helpful, as this might be a common occurence. Thanks!
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @cficara > No, there is no example, and you're the first person to mention this in 6 years :)
    It seems quite specific, I think the best approach would be to simply implement a dedicated system for this, it doesn't even have to interact with any of the engine's classes, it's unrelated. Just the layer API would be enough.