Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[RELEASED] Rex Engine: A Unity 2D Platformer Engine

Discussion in 'Assets and Asset Store' started by BeeZee, Jun 20, 2017.

  1. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Sure thing. The Booster's Adventure demo has an example of this if you check out the Demo_8 scene. Here's a screenshot of the settings to make it work:

     
  2. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Thanks for writing this up! I'll have a video showing the integration process going up this week.
     
    Bagnol likes this.
  3. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Thanks for the suggestion! Something like this is definitely on my radar; I want to make the update process as easy as possible, so ideas like this are very useful.
     
  4. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Lots of new tutorials incoming! I'll start with this video on melee attacks, since I had a request for it earlier:



    Coming shortly: Pro Camera 2D integration and a video on using version 1.18's new settings for handling lives, death, and Game Overs.

    Oh, and version 1.18 is live!
     
    Lars-Steenhoff likes this.
  5. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    Thanks man, that's strange, from the version 117 I tried to type in "spawn" in the project search bar and in the inspector add component, nothings seems to appear, but after updating to 118 it showed up. Now it's working as I expected.

    Got some questions:

    1. About the player's melee contact damage set to 1. Why is that when I use the projectile to hit the enemy with 3hp energy it only takes away 1 energy, but when I use the melee attack it takes away 2hp energy from the enemy? Is there a particular setting for melee's contact damage?

    2. Another one, how were able to make the enemy shoot to the air when it dies?

    bounceEnemy.png
     
    Last edited: Mar 16, 2018
  6. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Melee contact damage is set on the melee attack's GameObject, and Projectile contact damage is set on the projectile itself. I'll do a video on projectile tutorials next week, since there's a lot of stuff to cover, but in the meantime:



    The above image shows where to set a melee attack's damage. (It sounds like you already know this, but just to be sure.)



    The above image shows where to set a Projectile's contact damage. Projectiles are basically the same, in that they also have a ContactDamage component where you set how much damage they do when they touch something, but they're a little more involved in that a projectile attack has two pieces: the Attack component itself, which is responsible for spawning the projectile, and the Projectile, which is the projectile that actually fires and hits the enemy. In the image above, you'll see that the player has a GameObject on them called "PeaShooter_Charge." That's the Attack. In its children, it has a GameObject called "RexPool_Regular," which is a spawn pool full of PelletShot clones. The PelletShot is the Projectile, which has the ContactDamage component on it, so that's the prefab you want to set the damage on.

    The enemies in the demo use a script I made called "DemoEnemy.cs." DemoEnemy has a couple features that I only intended to use for the Booster's Adventure demo, including the way enemies fly when they get killed. If you want to browse that, it shows you exactly how I did it -- it's mostly just a couple calls to Rex's physics. Basically, it checks to see if the enemy is dead, and if so, it calls this:

    Code (csharp):
    1.  
    2. slots.physicsObject.SetVelocityX(deathVelocity);
    3. slots.physicsObject.ApplyForce(new Vector2(0.0f, 30.0f));
    4.  
    That calls the RexPhysics component attached to the enemy, and sets its X velocity permanently to shoot to the side, and then gives it a one-time upward force, which is what makes it shoot up in the air and then fall back down.

    Hope that helps! Let me know if I can clarify any of that more.
     
  7. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    Ok, I got the idea about the pellet prefab contact damage. So the flying enemy thing need some script editing, I thought there's a setting on it in the inspector panel.

    The one that really puzzles me right now is the melee contact damage, the images below shows the settings for the contact damage of the player and energy of the enemy. I suppose the enemy will get 3 melee attack from the player before it gets destroyed, but what happens is on the 2nd melee attack the enemy gets destroyed immediately. In fact when you look at the quick start tutorial video is the exact thing I'm getting with the setting I did starting at time 10:18
    You'll notice after the 2nd melee attack the enemy gets destroyed.

    contacDamageEnemy.png contacDamagePlayer.png
     
    Last edited: Mar 16, 2018
  8. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Hm... so I just did some testing, where I ran the Booster's Adventure demo, and changed the first enemy you run into to have 5 HP. I tested it a bunch of ways, and it consistently takes 5 hits to kill him.

    One thing that's possible is: an attack's hitbox will stick around for as long as its animation is up. (Or, you can disable its BoxCollider2D early via the Animator, if you want it to make it go away sooner.) This means that, in theory, the same attack could damage an enemy multiple times in one hit -- which is intentional, because that's a viable option for creating attacks. To counteract this, there's a property on the Enemy component called Invincibility > Damaged Invincibility Duration, which makes the enemy invincible for a set period of time after taking damage (the Player has this as well.) It's possible that the invincibility duration on your enemy is set to a lower span of time than the attack takes, so the the same attack could hit the enemy multiple times in one swipe.
     
    FunkyBuddha likes this.
  9. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    Finally it worked, the default damage invincibility of the newly created enemy is 0.15, I set it to 0.5 Now the enemy can take in 3 melee hits from the player before being destroyed. Really appreciate your quick reply bro, thank so much.:)

    View attachment 270709
     
    Last edited: Mar 16, 2018
  10. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Coming shortly:

     
  11. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    I'm testing out Rex with Unity 2017.3.1 and it shows these messages in the console when I import Rex for the first time, everything seems to be OK when I start to play the demo scenes from title to ending, it does goes away when I close and restart Unity. But when I try importing other assets such as the following:

    https://www.assetstore.unity3d.com/en/?stay#!/content/109031
    https://www.assetstore.unity3d.com/en/?stay#!/content/38436
    https://www.assetstore.unity3d.com/en/?stay#!/content/109565

    RexNewError.png

    The messages shows up again and when I close and open Unity everything seems to be normal, no messages on the console. I'm planning of using these two assets together with Rex.

    FIRE & FOG MEGABundle 01 (634+ VFX)
    https://www.assetstore.unity3d.com/en/?stay#!/content/20308

    Control Freak 2 - Touch Input Made Easy!
    https://www.assetstore.unity3d.com/en/?stay#!/content/11562

    My main concern is the compatibility issues with Rex, I would have stayed with Unity 2017.3.0 but the FIRE & FOG MEGABundle 01 asset is optimized for 2017.3.1

    Now would you recommend ignoring those messages in the console and just use Rex in Unity 2017.3.1 together with the assets mentioned?
    Thanks!

    By the way good to know there's new feature added. I'm really interested to know more about combo attack hopefully you can do this on your next tutorial.
     
  12. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470
    Ah great the drop down attack!

    love it!

    can it be used to also break blocks?
     
  13. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    I haven't tested with Control Freak 2, but you should be fine. I think Unity tends to be pretty overzealous with their yellow warnings; everything in those screenshots is stuff I'd like to eventually clean up just because it makes the console kind of ugly, but it won't hurt anything, either -- and several of the things it lists as warnings are good things, even.
     
  14. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Sure can!
     
  15. jdameron

    jdameron

    Joined:
    Oct 2, 2013
    Posts:
    5
    Control freak is one of my favorite assets. I'm using it with 2017.3.1 and all works great.
    ezgif.com-optimize (1).gif

    Looking forward to maybe trying a swipe down while in air for the new ground pound
     
    FunkyBuddha likes this.
  16. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    Is it possible to make a particle an enemy that can hurt the player? I made some test imported a particle set it to enemy tag, added component scripts enemy and contact damage (will damage player tsek). Doesn't seem to work. or I'm doing it all wrong?

    ParticleEnemy.png
     
  17. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    The ingredients should be: BoxCollider2D, tag set to "Enemy." ContactDamage component with willDamagePlayer = true, and Amount is 1 or higher. I just did some tests and that should be all you need. It might be that your particles aren't colliding with the player, or maybe the particle colliders don't register the same way a BoxCollider2D would.
     
  18. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470
    And the update is live!

    Great work

    Just one thing, I love the many updates, it's just that I always have to setup again incontrol on the singletons prefab.
    I wish there is some way to keep my settings when updating
     
  19. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470
    Last edited: Mar 23, 2018
  20. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470


    How can I make the blocks break?

    Thanks
     
  21. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    How to load the current check point scene from a another scene with out dying.

    It's kinda bit confusing, so I'll try to explain it in detail. All the scene that contain a checkpoint will have a door pointing to one particular scene or any other scene, let's say it's a Scene Shop, and that scene shop will also have a door that will load back to the current checkpoint scene.

    One more thing, I noticed with the new update with the ground pound attack in demo 2, the breakable tile gets easily destroyed when colliding with it without using a weapon. I tried disabling the ground pound attack script component from the player control prefab, but still the problem persist.

     
    Last edited: Mar 26, 2018
  22. Marz1887

    Marz1887

    Joined:
    Mar 26, 2018
    Posts:
    2
    Hi BeeZee.

    I recently purchased your engine after looking for the right base for my game. I love all the features and feel.

    I have a few questions that I was wondering would be capable with the engine for my dream game.

    1. Can I make a combo system when it comes to melee attacks?
    2. Could the engine be used as a foundation for a battle feature? A la Smash Bros/Street Fighter
    3. Could a in game level editor be implemented?

    Thanks!
     
  23. clammy2017

    clammy2017

    Joined:
    Feb 21, 2018
    Posts:
    27
    Hi all

    Looking at implementing either "rewired" or "incontrol". Does anyone have any preference of either?

    Is one better than the other in some way, etc?

    They seem to be fairly similar to me, I just was wondering if anyone has any "gotchas" with either of them?

    Id rather go for the cheaper option if possible, but only if its going to work properly. Just want to have access to xbox controller, maybe mouse in future. And ability to allow player to remap buttons/etc in frontend.. Oh, and vibrations.
     
    Last edited: Mar 27, 2018
  24. clammy2017

    clammy2017

    Joined:
    Feb 21, 2018
    Posts:
    27
    Also, what would be the best way to extend the input class so I could (for example) check for the right stick?

    I've tried just extending "Rexinput" class, which detects presses/etc. But my character has stopped moving about as the controller class is directly looking for "RexInput"

    Code (csharp):
    1. [/COLOR][/FONT][/LEFT]
    2.     public class MyInput : RexInput
    3.     {
    4.         void Update()
    5.         {
    6.             SetInputs();
    7.         }
    8.         protected override void SetInputs()
    9.         {
    10.             // just a copy and paste of rexinput::setInputs at the moment
    11.         }
    12.     }
    13. [LEFT][FONT=Helvetica][COLOR=rgb(51, 51, 51)]
     
  25. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470
    incontrol has support for icade, rewired does not.
     
  26. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Rewired has a free trial version available so you can do an evaluation and not spend any money. Then at least you know what you are getting. You can get information on the free trial here.

    http://guavaman.com/projects/rewired/trial.html

    Rewired has the greatest number of controllers supported out of the box. Show me any other product that supports as many different controllers as Rewired does. Check out the listing here:
    http://guavaman.com/projects/rewired/docs/SupportedControllers.html

    (1) Rewired has 500+ ratings and 170+ reviews. You can read through the reviews to get a good indication of what other developers are thinking.
    (2) Support multiple platforms (Win/Mac/Linux)? Consoles? There is a full listing on the Rewired website.
    http://guavaman.com/projects/rewired/
    (3) Read through the Rewired documentation.
    (4) Look at the Rewired support thread on the unity forums. Rewired is definitely one of the best supported unity assets in the store. That is really the most important part is after the sale support.
    (5) You want to make sure that your end users have the greatest amount of support on the variety of controllers. That is simply my favorite feature of Rewired.
    (6) Run-Time GUI remapping of controllers by end users --- there is control mapper.
    https://guavaman.com/projects/rewired/docs/ControlMapper.html
    (7) Rewired supports gamepad vibrations. Need to look at the Rewired FAQ under force feedback for specifics.

    You can do the same evaluation for InControl too.

    But test out the free trial version of Rewired and see how it works for you.
     
    Last edited: Apr 3, 2018
  27. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya everyone, sorry for the delays -- I just got home from a trip. I'll be making my way through your questions today and getting them answered.
     
  28. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    You'll want to give the blocks an Enemy script. The very bottom option in the Enemy component in the Inspector is "Can Ground Pound On." You can scope out the blocks in the lower-left of Demo_2 for a working example.
     
  29. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    This is one of the big things I'm hoping to fix soon. I'm exploring solutions, so I'll keep everyone posted.

    In the meantime, a workaround is to copy the Singletons prefab before updating, and then paste it back into the project after the update. That should let you save everything that was set up.
     
  30. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    This might take a small amount of code, but it should be pretty easy. Here are the main ingredients:

    • LivesManager has a variable called "lastSavedScene." This holds the name of the scene where the player last hit a checkpoint. You can reference it from anywhere with LivesManager.Instance.lastSavedScene, and that will give you the name of that scene.
    • SceneLoaders and Doors have their public value "Level To Load" which you can see in the Inspector, which sets what level is loaded when the player touches the SceneLoader or enters the Door. You can set that in code with sceneLoader.levelToLoad.

    So you could do something like this: assume your Shop scene has a SceneLoader, which is used to exit the room. You could have a script that gets called one time when you enter the Shop room, and it would do something like: sceneLoader.levelToLoad = LivesManager.Instance.lastSavedScene. That would make it so, when the player touches the SceneLoader, it loads them back into the room they last hit a checkpoint in.

    Hope that helps!

    EDIT: Thanks for pointing out the thing with ground pounding blocks. I tested it and it's a bug. I'm looking into a fix.
     
  31. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470
    great
    yes I do that, but I never feel like i got the complete update, because maybe you updated something on the singleton that i need later. So just to be sure i always do it by hand. looking forward what you come up with. ".asset" might be one of the solutions.
     
  32. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470
    Just one thing about ladders, When rex jumps of them he always falls down and does not jump up from the ladder, only at the top of the ladder he can jump upwards,

    is there a way i can make him jump off / up in de middle of a ladder?
     
  33. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya Marz, thanks a ton for getting a copy of Rex! I'm glad you like it.

    1. Yep, there's a combo system for melee combos already. I'm planning to do a video on it soon.
    2. This is a complicated question. Rex has a lot of features that would help with a fighting game -- energy bars, player control and physics, knockback, jumping, melee attacks, etc. -- but at it's core, it's made for 2D platformers, so there's a lot of additional fighting game stuff it doesn't have. Additional features will definitely make their way into Rex over time, though, and Rex is built to be easily extendable, so you can add things yourself in the meantime. I'm a big fan of Smash and Street Fighter alike (my Ibuki is getting pretty good!).
    3. This depends pretty heavily on what you're looking for in a level editor. Most of Rex's current level-editing stuff is just done with Unity's base tools, but I've also been adding some Rex-specific tools like Rex Palette, which lets you insert new enemies/gimmicks/etc. into a scene by hitting a button on the tools palette. It wouldn't be too big of a leap from there to insert them into an actual game.

    Hope that helps! I can elaborate on any of these if you'd like, so feel free to let me know.
     
  34. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Yep. In Ladder State, on the player's Controller, there's an Inspector option called "On Jump." By default, this is set to "Drop," but if you click the dropdown menu, the second option is called "Jump" and will let the player jump from the ladder.
     
    Lars-Steenhoff likes this.
  35. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    You've got the right idea. Extending RexInput and overriding SetInputs is the right way to go. I just tested some stuff, and the big gotcha there that you may be missing is that the new MyInput component needs to be slotted in the Inspector in two separate places:

    1. On the player's RexActor component (this is called Booster.cs for the demo character.) It goes under Slots > Input.
    2. On the player's RexController component. On the demo character, this is on a child of the main GameObject, under Player > Controllers > Controller. Then, under RexController in the Inspector, you can slot MyInput under Slots > Input.

    That should give the player the references it needs to use MyInput.
     
  36. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    Thanks man, I already figure it out while you're away, somewhat similar to what you instructed, I did some testing and got it working. I was wondering if there's an easy way to do it in the inspector.

    There's another thing that I came across, the extra life prefab, I created a duplicate of it and the new prefab I set the amount to 3 to add 3 lives, but after collecting it on play mode, only one life is added. extraLifeFix.png
     
  37. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    I forgot to include this, there seems to be a bug in the Rex Setting Project Settings, the Game over and Post Game over scene feature. I created 2 demo scenes added it to the build scenes and tried to test it by putting the scene names on the corresponding scenes input space, then save button for the project setting , but on play mode, it keeps on resetting back to the default scenes.

     
  38. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Oh, wow, you're correct on both of those! Thanks for letting me know. They're fixed now and I'll submit the fixes with this week's update.
     
    hodgepodge2022 likes this.
  39. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    A new update is nearing completion, along with a brand-new, popular ability from an SNES classic. Anyone want to guess what it is?
     
    Bagnol likes this.
  40. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    Is it something a pair of green characters are known for? Particularly another 2D dinosaur?
     
    BeeZee likes this.
  41. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
  42. jaelove

    jaelove

    Joined:
    Jul 5, 2012
    Posts:
    302
    Is it possible to make a beat em up in this engine?
     
  43. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Rex is geared more towards 2D platformers, but it definitely does have a lot of things that would help with a beat-em-up, including melee combos, energy bars, hitstun, and its own 2D physics engine that can do everything a brawler would need. You'd probably need to build on top of it a little, but Rex would get you a lot of the way there.
     
  44. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,470
    Yoshi my favorite!

    thanks
     
  45. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @@BeeZee

    Any news of the update, I need the fix for the breakable tiles for the levels that I've been working on right now.
     
  46. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    I submitted it to Unity last week; I was hoping it'd be approved Friday, but my new best guess is tomorrow morning. If you'd like it tonight, feel free to send me a PM on here and I'll send you a copy.
     
  47. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    Awesome, already sent a message, thanks so much.
     
  48. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    When switching platform to android this warning pops up in the console. Is this a bug or it's normal?

    Tiled GPU perf. warning: RenderTexture color surface (1024x600) was not cleared/discarded. See TiledGPUPerformanceWarning.ColorSurface label in Profiler for info
     
  49. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    It should be fine -- it's a generic Unity warning.
     
  50. Rick-Kercz

    Rick-Kercz

    Joined:
    May 17, 2017
    Posts:
    4
    Here are some screenshots of the project I am working on.







    These are from the demo level I am working on.
    It is super rough, but I would really appreciate any and all feedback.
     
    CHEMAX3X, jdameron, Bagnol and 2 others like this.