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

    beach3d

    Joined:
    Mar 16, 2016
    Posts:
    9
    Thank you SO much Renaud! I was going about it the wrong way, your system makes this very easy and self explanatory! Thanks again.
     
    reuno likes this.
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @beach3d > You're welcome :) In my opinion weapons are the most complex part of the engine, so if you found that easy you'll probably have no problem with the rest of it!
     
    beach3d likes this.
  3. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hi @reuno
    I have a doubt.
    I'm trying to make a continuous wallJump, using one wall on the left and another on the right, but when the playable character hits the second wall, he doesn't stick to it. To deal with that, I'm stopping the input after the jump and while in the air, I'm changing the direction of my input to make it work.
    This way works totally fine in a metroidvania(like the one I'm doing), but I'm also using the Corgi Engine to create a simple and funny platformer to Andriod/IOS, and I think that, not sticking to the wall would be a difficult input to young players( so, probably not everyone could do it simply).
    So, my doubt is:
    Is it possible to make the character stick to the wall after a walljump?
    I'll send a gif in minutes ^^
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Zehru > You can extend the WallClinging class to override the test where it checks for the input, so it's now just based on whether or not you're in the air/hitting a wall, and you should have what you're after.
     
    Zehru likes this.
  5. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    okay, thank you very much for your fast and good answer :D
     
    reuno likes this.
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Zehru > I think I'll add an option for that in an upcoming update, you're not the first to ask for something along these lines. Added to the list!

    By the way, good news everyone, I've just pushed v3.1.2 to the Asset Store. It's a minor release (i.e. it shouldn't break anything) that adds/fixes the following :
    • Adds Jump Time Windows to CharacterJump. It's an optional delay during which, after falling off a cliff/platform/whatever, a jump is still possible without requiring multiple jumps.
    • Adds an option to force a Character's spawn facing direction, so you can now set that from code or via the inspector.
    • Adds option to reset number of jumps after a stomp.
    • Adds font size and alignment settings to DialogueZones. You can now change these dynamically for the whole dialogue or for each dialogue line.
    • Adds customizable delay between a character's death and its respawn, which was previously hardcoded.
    • Adds a way to set the DebugOnScreen's console font size on demand.
    • The ladder used sfx now stops if you stop climbing the ladder halfway through.
    • Improves ceiling detection and generally collisions with things above the character
    • Fixes the ColliderCenterPosition property
    • Fixes a bug that would sometimes cause a character's sprite to remain stuck in its flicker color state on revive
    • Fixes an error that would pop when trying to access a healthbar with no healthbar in the scene (pretty uncommon, but still.)
    • Fixes AIShootOnSight's offset when flipped
    • Removes hardcoded dollar sign in the UICamera's score display.
    • Prevents footsteps sfx to be played when climbing a ladder.
    • Prevents the jetpack sfx to sometimes keep playing when dashing.
    The next big update is taking longer than I expected to finish, but I thought you'd like to have these few improvements first.
    As usual, Unity should now validate the update, which takes from a few days up to a month.
     
    Zehru, MudPuppet, Muppo and 1 other person like this.
  7. Nienipanini

    Nienipanini

    Joined:
    Dec 9, 2012
    Posts:
    8
    "Nienipanini > That's not something that is built-in right now. But you can have a look at the respawn classes for reference if you want to implement it yourself. Basically the idea is to simply disable your characters when they die, then enable them again and reposition them for them to respawn."

    I did but I cannot get it working unfortunately. Any chance this might get in to a updated version some day?
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
  9. SunnyLax

    SunnyLax

    Joined:
    Feb 9, 2017
    Posts:
    5
    Managed to fix it with a little increased gravity and slower speed! thanks

    i couldn't find an example how to do both-ways platforms, how can i enable a platform to do that?
     
  10. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @SunnyLax > I'm not sure what you mean by "both-ways platforms".
    The engine includes lots of examples of 1way platforms (meaning platforms you can jump on from underneath, or jump down from). The FeaturesPlatform demo level for example includes quite a lot of these (they're usually the blue ones in this level).
     
  11. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Thank you @reuno for adding it, and also for this very good update :D
     
    reuno likes this.
  12. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Ok, I found something weird.

    When your character wears a weapon and walk through other players with their own weapons, these overlap. I've reproduced the issue on "minimal 4 players" just to be sure it's not related to my prefabs. (2nd player rectagle colored to help showing it)

    As you can see, 2P weapon sprite is visible over the entire 1P body and weapon.



    When you have several enemies with weapons doing patrol it looks really odd.

    @reuno
    Any suggestion how to proceed in case it's not a bug?
     
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Muppo > It's a layer sorting order issue.
    You can fix it by setting your character and weapon to the same layer/sorting order value, and incrementing for each enemy.
    I'll try and automate that for a future release, thanks for reporting this!
     
  14. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
    Another really good starting point could be this free asset...for each scene there is simple intro (dialogs and movements)
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Muppo > Alright, I just spent quite some time on your issue, and I've got a solution for it.
    I'll include it in the next release. In the meantime, if you want to give it a try to make sure it works as you'd expect, drop me an email and I'll send you the details.
     
  16. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    New solution tested, works great. You have details on the email.

    Thank you for the fast help!
     
    reuno likes this.
  17. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Hi Reuno,

    all of a sudden the game I'm working on went from 2D narrative to riding motorbikes in a 2D side view. At least, partially, just as a way to move faster among the key places.

    I don't believe I'm going to need tricks or mad accelerations, but maybe mantaining some form of inertia for little jumps from the slopes, and some friction/gravity.

    Do you think is already there a simple, quick way to obtain this in Corgi2D, without needing to code anything exception made for controlling the acceleration and speed?

    I'd prefer to have some jumps when leaving the slopes, but if not possible I'll just make it slide on the contour, using the new adapt-to-floor-rotation feature. It's not a driving game afterall.

    But yeah, actual jumps would be definitely more fun! :D

    Do you have some tips to share on this?

    Thanks,
    Alessandro Salvati
     
  18. justmekino

    justmekino

    Joined:
    Oct 29, 2016
    Posts:
    13
    Hi reuno,

    Can you help me, I just wanted to know if there is an existing script wherein I will detect the raycast player's collision if I hit bottom, top, left or right of any box collider?

    I just wanted to trigger an animation that depends on the side of the box collider I hit.

    Thanks in advance.
     
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @justmekino > Yes, the CorgiController does that. It's got 5 public bool you can access to check that. Namely State.IsCollidingRight, State.IsCollidingLeft, State.IsCollidingBelow, State.IsCollidingAbove, and a generic State.HasCollisions that will be true if colliding on any of the 4 directions.

    @NeatWolf > I'm sorry but I can't think of a simple way to do that. Usually people want the opposite :D You could play with gravity but all you'd get is a floaty thing.

    Maybe a physics based engine would be more suited for that kind of thing. I'm working on a physics based alternative to the controller right now, but it won't be out for a while. I think it'll be useful in cases where you want a lot of interaction with rotating platforms, moving stuff around, and now bikes.

    I'll have a look today at the current controller to see if there's a way to add some out of slope inertia as an option, without breaking too much stuff. I'll let you know if I find a simple solution.

    One advice I'd give for motorbikes and the likes would be to use the (relatively new) CharacterSlopeOrientation component, but you've already figured it out.
     
    NeatWolf likes this.
  20. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Cool, I needed that as well, since I don't want the player to walk in place when there's a wall over there. These are kinda basic checks, I know, but since I believe Corgi is more oriented to "out of the box" functionalities, is there any chance we could have up to 4 flags (or maybe just one) to stop the character into setting the walking flag to true in the animation controller when there's no room to move(left/right collision, or depending on the orientation of the movement)?

    I know, but it's a feature that wasn't in the design document at first so I chose to use Corgi Engine for the project that is almost complete, I'd prefer not to have multiple engines working and toggling on the same character or override almost everything to make it work.
    Please let me know if you got any ideas about trying to adapt what is already present in the engine in the less painful way possible (I'm definitely not looking forward in implementing a full featured simulator like Happy Wheels), thank you :)
     
    justmekino likes this.
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @NeatWolf > If by flags you mean animation parameters, then yes definitely, that's a great idea. I'll add that to the next version. I think the best solution is to provide 4 boolean parameters, one for each direction. Seems simpler and more versatile than a single one. That way you'll be able to use them for more situations than just walking (you could have a special animation when jetpacking and colliding with the ceiling for example). And I'll definitely let you know if I find a simple solution for the "bike" :)
     
    NeatWolf likes this.
  22. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Yup, yes, I was talking about them. I know it's a tiny detail yet I believe it's a pretty common behaviour that could or could not be required (I'd say 50%-50%).
    Thanks for taking the time to looking into it, I really appreciate that!
    Cheers! :)
     
    reuno likes this.
  23. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hi @reuno
    Is there anything built in Corgi Engine,that I can use to remove a weapon from the character handle weapon script?
    If not, could you show me how to (give tips), or implement in another update?

    I imagined something similar to
    Code (CSharp):
    1. CurrentWeapon.SetOwner (_character);
    but instead of adding a weapon, it would remove it.

    PS: if you add a weapon and not destroy the past one, both will be activated and attached to the player.
     
  24. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Zehru well sure, you can use the CharacterHandleWeapon's ChangeWeapon(Weapon newWeapon) method.
    If you do ChangeWeapon(null) it should remove it.

    Edit : 1000 messages! What did I win?
     
    JeffSLG, Bagnol, Zehru and 2 others like this.
  25. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Thank you :) now I think it will work very well :D

    Hey everyone! let's take our abilities and create something nice to @reuno, showing our appreciation for the great asset and the great support :D
    I'm a composer, so I can compose a song and give it to you( I won't put any type of copyright on it, so you can use it as you prefer) ^_^
     
    Xain likes this.
  26. MudPuppet

    MudPuppet

    Joined:
    Aug 10, 2012
    Posts:
    162
    LOL!!! 1000 More Messages :) of which about 4% will be you once again stating that the engine is not physics based.
     
  27. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Zehru > I was just kidding I don't think I deserve anything :)
    @MudPuppet > Hopefully I'll be done with the physics alternative by then so I'll be able to sing a different tune.
     
  28. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    ooh kkkkkk I see ^^ but if you want, just ask. I can do it :)
     
    reuno likes this.
  29. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Well, maybe not physically based using the native Unity physics, but you really can't have full control on a character on a platformer if you can't at least set acceleration, speed, air control, slopes influencing speed, gravity and friction/inertia :p

    @reuno
    I'm still processing the motorbike "plugin" in the background while I'm working on other parts of the code.

    I was wondering that maybe if I could add just a single component handling acceleration on a generic direction and drag/inertia to apply them programmatically on the main player, it should suffice to handle things like jumping from slopes at full speed.
    Probably tweaking the Jetpack movement would be a good starting point.
     
  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @NeatWolf > You can already control gravity, slope speed, speed, etc.
    Inertia, I'm working on it :)

    And yes, I guess you could extend CharacterHorizontalMovement and add a more accurate acceleration control, that's where I'd put it :)
     
  31. Tijs79

    Tijs79

    Joined:
    Feb 5, 2017
    Posts:
    16
    Hi Reuno or other corgi user,

    I'm struggling with the bottom level bound interaction with the character.
    My character is like 4 times as big as the spacecat character. I've setup 2-3 times as much as raycasts (I tried all kind of ray sizes). In a test level I set up all bounds as kill.

    The left and right bound interact fine with the character and it only kills when I'm really close to it. For the bottom it's a different story. It triggers kill way to fast (my ground platform boxcollider is far above the bottom bound compared to the collider distance of the left and right bounds and if the character spawns it's killed immediately). If I make the character smaller (which I actually don't want) or move the ground platform a bit up (which I don't want either because then the camera shows the space under my ground platform) than I can avoid the immediate kill.

    I tried al lot of different raycast settings as well as character box colliding but can't get it working with my desired character size. I know for sure it's not the collider setting of the ground platform because when I make the character smaller it works without changing anything.
    Also I tried to spawn the character in the minimal level. Same behaviour, only when making the character smaller or moving the ground a bit up it doesn't get killed.

    If I put an Urchin in the level as a test than the vertical recognition is fine and the character only gets killed when it lands on it so it only seems to be a problem with the bottom level bound.

    Do you have any idea what can cause this?
     
    Last edited: Feb 16, 2017
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Tijs79 > The level bounds don't have anything to do with raycasts. They're related to the position of your character (basically its center, unless you've applied some offset). So maybe just move the bottom bound lower?
     
  33. Tijs79

    Tijs79

    Joined:
    Feb 5, 2017
    Posts:
    16
    @reuno,

    Yes thanks I'll do that and reposition the camera a bit higher so that no empty space under the ground plane becomes visible. The only offset is Center - 66 as I started with the minimal level to build mine.

    I tried some more things; its just so strange. I spawned the Rectangle in my level and that one doesn't have the problem even when I make it 4 times as large. It obviously has to be something in my character then but I just can't find out what it is. Anyways the raycasting with enemies and other colliders work fine so it's all functional.
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Tijs79 > I have to admit I don't have any idea what could cause that problem.
    If repositioning the level bounds doesn't solve the problem, don't hesitate to drop me an email with more details and maybe a screenshot and we'll figure it out :)
     
    Tijs79 likes this.
  35. Tijs79

    Tijs79

    Joined:
    Feb 5, 2017
    Posts:
    16
    Sended out my characters to Reuno for reproducing the issue and within half an hour I got a detailed explaination and a small code fix for my extreme offset.
    Support is amazing! Thanks man!
     
    reuno likes this.
  36. Xain

    Xain

    Joined:
    Aug 3, 2013
    Posts:
    68
    I was away for a while, now I'm back to work on Corgi Engine again.Updates looks great.Thank you for delay before use reuno.Can't wait to share my game with you guys!
     
    reuno likes this.
  37. justmekino

    justmekino

    Joined:
    Oct 29, 2016
    Posts:
    13
    Thanks @reuno, good to know then. So its just a boolean? Just returning a true or false callback am I right? Hmm.. Is it possible or is there any other script on corgi that determine the tag name that I'm colliding with the player's raycast? Sorry for this dumb question.
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @justmekino > Yes, these are booleans. It doesn't return the tag names as you can be colliding with lots of different things at the same time (2 walls parts on the left maybe, and maybe you're walking on 3 different platform parts at once). I could return an array of these but if you don't know exactly how and why you're getting them it's useless. I usually just cast one more ray to get exactly what I want in cases like these (that's how the wallclinging works for example).
     
  39. justmekino

    justmekino

    Joined:
    Oct 29, 2016
    Posts:
    13
    Yeah I see, I guess the array callback is better for my need. Any idea how to get the array list of colliders?

    About the wall clinging part, I created as well a new ability that is based on the wall clinging class to achieve what I need because its the nearest solution but when the player move (x or y) the raycast of the wall clinging and my new ability is gone. I dunno why. :( In my part I need a raycast that is always there just like the raycast on the player's collider, so I ask you about this matter because I'm taking days finding ways how to achieve this.. :(

    Your help or ideas will matter to me. Thanks!
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @justmekino > you can get the array from the CorgiController, it's already stored (not exposed though, as I said I don't think it should be).
    And I don't know why your own code doesn't work, not with that little info :)
     
    AWP_22 likes this.
  41. AWP_22

    AWP_22

    Joined:
    Feb 6, 2017
    Posts:
    5
    hi i have question, on the example scene when the player reach the finish and go to next scene the Points set back to 0000, how to save the point so when its move to another scene the point stay at the last point we got, sorry for my bad english
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @AWP_22 > That's very strange, as by default points are saved between levels. If you go to the Mesa1 demo scene for example, then finish the level and move on to Mesa2 (the one on the top right corner of the level map), points should be saved. That's what the GameManager does. I'd need more details to understand how you lose them. Do you maybe exit the game?
     
  43. AWP_22

    AWP_22

    Joined:
    Feb 6, 2017
    Posts:
    5
    reuno > sorry my bad, you're right point save i didn't notice that because when i i finish the level and move to another level at the beginning of the second level point 0000 but after i got point on that level point continue, but now i have another question as you mentioned when we close the game and open it again everything start from the beginning, do you have any suggestion how to save the game so when player exit and open it they don't lose the level they have done before
     
  44. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @AWP_22 > By default the engine doesn't save anything apart from the achievements progress as usually what you save is very specific to each game, as is the way you decide to load what's been saved. So it's up to you to decide and implement that, but you've got everything you need in the engine. You can check the achievements for an example of how to call the save/load class.
     
    Tijs79 likes this.
  45. AWP_22

    AWP_22

    Joined:
    Feb 6, 2017
    Posts:
    5
    reuno > ok i"ll take a look at that's thank's for help me you're nice guy
     
    reuno likes this.
  46. Tijs79

    Tijs79

    Joined:
    Feb 5, 2017
    Posts:
    16
    That's perfect! I struggled watching tutorials how to implement save/loading in the engine and it's already there :) .

    In the meantime I managed to have a recall system by using playerprefs. It works but it lacks for one thing: dictionairies.
    But again serialization does not allow dictionairies by default as well.

    I made an override on the coin script in which I store the collected coins in an dictionairy made up of ID's and Booleans. This way when you replay the level the coins are not appearing for the second time so keeping the score more pure.
    Unfortunately upon restart of the game on your device this dictionairy is empty again so all collectables are there again.

    I also use 5 main collectables in the game. Since there are only 5 of them I use playerprefs for now to store them and recall their status upon close and open of the game.

    When I succeeded in storing a dictionairy in either an array to be used in playerprefsX or by using the dictionairy and store it in a file by serialization, I think most of my game requirements are covered in a proper safe/load/recall mechanism.

    @AWP_22: if your recall requirements are simple like storing status of a couple of items, playerprefs is really easy. Lot's of examples on the forum here.
     
    reuno likes this.
  47. DeltaSupreme

    DeltaSupreme

    Joined:
    Feb 22, 2017
    Posts:
    7
    Hi, just got started with Corgi Engine, so please forgive the uneducated question! But...

    I'm starting development on a sprite-based 2D platformer; very minimal and sprite heavy, the goal is to mimic how an NES game works. In games such as that, the melee weapon is part of the player sprite, and the animation for the player and the weapon when attacking is a single, combined sprite, where a part of the sprite (the weapon) possesses a hurtbox that will damage enemies if it touches them.

    So, my question is, how do melee weapons, such as a sword, work in Corgi Engine from an animation stand-point (by default, before extending the classes)? Does the character and the weapon have two separate animations? Is the sword not animated and the character swings it, and the engine detects things that collide with the weapon? Is it one combined animation? My desired process is to have a single sprite that represents the character mid-attack animation, and attach a hurtbox to the sword (my character would probably only have about ~3 frames of animation for an attack).

    Thanks! I've started playing around with it and reading the documentation; the engine looks really slick.
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @DeltaSupreme > for melee weapons, just like projectile weapons (and any other kind of weapons), you have the choice to have separate objects or just trigger an animation. The engine includes examples of both. The sword attack on the sprite based corgi character for example is just an animation. The Rectangle demo character has its weapons separate from its "body". You can learn more about all that in the Weapons section of the documentation. There's also an example of how to setup a melee weapon (it's the same process for all weapons).
    Edit : Your "desired process" is exactly how melee weapons work right now :)
     
  49. Tijs79

    Tijs79

    Joined:
    Feb 5, 2017
    Posts:
    16
    @AWP_22 and others interested in data persistance / saving functionality in their game. There is a great tutorial on the internet about saving dictionaries by serialization for Unity. With help of the maker of the tutorials I implemented my data persistance requirements into my game.

    It's found here (whole series about serialization):
     
  50. DeltaSupreme

    DeltaSupreme

    Joined:
    Feb 22, 2017
    Posts:
    7
    @reuno > Awesome! Thanks so much! Yeah, it looks like it does what I want; I was able to take the SpaceCorgi prefab, load it with the CorgiSword, and it would play the sprite animation of the corgi swinging his sword, and then I could edit the hurtbox that appears when you attack. Thank you very much for pointing me in the direction of the SpaceCorgi prefab, I was working in MinimalLevel and was thus mostly looking at the Rectangle player character.

    I did have a question though, about some strange behavior. Using SpaceCorgi with CorgiSword as they come from a default import of the latest Corgi engine (except, I set the sword to Semi-Auto), I got strange behavior with the animations when messing with Delay Before Use and Delay Between Uses. I set either one of them to 0.5 seconds, and the other to 0 seconds (I tried it 0/0.5 and 0.5/0); if I mashed the attack button as fast as I could (but not holding it down, just pressing it repeatedly very fast), the BoxCollider2D hurtbox would always spawn as it should, but frequently, the melee attack animation would not play. Obviously, with a delay, player inputs are going to be lost, but throwing out the hitbox and not playing the associated attack animation seems unintended. Do you have any ideas or thoughts on this? Or am I just doing something wrong?