Search Unity

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

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

  1. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Thanks. i figured out. The issue here is that the hotbar is not getting any touch event when the inventory is closed due to the logic in the InventoryInputManager. I have to override the InventoryInputManager to not disable Raycaster for my hotbar - as I want to allow my player to select the weapon without having to open up the inventory. I want to create a scheme that's similar to minecraft where we have an inventory bar at the bottom where all the items will be filled in there first and then the rest will be put to the main inventory.
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @achan_unity > That is indeed quite different from the example and will require coding. The engine will support that use case, no problem, just needs some UI work.
     
  3. DavidMBradbury

    DavidMBradbury

    Joined:
    Nov 18, 2012
    Posts:
    9
    Congrats on the new video, good stuff. I edited my post and sent the bug report to your e-mail via the contact page.

    To simplify my ask, I'll rephrase.

    If I create a new project and import Corgi Engine v5.4, then open MinimalRooms1, I'll enter the door to the right, then walk to the left. The two blue gates lead to different positions in the next level. However, when you enter, the camera starts in its default position and quickly moves to your character position over maybe one second.

    I'd like the camera to start where my character is when entering the room.

    Now, if I take CameraController.cs and say on line 40, add `transform.position = Target.position` this mostly works.

    However, it causes a different problem. Namely, with the parallax scripts.

    I made some modifications to MinimalRooms2 for testing purposes.

    https://i.imgur.com/6ZhhSZK.png

    I moved the regular camera to the LevelStartTop area and darkened the background color for contrast, aligned the background with the edge of the top platform, shrank it down, added the parallax element and gave it a horizontal speed of 0.5. Starting the scene like this works as expected.

    Now if you save and go the MinimalRooms1, then enter the LevelStartBottom entrance, then travel to where the camera was, the background will be at a different spot:

    https://i.imgur.com/1sjrWQK.png

    In my personal project, I have trees in the background that are aligned with different elements. I'd like them to appear in the same spot no matter which entrance I come from.

    I can dig into it myself or see about coding a parallax script that doesn't use the camera initial position, but I figure if this is already built in and I'm just missing something, I'd ask!
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
  5. Lakris

    Lakris

    Joined:
    Jan 10, 2014
    Posts:
    17
    It is a great looking engine!
    I have been searching through a lot of the features (what is listed) But I can't figure out if it is possible in "3D platformer" to:
    Pick-up an object(ex. cube) and throw it as a "weapon" to harm enemies?
     
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @Lakris > There's no example for this right now. It's doable of course, but would require some code.
     
  7. ceceomer

    ceceomer

    Joined:
    Sep 1, 2014
    Posts:
    20
    Hello @reuno
    I'm newbie about corgi engine. I'm trying to use your demo scene(Retro AI) but i don't understand default parameters on corgicontroller because when i change the speed acceleration on ground prooerty, everything is same. So how can i use them?
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @ceceomer > Well no, if you change the speed acceleration on ground property, everything's not the same. Acceleration will be faster. That's what it does, as explained in the documentation. Now you're probably after speed, not acceleration, and that's defined in the CharacterHorizontalMovement component (well, for regular walk at least). I'd strongly suggest checking out the documentation, it's all explained in details.
     
    ceceomer likes this.
  9. Abrahamus

    Abrahamus

    Joined:
    May 16, 2014
    Posts:
    5
    Hi,

    I'm having a small problem with the Corgi Engine: Dialogue System Support package, which may not be top priority at the moment, but just in case. I tried with the package from the Third Party Support folder, and with the one from the Pixel Crushers website, Corgi Support (2019-02-01):
    And it looks like this (it's the same for the TriggerExit method below):
    Being honest, I have no idea if this should go here or within the Pixel Crushers forum, it's like a 50/50, sorry. I simply removed the override from both methods, you won't get those two errors, but... I don't know, surely there's more to it and to fix it properly there is another solution (not confident enough about simply removing override :') ).

    Oh, by the way, the Corgi Example scene from those packages has some missing prefabs. That's it, thanks for your time guys.
     
  10. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @Abrahamus > I don't know this asset you're talking about, not sure how I could help, it's not mine :)
    I'd suggest contacting their authors.
     
    Abrahamus likes this.
  11. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    33
    Hello reuno

    New to Corgi Engine and digging through it and searching this thread up and down with infos if you can have abilities as pickup items. For example picking up an jetpack and the ability gets unlocked/modified (similar to weapons or keys, coins etc.)

    thnx in advance for the info :)
     
  12. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    203

    Yes you can. There is an entire inventory solution in the examples. The jetpack is actually set as an ability script that just gets attached to the player character. It has a few settings and you can simply make it active on a pickup.


    It's pretty simple.
     
  13. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    33
    But i'm still puzzled, is there an example of such an ability pickup? U say its simple so i guess yes but for the life of me i cannot find it. Ok its pretty late over here and shuteye mode was initiated an hour ago but i can't find the demo level where this is happening. A nudge into the right direction would be appreciated! Thank you!
     
  14. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @macish > No, there isn't (or I - again - completely forgot about it). I don't think there is :)
    That said it should indeed be quite simple to do.

    It's very simple if you want a regular pickup, and it'll be a bit more complex (but still quite easy) if you want to do it with inventory support.
    I'll explain the "regular pickup" version, it's more or less the same for inventory, check out the inventory doc to learn more about how to create items and all.

    Basically you'll want to create a new type of PickableItem (you can look at the Coin class, or Stimpack, or Mushroom for examples of how it's done.
    And just like the Mushroom class grabs the SuperHipsterBrosHealth component and targets it to call one of its methods, you'll want yours to grab, let's say CharacterJetpack, and set its AbilityPermitted to true (assuming it was false before). And that's all there is to it :)
    It's actually so simple that I just coded it, there you go :

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using MoreMountains.Tools;
    4.  
    5. namespace MoreMountains.CorgiEngine
    6. {
    7.     /// <summary>
    8.     /// Add this class to an object and it'll double the size of a character behavior if it touches one
    9.     /// </summary>
    10.     public class PickableJetpack : PickableItem
    11.     {
    12.         /// <summary>
    13.         /// Checks if the object is pickable (we want our picker to be a Player character).
    14.         /// </summary>
    15.         /// <returns>true</returns>
    16.         /// <c>false</c>
    17.         protected override bool CheckIfPickable()
    18.         {
    19.             _character = _collider.GetComponent<Character>();
    20.  
    21.             // if what's colliding with the coin ain't a characterBehavior, we do nothing and exit
    22.             if (_character == null)
    23.             {
    24.                 return false;
    25.             }
    26.             if (_character.CharacterType != Character.CharacterTypes.Player)
    27.             {
    28.                 return false;
    29.             }
    30.             return true;
    31.         }
    32.  
    33.         /// <summary>
    34.         /// on pick, we activate our jetpack ability
    35.         /// of course that's assuming it was false before, and you could have this behave in a more complex way if you want
    36.         /// </summary>
    37.         protected override void Pick()
    38.         {
    39.             _character.gameObject.GetComponentNoAlloc<CharacterJetpack>()?.PermitAbility(true);
    40.         }
    41.     }
    42. }
    I'll include that script in the next update.
     
    Muppo, addz92, macish and 2 others like this.
  15. alKaszL

    alKaszL

    Joined:
    Jan 26, 2013
    Posts:
    7
    Recently bought the asset and I am quite impressed with how easy it to to customize out of the box. I am tinkering with an idea for a game which involves a character control similar to the classic "Asteroids". Essentially, I would like to disable gravity (I have done this in a test with the Corgi engine), be able to apply jet pack force from any direction (untested), and have the ability to continue moving after the thrust is released from the initial force of the jet pack. I would like to be able to control the damping of the motion as well (think a hockey puck sliding on ice). I would love to have this specific mechanic integrated into the feature set of the Corgi engine. I figure there is nothing directly out of the box that satisfies this requirement, but is it possible to use the Corgi engine's physics engine to achieve this game mechanic? I am a C# developer by trade so I don't mind digging into the code and extending functionality. Thanks.
     
  16. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @alKaszL > Technically everything is possible, but turning a platformer engine into an Asteroids game seems a bit of a weird tech choice if you ask me. It'd be much easier to do that with the TopDown Engine, seeing as Asteroids is a top down game (https://topdown-engine.moremountains.com/).
     
    alKaszL likes this.
  17. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    33
    Thank u reuno, this is highly appreciated! And you are right, its super simple, after one understands how things are set up. So its Character Abililty -> Individual Ability and therefore there was no PermitAbility declared inside the individual ability itself. I get it now and again thank you very much!

    I just drop a link to your API Documentation here if somebody else wants to modify your script further. https://corgi-engine-docs.moremount...s_1_1_corgi_engine_1_1_character_ability.html

    thnx again! :D :thumbs_up:
     
    Last edited: Mar 12, 2019
    reuno likes this.
  18. alKaszL

    alKaszL

    Joined:
    Jan 26, 2013
    Posts:
    7

    Thanks for the response. It is more that I want to have a part of the game use this type of mechanic in small sequences and then switch back to platforming. I will look into how I can achieve this and look into the TopDown engine as well :)
     
    Betzalel likes this.
  19. MadZack

    MadZack

    Joined:
    Jan 18, 2019
    Posts:
    3
    Hello Everyone I dont know why but my player cant stomp an enemy even the bulkydude i think i miss somthing important but what ? if someone can help me it would be great thank you again.
     
  20. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    17
    @MadZack Do you have the stompable script set up on the enemy?
     
  21. MadZack

    MadZack

    Joined:
    Jan 18, 2019
    Posts:
    3
    yeah am using the bulkydude for testing but like i say no result :/
     
    Last edited: Mar 12, 2019
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @MadZack > does the problem happen with the demos as well (mesa1) for example? Please use the support email if the problem persists, I'll need more info to help.
     
  23. MadZack

    MadZack

    Joined:
    Jan 18, 2019
    Posts:
    3
    its working on your demo scene but in my scene nothing happen am taking the bulkydude for testing it but nothing happen like a sayed i think my player setup is wrong maybe i dont know.
     
    Last edited: Mar 12, 2019
  24. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @MadZack > As I said, please use the support email, I'll need more details, thanks!
     
  25. Betzalel

    Betzalel

    Joined:
    Dec 3, 2017
    Posts:
    17
    Hey @alKaszL ive also been trying to integrate a sort of 'mini game' level where one can have a top down asteroids type flying mode then to return to a platformer. I haven't come up with a working solution yet but would be happy to share once i do. on that note i have a question for you @reuno ... is the topdown engine compatible with the corgi engine in the same project? im assuming they arent since it looks like the topdown has more physics active components? if they arent is there a way to disable one for one scene and activate another for the next? i know that might sound like overkill for what im trying but just curious for other reasons as well... i like the idea of mixing the two genres.
     
  26. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    103
    Have you tried extending the character fly ability? I think that would probably be the best way to simulate the movement physics you're talking about and the "always flying" boolean would allow you to bypass Corgi's gravity effects.

    You might also have to use a dedicated scene that simulates a "top-down" view -- not sure how you'd be able to switch to/from it and a traditional platformer in the same scene.
     
    alKaszL likes this.
  27. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @Boom_Shaka > I would also recommend using a dedicated scene (or at least controller for that). It's gonna be much faster and easier to manage in the long run. I believe in picking the right tool for the right job and a platformer controller is not the right solution for a top down game. Both genres share pretty much no core mechanics when you dive into the details of the gameplay. That's the whole reason behind the TopDown Engine being a different thing.
     
    alKaszL and Boom_Shaka like this.
  28. NEHWind2

    NEHWind2

    Joined:
    Jan 7, 2016
    Posts:
    23
    @reuno

    Hi again! I'm back with another probably silly question!
    I'm looking to include two modes in my game, Stage Mode and Standard Mode.
    Standard Mode gives the player three lives before the Game Over scene sends them back to the main menu.
    Stage Mode gives the player unlimited lives and they can play until they win the stage or decide to quit.

    Either one is easy to set up but I'm having trouble featuring both since the Game Manager from any previous scene is carried over into the next which brings in the maximum/current lives settings from that previous scene. If the first scene of Standard Mode could force the max/current lives to 3 and ignore what came before, or if the Stage Mode level select scene could force the max/current lives to 0, I'd be set.

    I'm probably not explaining this well, but is there a way to make the game drop the previous scene's Game Manager (or just the settings about player lives) and instead use the one in the scene being loaded?

    Thanks!!
     
  29. VandalProductions

    VandalProductions

    Joined:
    Jul 24, 2017
    Posts:
    3
    Thanks! that solution worked perfectly to play a sound when landing :)
    Now I'm struggling with other issues... I'm trying to use the HitTheGround variable to also trigger a landing animation, but it doesn't play. I see that the boolean only becomes true for a frame and then it comes false and the Animator goes back to Idle, could that be the problem?
    Also I can't find how to modify the falling velocity of the Player. Right now it falls too quick and it seems to allways have the same falling speed. That looks really nice for cartoon graphics, but would it be possible to make it fall slower and to gradually accelerate? (nothing fancy, if the character takes "just a second" before start falling at the full current speed that would work)
     
  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @NEHWind2 > I'm not sure I understand what's preventing you right now to have a class in your scene call the GameManager's methods to change the amount of lives as you see fit. That seems easier than changing how the game manager works.
    @VandalProductions > If the boolean becomes true, then it's working just fine. What (probably) isn't working fine is your transition(s). I'm guessing it's getting interrupted by something else, in which case you need to tweak your animator to prevent that. Just standard Unity, nothing specific to the engine here. As for falls, no, it's not a constant speed, gravity is an acceleration (just log positions to verify that). And you can tweak gravity on the CorgiController's inspector, as explained in the documentation.
     
  31. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    219
    Hey reuno,
    Can you provide steps on how to update objects on a SingleObjectPooler?
    I took an object with GetPooledGameObject() applied some changes and then used it as GameObjectToPool(). I'm unclear on how to apply the changes to the rest of the objects in the pool though. I thought FillObjectPool() with PoolCanExpand set to false would do the trick, but it still just expands the pool with the new objects, instead of replacing the old ones with the new.
     
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @Grafos > Yeah that is indeed not gonna work. You can either iterate through all objects in the pool and apply your changes, or apply changes on activation. Or you could extend the pool to add a dedicated method for that.
     
  33. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    Just curious, how is the implementation with cinemachine going?
    Or is it still not supported from their side for integration with the engine?

    I am need of some of its features but got a bit worried when I read about problems with the LevelManager and Parallax elements throughout the forum. I will try with the provided script on GitHub for starters.
     
    Friction likes this.
  34. Friction

    Friction

    Joined:
    Jan 6, 2015
    Posts:
    16
    I'm also waiting for this feature. I hope we don't have to wait too long.
     
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @kriyordev, @Friction > I'm waiting on Unity to change the way it handles packages in the context of the Asset Store.
    Basically right now a publisher on the store can't include the package manifest (so you can't say "when importing this asset make sure that Cinemachine and the Post Processing packages get installed"). Until then, if I were to add support for Cinemachine, this would mean errors on install. I hacked an auto import thing in the TopDown Engine, but something like 2 to 4% of users still have issues with it, as it's not as bulletproof as a native solution could be. And I'd rather not have that same issue affect the Corgi Engine user base. So still waiting. In the meantime the one in the extensions repo should act as a good starting point.
     
  36. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    Thank you for the quick reply. I do hope they would allow you this integration soon.

    Might be a simple question, but how do I actually use the script at the repo? I just dropped it into my game folders and it's full of the same error. FindObjectOfType(); is underlined with the same error. (Uploaded an image). Overall I did make the Cinemachine camera work and follow my player, however, there are two instances of my player at the same time. Checkpoints and parallax not tested, but I assume the script at the repo will help.
     

    Attached Files:

  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @kriyordev > I wouldn't know, I've never tested that script. You'd have to ask its author.
     
  38. JohnnyBrovo

    JohnnyBrovo

    Joined:
    Feb 11, 2018
    Posts:
    4
    Hello have a question. When i use the SwitchManager in 2D platformer. If i take damage on one of the characters and i switch to the other my health resets back to full. How can i keep the damage from reseting on switch?
     
  39. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @JohnnyBrovo > You'd need to extend the SwitchManager for that (have it target the Health component of the "new" character to pass it the health of the previous one).
     
  40. statrick

    statrick

    Joined:
    Oct 12, 2013
    Posts:
    4
    @VandalProductions basically the way I solved this was to not use the Anystate. I've seen this question a few times now so i made a little video showing how I did it.
     
    Last edited: Mar 16, 2019
  41. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @statrick > Thanks for sharing this! And indeed, not using the any state pattern is the very first advice in the animation documentation. It's for demo purposes only, of course it's better to do it the regular way, just like you would for any character in Unity in general :)
     
  42. whatbus2000

    whatbus2000

    Joined:
    Nov 21, 2014
    Posts:
    56
    would there be an easy way to have the player keep the momentum of the moving platform when jumping from it?
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @whatbus2000 > Sure, you can get info from the MovingPlatform class to get its current speed, and then add it to the character on jump, possibly altering that vector depending on the desired result.
     
  44. knuppel

    knuppel

    Joined:
    Oct 30, 2016
    Posts:
    90
    Hello, could you give an example how to get the state of the (for example) shoot button from InputManager. I'd like to access it from an other script.
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @knuppel > Sure, as explained in the documentation, and as shown in the ton of examples of that throughout the engine (pretty much in every ability), it's as simple as this : _inputManager.ShootButton.State.CurrentState
     
  46. DrSizzle

    DrSizzle

    Joined:
    Feb 16, 2018
    Posts:
    2
    Anyone else having trouble importing v5.4? every timeI try to import it only imports v5.3?

    OK I got it. For some reason unity wasn't updating the import link.
     
    Last edited: Mar 18, 2019
    reuno likes this.
  47. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    I just wanted to update on something that might be useful. I managed to combine the LevelManager script with the Cinemachine one on the GitHub and it works. The camera follows the player and so on. Now I have another small issue, but that is not what I wanted to share.

    The only reason I have these problems from the start is that I need to select my character in the original LevelManager from my Project folder. If I place my character prefab inside the scene and I reference the same on scene character prefab to my LevelManager, I get a duplicate of my player on Play. So I get two players at the same time and it's far from optimal. Is there a way to have my player be taken from the scene rather than how it is now from my Project folders? I checked all examples, but in all cases, the character does not initially exist in the scene. Or maybe I am missing something simple?
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @kriyordev > As explained in the documentation, characters get instantiated, that's how the system works. So of course if you have one in your scene you'll get two on play (or more). That's because the LevelManager handles instantiation, of one or many characters, and this enables many other systems afterwards.
    You can decide to not use the LevelManager, although I wouldn't recommend it, as it'll of course imply re-implementing a lot of things if you decide to use them, and instantiating characters is just standard practice. You could also extend the LevelManager to have it pick a character from the scene instead, although there's nothing to be gained from that, and is gonna complexify stuff (respawn, among other things).
     
  49. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    29
    I see. Quite the dilemma. I can't fix some of the bugs with the current manager, but I am far from able to edit it that much. I wouldn't want to drop it either after it works so well. Ultimately I was trying to create cutscenes with Cinemachine and have Dynamic Camera zones with it as well, but it proves tricky so far. Thank you for your time though!
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,160
    @kriyordev > I'm not aware of any bug with the current manager, if you think you've found some, please use the support email to report them, thanks.