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. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
    Ok, I understand.
    For this type of object you implement the IPlayerRespawnListener interface to SetActive(true) the object on checkpoint respawn :)
    Thanks
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @matteo.piccioni > Exactly. But yeah as you said (and obviously) if you're not gonna reuse the object, destroying it is the way to go.
    A general remark regarding performance and low-end devices, as I've had to repeat that a lot via email recently : my opinion is that it's not possible to make a "all cases" engine. If you're targeting old phones or stuff like that, there's a lot in the Corgi Engine you'll want to remove, starting with camera effects probably. I won't sacrifice more power hungry features though, it's up to you to decide what works for your specific target.
     
    matteo-piccioni likes this.
  3. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
    Excuse me Reuno,
    I was not able to use your wall-jump feature to go up if I am in the middle of two vertical walls.

    While the character is stick and is sliding down from the wall (for example on the left), I click jump button
    Then the char jump in the other side direction (on right) but immediately back in the old direction, so I am not able to stick to the other side of the wall...
    How should I use this feature ?
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @matteo.piccioni > I'm afraid I can't reproduce what you describe, wall jump's working fine (I just spoke to another user who's currently improving on it). Does this happen with the vanilla asset ?
     
  5. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
    I am sorry what is vanilla asset ?
    I have the problem even with default scene and default characters...
    Maybe I dont know how use it...
     
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @matteo.piccioni > vanilla = without any change, straight from the asset store.
    And well it's pretty much as you'd expect. Let's say your first jump is on the right wall (a good example is on Mesa1 just before the cannon) :
    - jump to the right wall, joystick to the right
    - you "stick" to the right wall, going down slowly
    - jump to the left wall, joystick to the left
    - repeat
     
  7. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
    ok, I thought it was more self-driven..for example with the only jump that should be able to jump into the opposite direction...where if no wall then the character will fall...if wall then the char will stick
    In this way for me it is a bit difficult to climb without falling...I am not so good to hit jump and direction simultaneously :)
    However it is almost more better to jump on the same wall, you can go up anyway
     
  8. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204

    if its not working in the editor I am taking a wild guess but sometimes I notice if you build a new level and copy things over but mess up where your spawn vs level bounds is that usually makes the camera all wonky. I.e. you moved the spawn point in your own level but never touched the level bounds from a template level... could be an issue.
     
  9. dabaq

    dabaq

    Joined:
    Apr 20, 2014
    Posts:
    14
    Hi.

    I know you probably don't take requests, but this character movement looks so neat. Would this character movement be too hard to implement in your engine? Instant buy if this would come :)

    Link:
    https://www.youtube.com/watch?t=35&v=iNVUlWW0Uic

    Best regards
     
  10. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @dabaq > That's just basic 2D physics. You don't need an engine to do that, it comes bundled in Unity :)
     
  11. civeo

    civeo

    Joined:
    Feb 1, 2015
    Posts:
    6
    Hey Reuno, in reply to your answer for the fire rate thing for the ranged weapon:
    (@civeo > Well that's very easy to tweak. You just have to select your weapon's prefab, and in the inspector there's a Fire Rate variable you can change. For the MachineGun for example it's 0.2 (seconds between shots), so if you increase it to 1 for example, you'll only shoot once per second.)

    While yes that changes the timing for when I press and hold the fire button but not when I simply spam the fire button, I can just press that fire button really fast multiple times and the fire rate variable doesn't change that. Is that normal?

    Also I was wondering when you would improve the dialogue system so we can talk back to certain characters (maybe even with multiple choices of answering :)).
     
    Last edited: Jul 31, 2015
  12. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @civeo > That's normal, there's no anti spam check in place right now (the demo guns are pretty fast, and I tend to add features on the platform side of the engine, this being a platformer engine and all). You can easily add one if you want to though, it's basically the same behavior as when you keep pressing the button, you need a countdown that prevents the player from shooting while shooting. Hopefully this makes sense :)
     
  13. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    @matteo.pisani.91 The reason is a good one too, @reuno has included an awesome check point system that is very similar to games like the new super mario. That is to say, if you kill bad guys and get collectibles but die, they respawn. Though if you kill guys and get collectibles and make it to the next checkpoint, all those guys and collectibles are 'banked' and won't respawn only the ones ahead of the current check point. This is amazingly awesome.

    I would like to point out that any solid pooling system would also have a ton of inactive objects created at start up and just disabled. I am sure having them destroyed if you never ever ever needed them again would be slightly more efficient but having them at the ready is so handy.
     
  14. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    @civeo I need to implement this for my game, once I have it done i can help you too.
     
  15. civeo

    civeo

    Joined:
    Feb 1, 2015
    Posts:
    6
    Thx codejoy, I would appreciate that.
     
  16. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    @reuno I was curious where or how friction is exposed. I would like to create some areas that are ice and have the character slide around some but wasn't sure where to start on that.
     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @codejoy > so far this is not exposed.
    What I'd do I guess is basically what I do for water, wind, stuff like that, except that wouldn't be a zone but a surface. Wind and water are definitely good starting points. Then you'll want to change the character speed, obviously.
     
  18. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    so by surface if it is just a collision you would change up the character speed accordingly? probably with ice its slippery so there would be fall off to 0.

    I know people ask you to add all sorts of things to the corgi engine that are sometimes out of the scope of a platforming engine, but surfaces I think are a pretty big one. Lots of old school platformers had icey platforms, sticky slowing ones, flowing ones like a water stream that "push" you around... and more. Just something that would be nifty in a future release, I know with the skill you have coding your system would be awesome and easy to use for any kind of surface.
     
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @codejoy > Well you'll want to change the speed, and probably add some inertia and stuff, yes.
     
  20. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
    Hi @reuno, I want to ask you something.
    How you did to import the corgi(with spine skeleton) to the unity corgi engine asset?
    I ask this because I've noticed that the "spine-space-corgi, ""spine-space-pig", "spine-space-cat" dont have the regular script "SkeletonAnimation.cs" but still have the skeleton.
    Could you tell me the steps I have to for export/import from spine to unity do to make my character spine as the "spine-space-corgi"? I want to use your method without sprites in the CorgiEngine.

    Regards,
     
    Last edited: Aug 1, 2015
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Mr.Stein > Sure, i used the "baking" method, described in much better terms than I would over there :

    Note that I used that method because Spine prevents from redistributing their Spine runtime, so that was the only solution to include Spine powered characters in an asset on the store. When I create games I usually use the "classic" Spine way. It provides a better workflow, and allows much more possibilities, so I wouldn't recommend the baking process if you're just doing a game, not planning on selling an asset. I hope this answers your question :)
     
  22. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
    Oho!! thanks you very much @reuno!
     
  23. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
    Have you tried as I wrote on page 15?
     
  24. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
  25. HeyItsLollie

    HeyItsLollie

    Joined:
    May 16, 2015
    Posts:
    68
    Hi @reuno, just a quick question. Does Corgi Engine currently support two-directional ladder/fence climbing? Vertical and horizontal movement, like you'd see in a lot of Super Mario games for example. [1] / [2]

    I wasn't able to load the Corgi Engine web demo to check if this was supported. The Unity web player gave me a "Bad file length" error, and the HTML5 player would stop loading half-way through.
     
  26. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    HeyItsLollie likes this.
  27. superdbop

    superdbop

    Joined:
    May 11, 2015
    Posts:
    3
  28. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    @reuno or anyone really. I am having one heck of a bug I cannot find. So there is inside the corgi demo levels (and my current level) a GameManagers prefab. It does input etc...runs things.

    UPDATE: Removing the Sound Manager on that Game Manager prefab, fixed my issue. I have no idea why still... or how it was causing issues.


    If I set the scene with all this in it to start up when I make a pc exe build, that GameManagers gets deleted from the scene on startup so far as to call the OnDestroy method. Now since i cannot see debug information. I put this in my GameManager.cs file:
    Code (CSharp):
    1.  
    2. void OnDestroy()
    3.     {
    4.         Debug.LogError("WE DIE!");
    5.     }
    Okay...if I start the scene with all that in there from the editor works fine. THe GameManagers prefab never gets destroyed.

    If i call it from my bootstrap scene that loads some static stuff and goes through a menu and a cut scene scene and then loads this the GameManagers is gone i can see it not there in hierarchy in the editor.

    If i use my debug option i built into my bootstrap that basically says this:


    Code (CSharp):
    1. if (!debugMode) {
    2.             Application.LoadLevel ("disclaimerScreen");
    3.  
    4.         }
    5.         else
    6.             sceneManager.LoadScene (skipToScene);

    It seems to work. So the bootstrap is a DontDestroyOnLoad object...and has some static classes slapped onto it.

    The strange thing is I would say its something my boot strap is doing but it just keeps a scene Manager of my own around (super simple havent done any real code with it)...a sound manager, which im ditching to use corgis and a Managers.cs file which has a bunch of static classes so I can access points for saving and loading to disk etc.

    Also, the fact I can have my build settings set with the demo level at the top and build an exe and run it and still see no controller working (cause the GameManagers with the InputManager is getting nuked) leads me to believe something else is going on. I am pulling my hair out and am not sure what else to check... I wish in OnDestroy i could see somehow what was asking it to be destroyed.

    I did some grepping and looked and there is no name clashing (besides Unity would warn me I think). I cannot figure this out at all. I even renamed the GameManagers to something else to be sure nothing was deeply calling GameManagers to be destroyed.
     
    Last edited: Aug 6, 2015
  29. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    Id like to add that after removing the sound manager the sound effects and music still played?
     
  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @codejoy > Well that's a pretty weird one. Does this happen with the vanilla asset (without any change) ? Are you using the latest version of the asset ?
     
  31. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @matteo.piccioni > I don't know that particular asset but as long as it produces collider2Ds, you should be fine.
     
  33. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    @reuno I cannot figure out why this is broke.
    The long and short is I think there is a bug in unity when Singletons are involved.


    First also the fix of removing the sound manager was not a fix. Was happenstance it worked.

    The short short version:

    Level works fine. The minute I build the level out to an exe, even if i don't play it and remain in the editor. The GameManager gets deleted the minute the LevelManager spawns a player. Somewhere on this line:

    GameManager.Instance.Player=_player;

    In the LevelManager awake. commenting this line out, does not kill the GameManager (but of course bad things happen).

    So if I am in the editor with the GameManager getting deleted. I can load a diff project in unity, and come back to mine and all seems okay. Until I build an exe, or build and run one. And the EXEs are always broken (they run up until the sceene with a game manager and that's because it gets deleted and players dont work anymore no input manager)

    Barring loading a new project I can also fix the editor state by removing every component on GameManager that is a Singleton, running the game from the editor, then reverting the GameManager back and it fixes itself. After that running the game from the editor works just fine....until I build again.

    The build settings are my only scene im testing and have ticked, I have others added to scenes in build but all are unticked. This is the only difference from the corgi project untouched and mine. Player settings might be different but that shouldn't have any impact.

    Two things to note:

    A) that this happens not just in the scene I created but if i go back to Mesa1.unity and add in an original player character make a build the same thing happens. I am not sure what could be breaking this...totally lost and seems like a Unity bug. At this point the only parts of the code that are mine causing this are slight changes to CharacterBehavior, CorgiController and the like but nothing that should be causing this sort of behavior.

    B) Before i really started working on my own code I recall the build from the corgin engine doing this also. Long ago, at the time I thought it was just the input settings in unity were messed up...and disregarded. Thinking back I am pretty sure this same thing was happening.

    C) I couldn't get it to break from the StartScreen demo. I added a level manager and a character and it worked fine everytime (no level so I could just control the character before he fell of screen and it would give errors in the editor about no level bounds etc.). So if I keep trying in StartScreen I might be able to break it. The process to break it is semi repeatable:

    Have LevelManager prefab. Build an exe, run the exe see if the prefab that spawns moves...if not. Go back to the editor (never close it) and press run to see the GameManager to delete. To refresh can see above where I remove components or load a new/project and scene and go back.

    D) The only test I have left is to copy files I have changed from a fresh corgi over and change nothing else and see if it still fails.

    I have a gut feeling that maybe there is an upper limit to the amount of scenes in the "scenes to build" that can be added, or having two resources folders is bad in a project. Or something wonky that is throwing it off. But pretty specific break with no fix but a remedy in the editor makes this a strange strange bug.


    Unity version:
    5.1.1.f1
    Corgi Version:
    1.5.2

    No other idea what more information I can help with. At this point seems like a strange unity bug that Corgi sets up some how. Again only happens in the build...will mess up the editor but not always after making or running a build. I am willing to help in anyway possible and I will keep investigating this. I should maybe post this in bug forums too of unity3d?
     
    Last edited: Aug 6, 2015
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @codejoy > I'd really like to help, but you don't even answer my question about this bug happening with a vanilla asset :)
    In any case, you're using a version of the engine that is 2 versions behind, I've added a lot of stability fixes to the last 2 versions, I suggest you upgrade, it should fix your issue.
     
  35. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    Lol I did see this in vanilla yes. But I will upgrade the versions and see if I can fix anything. It will take a while cause i have to hand jam all my changes to the new version.
     
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @codejoy > Ok well what you can do maybe is start a new project with the last version of the asset. See if you still reproduce it then. I've made some changes to the gamemanagers in these last updates, so hopefully it'll solve that as well.
     
  37. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    thanks again! This update fixed my woes and i see the other things like the hitting the head used to bounce the character down and that's fixed too. It wasn't that bad. I had to diff the files and put what i add. Most the interfaces remained the same all I saw was CanTakeDamage was added to CharacterBehavior. It was over all just about a 3 hour process. Not to bad and it works and builds and everything! :)
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @codejoy > You're welcome, I'm happy to know the update fixed your issue :)
     
  39. heyteg

    heyteg

    Joined:
    Mar 2, 2015
    Posts:
    3
    Hey @reuno! Love the asset, i've been playing around with it for some time now... Right now im tinkering with the animations and was wondering how i could get te walking animation to play without having the character moving? I cant seem to find that animation in the animator o_O
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @heyteg > Hum if you're looking for a way to trigger an animation while the character's just standing, it's the "idle" state in the animator. If I didn't get what you meant right, or if you have other questions, please use the support email, makes it easier for me to answer :)
     
  41. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    Great news you guys,
    I've just published v1.6 of the Corgi Engine.

    This new version adds the following stuff :
    - adds teleporter system, now you're thinking with portals

    - adds pushable blocks, and more generally the ability to interact with physics objects

    - fixes a collision bug that could cause the player to go through the floor while jumping on walls at a certain angle
    - fixes (actually finally takes into account) the GoesRightInitially boolean on AISimpleWalk
    - adds a UseDefaultMecanim behavior parameter for those of you who want to implement their own animation methods
    - fixes a bug with the bonus blocks animation

    Note that this new version (and all versions from now on) is now published by More Mountains, my new creative studio. Nothing changes for you, just a new name I'll be using to distribute my future games. The good thing is that the engine now has a better dedicated page, over there : http://www.moremountains.com/corgi-engine-best-unity-2d-platformer

    I'll be posting tutorials for these new features on Youtube in the coming days. 1.6 should be available for download within a few days, as soon as it's validated by Unity.

    As usual, if you like this new version, please add a good note/review on the asset store, it'll keep me motivated for future updates :)
     
  42. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    LOLLLLLLL you are killing me @reuno :) I just did the upgrade to 1.5.4 and now 1.6 is out ;)
    I am excited for the push blocks they look way better than my implementation!!!

    I had a few questions on it in general:

    Is there a way to designate colliders as ceilings and take the friction off so I don't bonk my head and loose all forward momentum? Not sure how'd i'd do this... or if the feature somehow exists.

    Secondly I tried a quick hack to get the jetpack to move in the direction of the joystick. I think my usage of the controllers addforce was wrong: (Input code updates _horizontalMove and _verticalMove just like in CharacterShoot)



    Code (CSharp):
    1.  
    2.  
    3.      
    4.     public void JetpackStart()
    5.     {
    6.         .... .... ....
    7.         // we get the direction the player is inputing.      
    8.         float HorizontalShoot = _horizontalMove;
    9.         float VerticalShoot = _verticalMove;
    10.  
    11.         // we calculate the angle based on the buttons the player is pressing to determine the direction of the shoot.                                  
    12.         float angle = Mathf.Atan2(HorizontalShoot, VerticalShoot) * Mathf.Rad2Deg;
    13.        
    14.         Vector2 direction = Vector2.up;
    15.        
    16.         // if the user is not pressing any direction button, we set the shoot direction based on the direction it's facing.
    17.         if (HorizontalShoot>-0.1f && HorizontalShoot<0.1f && VerticalShoot>-0.1f && VerticalShoot<0.1f )
    18.         {
    19.             bool _isFacingRight = transform.localScale.x > 0;
    20.             angle=_isFacingRight?90f : -90f;
    21.            
    22.         }
    23.         // we move the ProjectileFireLocation according to the angle
    24.         bool _facingRight = transform.localScale.x > 0;
    25.         float horizontalDirection=_facingRight?1f:-1f;
    26.        
    27.         // we apply the angle rotation to the direction.
    28.         direction = Quaternion.Euler(0,0,-angle) * direction;
    29.        
    30.         // we rotate the gun towards the direction
    31.         float h = Mathf.Cos (angle);
    32.         float v = Mathf.Sin (angle);          
    33.         Vector2 dirVec = new Vector2 (h, v);
    34.         _controller.AddForce (dirVec);
    35.  
    36.         //_controller.SetVerticalForce(JetpackForce); //replaced with above...
    37.         ....
    38.         ....    
    39.       }
    The forces seem way bizarre so I am thinking AddForce is not the right thing to be using. Any ideas or pointers would be awesome.
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @codejoy > Well you sure have a lot of questions don't you ?
    Regarding the "ceiling friction", I'm not exactly sure what you mean, but you'll want to have a look at how the CorgiController class casts vertical rays above the character, and how it reacts, and change that behavior.
    For the jetpack, I think you went the wrong way, and I'm not surprised to read you're having weird results. You should have a look at how the jetpack class currently works. It sets a vertical force, doesn't add it. You should start from there.
     
  44. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    @reuno always questions! I did notice the Add was wrong and I meant to use
    SetForce


    Code (CSharp):
    1.     // we rotate the gun towards the direction
    2.         float h = Mathf.Cos (angle) * JetpackForce;
    3.         float v = Mathf.Sin (angle) * JetpackForce;          
    4.         Vector2 dirVec = new Vector2 (h, v);
    5.         _controller.SetForce (dirVec);
    It is closer but not perfect though cannot test without a good analog stick right now...

    What I just meant with the ceiling was if you jump up at an angle and hit your head on the ceiling you instantly come straight down... I think other games your head usually glides on the top of a ceiling. I will check the CorgiController for the rays above the character.
     
  45. figyel

    figyel

    Joined:
    Aug 10, 2015
    Posts:
    1
    hi,
    I had bought it a lanog time ago...i ve some time to look at it now. i m looking the exemple scene and i dn't find where the caracteres are chossen for each scene.
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @figyel > Can you please send me an email along with your invoice number on the support email ? Thanks.
     
  47. Jkc_dev

    Jkc_dev

    Joined:
    Apr 20, 2015
    Posts:
    35
    Hi @reuno.
    First, the new version seems to be awesome.
    I was wondering if you have in your mind implement a shadow for the character? Would be great!
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Juaks > I've implemented a shadow recently for a new asset I'm working on. I don't know how I could add that to the Corgi Engine though. The "ground" is mostly flat, so casting a shadow there would be pretty tricky.
     
    Jkc_dev likes this.
  49. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    NEW ASSET???? ohhh please tell me what.. sneakpeak????
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Devision4 > Haha :) I have a few projects right now that I'm working on aside the Corgi Engine and my own games. The one most likely to hit the asset store in a few months is a 2D infinite runner engine with a few original features in it. Can't really say more at this point :)