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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    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
    Version 1.15 is now live!

    Here's a tutorial on using the newly-reworked Scene Boundaries. (Also, be sure to have the Rex Level Editor window open for this to work! It's under Window > Rex Engine > Rex Level Editor.)

     
  2. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    Nice update, just for people who use cinemachine here you can do the same with a polycolider, just not the bottomless pit.

     
  3. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    Hi,

    I've been away from REX for a bit and now am back. I am trying to set my Players state to flying but I can't find the option anymore?

    Cheers
     
  4. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya, good to have you back!

    The way I set up the Flying in the Booster's Adventure demo was:

    • Booster has 3 total RexControllers: one for when he's in his regular state, one for when he's swimming, and one for when he's flying
    • In the Inspector, each one of these RexControllers has an "isEnabled" checkbox, so you can just check the one you want to enable and un-check the others
    • For the Flying controller, a couple things were set:
    • In the MovingState component on the Flying controller, "Can Move Vertically" is checked. This allows him to move up and down with the d-pad (or W and S on the keyboard)
    • For his RexPhysics component, "Gravity > Uses Gravity" is turned off
    • For his JumpState component, jumping is disabled

    Here's a screenshot showing his settings:



    That should make your character fly. Hope that helps! Let me know if I can clarify anything else there.
     
  5. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    can you add a state pushing?

    where rex when he is walking against an obstacle the animation state changes to push, and he tries to push the wall, or in case of a block push a block, like in sonic.


    and can you add a save spot, not just a check point but a save point like in castlevania symphony of the night.

    Thanks
     
    Last edited: Feb 22, 2018
  6. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    "Heya, good to have you back!

    The way I set up the Flying in the Booster's Adventure demo was:"

    Thanks Beezee,

    I thought that was where it was, but for some reason in my prefab (a copy of Player) the Flyingcontroller was not there.

    Another question, what would be the correct way to disassociate the need for the terrain interaction for the walking animations to play? Essentially I will be turning off gravity and locking Y movement, so my player will move on the x axis in space. When you do this the walking animation is not triggered.
     
  7. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Hm... interestingly, the walking animation does play in the air for me. Here's a shot of me walking back and forth in midair:



    I left some of the settings in this screenshot. Do any of those help? And, hopefully not a silly question, but is your Animation slotted for walking?

    It's funny, because I debated pretty heavily whether or not to make the walking animation play in the air by default -- I wasn't sure if people would think that was useful or not -- but it's definitely coded to make that happen.

    If the settings I have in this screenshot don't work, I can go through my Player prefab and screenshot the rest for you, or I can send you my working version to try out.
     
  8. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    These are definitely on my list. I've been doing some experiments with them, and they're both fairly complex issues, so they make take a while, but I 100% plan to do them.
     
    Rick-Kercz and Lars-Steenhoff like this.
  9. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    "Hm... interestingly, the walking animation does play in the air for me. Here's a shot of me walking back and forth in midair:"

    Ok so after comparing yours and mine I found that the walking animations will play only when 'Can move vertically' is enabled in the move controller. So by switching this on and using the 'Freeze movement on Y" in the physics script it works.

    A bit of context. I am experimenting with a spaceship that can only move on the x axis, however I wanted access to all the standard move, turn and rest animations.

    Thanks
     
    BeeZee likes this.
  10. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Awesome! I'm glad it worked out.
     
  11. jdameron

    jdameron

    Joined:
    Oct 2, 2013
    Posts:
    5
    Hey beezee, got this toolkit awhile ago but never got to dive too deep until lately, and i got to say its a joy to work with.. simple and solid feeling.

    I was experimenting with the projectile aiming and ran into som issues.. it seems when standing still the bullets freeze where they spawn. But my experiment was trying to control the aim with another joystick (mobile, using control freak)

    The first gif is an example of the behavior im after using platformer pro/control freak... only the vertical axis of 2nd joystick controls the aiming, and joystick pressed is fire. ezgif.com-optimize (6).gif

    Trying to recreate in rex you can see the freezing bullet i mentioned... and im cheating by not using a seperate axis... its just the main vertical axis..
    ezgif.com-optimize (7).gif
    so ideally id like to aim with a seperate vertical axis, and actually aim...

    Im kinda hell bent on using rex for my project bc it just feels better to play and to work on.

    Another weird thing i noticed is the player stops moving after a bit if the main camera is in perspective... not a big deal, but was something i wanted to play with as well.

    And lastly, i have a pretty solid grasp on the ai, but could benefit greatly from a more in depth guide, im sure there are bits im overlooking. No rush of course..

    I hope that is a clear explanation of what im trying to achieve ... if the gifs dont work ill put a tiny vid up later..

    Thanks for everything!
    Jon
     
    BeeZee likes this.
  12. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya Jon, thanks so much for the kind words! And, I'm really glad you're liking Rex so far. I'm pumped to see what you build with it!



    Here's a screenshot of what I suspect is causing your projectiles to hang. You need to set Movement Speed's Y value in addition to its X value, or else they'll freeze in place when fired upwards (since they otherwise have an X speed, but no Y speed, and being fired upwards causes their X speed to be ignored.) Are you on an older version of Rex? I'm pretty sure I changed this behavior in the past month or so, because I was feeling like it was kind of unintuitive. (If I'm wrong and it hasn't been fixed, then consider that a sneak peak at something coming in the near future!)

    For the physics question:



    The RexPhysics component has an option called DisablePhysicsWhenOffCamera. This helps with performance in larger scenes, and it emulates that old-school effect where enemies don't activate until they're almost on camera. It looks like the functionality to detect when something is on-camera doesn't work in Perspective at the moment, though! I actually haven't done much testing in Perspective mode, but thanks for pointing this out -- I'll look into it in the future and see if I can get it working properly. In the meantime, you should be able to fix your issue just by un-checking that checkbox.

    I definitely plan to do some AI guides soon, as well as lots of new AI features to play with.
     
  13. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    Hi BeeZee,

    I am testing the enemy AI and I am having trouble with their targeting. I am asking them to move towards the transform of the object "Command Post" however it seems that they ignore this and will not stop targeting the player. Can you see what I am doing wrong?

    My goal is to define a tag for certain buildings (objects) and adjust the AI so that they move towards the closest object to them and attack it.

    Cheers,

    Michael
     

    Attached Files:

    BeeZee likes this.
  14. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya, I just tested this and I can confirm that you're right -- it looks like there's a bug! I'm looking into a fix now and I'll submit it with the next update. Thanks for pointing it out!
     
    calminthenight likes this.
  15. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Version 1.16 has been submitted! It's got lots of new goodies which I'll go over in the next couple days. (And it includes a fix for the above bug where enemies wouldn't properly move towards non-Player objects!)
     
  16. PadFou

    PadFou

    Joined:
    Nov 24, 2015
    Posts:
    1
    Hi BeeZee,

    I tried your engine and you really did an awesome work. Congratulations for that.
    I used to work on a custom C++ engine based on Cocos2dx. Some years ago, when we started to develop our game engine, Unity was not really a good option for 2D games... But Unity has changed significantly since, and 2D engine like yours will probably allow us to switch to Unity without starting from scratch.

    I wanted to suggest you implementing pushable objects but it seems you are already working on it :)
    An awesome (but complexe) feature would be customisable trajectories. Something like in Mario Maker if you tried it, with lines and quarter circles that we can put together to create a complexe path.
    Finally two questions : Is there any simple way to pause/resume the physique and/or the animation of a specific gameobject ? And do you plan to implement local multiplayer ?

    Thanks and keep it up !

    PS : Sorry for my bad English but I have an excuse: I'm french :p
     
    Last edited: Feb 27, 2018
    Lars-Steenhoff and BeeZee like this.
  17. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    local multiplayer is awesome, I did not test it but is that not already in there?
     
  18. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya PadFou,

    Awesome, thanks a ton!

    I remember those days when Unity wasn't very good for 2D. I did a project back in the day where we had to simulate 2D in 3D space by constraining objects to the Z axis every frame. Every once in a blue moon, an object would mistakenly slip out of its proper Z axis and fall behind the terrain. I'm really glad things are in a better place now!

    The custom trajectories thing sounds like a really cool idea. I definitely want to do something like this involving the paths moving platforms can take, and I'd love to extend it to work with enemies and such, as well. I'm still researching it, so I don't have any concrete plans to share yet, but it's on my radar.

    For your questions:

    1. Yep, you can temporarily freeze objects by calling the StopTime() method on a RexActor. This will freeze their physics, their animations, and their RexController, plus any active RexState abilities. You can resume time as normal by calling StartTime() on them.

    2. Yep, local multiplayer is in already! You can set it up under the Rex Settings panel, under the "Player" field.
     
    PadFou likes this.
  19. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    1.16 is out today! In part of my attempt to make Rex easier and more straightforward to use, its major components now have tooltips. I've also done a bunch of organization for how Rex Engine objects display in the Hierarchy. My goal is to keep all of the Rex Engine stuff in one place, so it's both easily accessible if you're looking for it, but also out of your way if you just want to edit your level.

    Also, the official integration with Pro Camera 2D is now underway!
     
  20. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    Just wondering if anyone has used FMOD within a REXengine project and if there were any issues relating to REX?
     
  21. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    I haven't tried it personally, but I don't think there should be any issues. Nothing in Rex uses sound in any ways beyond what's normally available in Unity, so there shouldn't be any conflicts or anything.
     
    calminthenight likes this.
  22. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    Can you tell me how I can set up local multiplayer for two joysticks?
     
  23. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    Good to hear.

    On another front, is there an easy way to set the camera to scroll automatically, as in for an auto sidescroller? I thought I would just use an enemy prefab, set its motion on the x and then have the camera track it however the camera will not track anything other than the player. When I drag the enemy prefab into the 'focus object' on the main camera it sticks in but it won't track, and when I return to the camera prefab after testing the focus object is reset to none. Anything I am missing?

    Cheers
     
  24. kitsune9000

    kitsune9000

    Joined:
    Aug 15, 2015
    Posts:
    42
    Hi, I haven't used the latest, updated components of Rex Engine since I am almost done making a game with an older version. I can't believe how much has been added. In the future, I thought it might be interesting to have some more flexibility to make more complex AI enemy behaviors directly out of the box. And the tutorials that you're doing have been so helpful. I think that the more of the videos you are able to do, the more people will be able to pick up the tool and use it to meet their needs. So please keep the videos coming when you have the time.
    Thanks!
     
  25. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    I know the engine is in its public infancy, but perhaps a forum would be a good idea? That way users could help answer questions and share information
     
    jdameron likes this.
  26. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Local multiplayer can be set up under the Rex Settings tab:



    As far as joysticks go, the key distinction between the controls for each player is the prefix; Player 1 has the "Player0" prefix, and Player 2 has the "Player 1" prefix:



    Are you looking for instructions on how to set this up with a specific plugin, like Rewired or InControl? Lemme know if so and I can give you specific instructions for either one of those.
     
  27. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    I'll check on this one a bit later tonight. I'm in the middle of the ProCamera2D integration at the moment, so all of my camera settings are temporarily wonky anyway. As soon as I can revert my camera settings to normal, I'll test this out and get you a solution.

    On a sidenote, auto-scrolling levels are a thing I plan to implement as a full feature at some point soon, since they're such a big part of old platformers.

    (Sidenote sidenote: has anyone here played Ecco the Dolphin for Genesis? The penultimate level in that game is a sicescrolling level where you're in a maze, and the direction of the scrolling changes ever few seconds, and it kills you if you get crushed up against the edge of the screen. To this day, it's the most horrifying thing I've ever played in a video game. And I say that as someone who really likes legit horror games.)
     
    andreiagmu and Bagnol like this.
  28. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    You got it! AI is on the list. I have some big plans for it, and there are a few potential ideas I'm experimenting with. One of the first things I want to do is break out different AI behaviors into their own components, so you could add new ones, mix-and-match them, and enable/disable them independently, similar to how RexStates/actor abilities work at the moment.
     
    jdameron and hodgepodge2022 like this.
  29. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Are you talking about a forum separate from this Unity forum? If so, it's interesting that you mention that -- I've been considering setting one up on the official site, but I wasn't sure if people would be interested. If it's something that would help everyone, I can definitely look into it.
     
    jdameron likes this.
  30. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    yes for the InControl integration I'm looking to make multiplayer work with 2 controllers, thanks
     
    Last edited: Mar 6, 2018
  31. kitsune9000

    kitsune9000

    Joined:
    Aug 15, 2015
    Posts:
    42
    I feel like this forum puts everything into one place. If anything, I would make sure everything linked back to this thread. It's really useful. I don't think there needs to be an additional forum. Unity forum and YouTube are the most useful things I use to determine if I want to buy an asset and where I go for continued support.
     
    jdameron likes this.
  32. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya Lars, thanks for pointing this out -- I need to kick this question over to the InControl dev. I've reached out to him, so I'll let you know as soon as I have a solution for you.
     
    Lars-Steenhoff likes this.
  33. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    1.17 is now out! It has ProCamera2D integration. If you have ProCamera2D, you can get it integrated with Rex Engine by clicking a single menu option in the Tools menu. I'll put out a video shortly showing how to integrate them -- it's super quick.

    (Incidentally, ProCamera2D is awesome and I recommend it to everyone!)
     
    Bagnol, jdameron and Lars-Steenhoff like this.
  34. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    yes great, I have been using pro camera with rex for a while, nice that there is now an official integration because before i had to dig a bit to get it to work, thanks for the continued extentions!
     
    BeeZee likes this.
  35. jdameron

    jdameron

    Joined:
    Oct 2, 2013
    Posts:
    5
    I like the idea of a forum. The ability to categorize topics is a necessity as projects grow. And this has no signs of slowing.

    Speaking of which... Another nice update!
     
    BeeZee likes this.
  36. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya, just wanted you to know that there was indeed a bug with this, and it's fixed in the new version 1.17, which is available now on the Asset Store. Additionally, I added a component which might help you out: under RexEngine/Resources/Helpers, there's an object called RexCameraSettings. If you drag a copy of this onto your scene, it has a slot called "Focus Object" where you can drag a Transform, and the camera will then follow that object when the scene loads. I still eventually have plans to add in a full-fledged autoscrolling system, as well!
     
    calminthenight and Bagnol like this.
  37. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee
    Just grabbed a copy of the asset, so far so good I'm loving every neat features it offers, just want to ask, is there any issue when using Unity 2017.3 or what is the best latest version of Unity that I can use for the asset?
     
    BeeZee likes this.
  38. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Heya, awesome, much appreciated! 2017.3 will work fine. I usually submit it via 5.x so users with old versions can still use it, but I also do periodic testing on 2017.x, and so far, so good!
     
    FunkyBuddha likes this.
  39. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee
    Is this some sort of an error, why it keeps on showing up in the console, every time I press on the play button?



    Error1-2.jpg Error3-4.jpg Error5-7.jpg
     
  40. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    Also got another question, about the Scene's Terrain, did you use a particular tileMap editor asset to create those terrain? By the way, will the asset work properly with Unity's 2017.3 built-in Tilemap Pallettte and its Tilemap Collider 2D component when creating Terrains?
     
    Last edited: Mar 13, 2018
  41. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    For the photos with the yellow warning messages, you can safely ignore those; they're just warnings, and it's a weird instance where Unity is sort of wrong in giving them. I plan on seeing if I can clean them up soon, but in the meantime, they're harmless.

    You can use Unity's built-in tilemaps, yep. In fact, I'd recommend it; I did the Booster's Adventure demo just by making GameObjects for each tile with a SpriteRenderer and a BoxCollider2D, but that's much less efficient (and less performant) than using tilemaps. I like to submit Rex with as low of a version as possible so that people can use it even if they're not on the latest version of Unity, but in the unique case of tilemaps, that forced me to work around them, since they weren't available until Unity 2017.
     
    FunkyBuddha and hodgepodge2022 like this.
  42. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    There is really not much discussion on using Unity 2017.3 in the forum, So I just want to make sure that I'm using a compatible tool for the asset and things are normal on the console window before I go on full production on my project. Thanks for the fast reply, :)
     
  43. calminthenight

    calminthenight

    Joined:
    Nov 23, 2017
    Posts:
    11
    Thanks! I'll check it out :)
     
  44. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    @BeeZee

    Is there a feature in the asset that when an enemy is killed it will spawn a gameobject prefab, say for example extra life or coins? I've looked in the enemy's child components there seems no option for this, or May be I'm missing out on something,
     
    Last edited: Mar 14, 2018
  45. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    Perhaps an idea for rex engine, to make upgrading from older versions easier, it may be good to store user settings in an asset file. for example when I make changes to the player and I update rex to a new version it overrides those changes.
    with an asset file you could slot the asset in the player settings and it would get it data from there.

    A bit like unity post processing v2 does. and also the shake presets in pro camera 2d.

    This makes it easier to edit values and I don't have to apply changes to prefabs.

    Screen Shot 2018-03-14 at 13.22.14.png
     
  46. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    NullReferenceException
    RexEngine.RexCamera.Awake () (at Assets/RexEngine/Scripts/rexengine/_Camera/RexCamera.cs:87)

    Im getting this error when trying out the 2d camera pro add-on, probably I'm doing something wrong. it seems related to layer masks, is there a way to not set layers masks at awake?
     
  47. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @Lars-Steenhoff This might be because the ProCamera2D integration process removes the Rex Camera script from the Main Camera and changes the way the Cameras prefab is set up. ProCamera2D and Rex both expect the Cameras prefab to be set up in slightly different ways to work properly. If you follow the integration procedure (that doesn't seem to have been written up just yet), it should automatically remove the RexCamera component completely from the Cameras prefab, and eliminate that error.
    • Navigate to Assets>RexEngine>Integrations in the Project tab, and unzip the "RexProCamera2D.zip" file.
    • Go to the newly added Tools>Rex Engine>Setup ProCamera2D
    That's pretty much all there is to it, to get it running at least. Hopefully free of that error :)
     
  48. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    Yes this is what i did, with an exsting scene, so there may be something conflciting, I will start with an empty scene and do the same
     
  49. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    Is there a way that I can make rex swim like mario?

    pressing jump to swim up and while not pressing he has gravity so he slowy sinks?


     
  50. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Yep. There's a component called a DropSpawner (found under RexEngine/Scripts/RexEngine/_Components/DropSpawner.cs) which enemies created from the Enemy template have by default. (You can access the Enemy template from Window > Rex Engine > Rex Palette, and then you can create a new enemy from the template by expanding the "From Template" field in that window and hitting "Enemy.") You can slot a prefab into the DropSpawner, and an instance of that prefab will be created when the enemy dies.
     
    FunkyBuddha likes this.