Forum rules - please read before posting.

How can I create a character from a PSB archive?

Hello.

I bought Adventure Creator recently and I have been following this tutorial:

Everything works fine but when I get to the part of creating a character, since I need to use one PSB rigged, I can't follow it. So instead of that, I just followed this tutorial:

I created the character like that but now I don't have any idea of how to put it on Adventure Creator logic and I dont find any tutorial about this. Any help? What I did was pretty much all the last video, created a PSB, imported it, rigged it and put the meshes, made a walking animation with the animator... pretty much that is all.

Now I have the PSB file, the prefab and the animation of walking. What should I do now to continue? Pretty new to Adventure Creator so If there is any step by step guide, I would be so grateful.

Thanks in advance.

Comments

  • Welcome to the community, @Legend.

    The tutorial you mention is unofficial, I should mention. Official tutorials - both text and video - can be found here.

    The most basic tutorial on creating a 2D character can be found here. This, however, makes use of AC's "Sprites Unity" animation engine, which is the most simple available and more suited to characters that rely on frame-swapping for animation rather than skeletons.

    This is particularly the case if you want to make use of different skeletons depending on which way the character is facing (up/down etc). Are you looking to have this be possible for your character, or is moving left/right enough?

    For a character that uses skeletal animation, I'd recommend instead using the "Sprites Unity Complex" animation engine. As the name suggests, this is a little more involved, but is more flexible and more in-line with Unity's best-practices when it comes to animation playback.

    See the Manual's "Animation engine (Sprites Unity Complex)" chapter for details on this mode, but essentially it works by having AC take control over certain parameters in your Animator Controller (e.g. a "Movement speed" float, a "Direction facing" int).

    You might need to share some images showing your progress through this, but try this:

    1. If you haven't already, create an Idle animation as well for your character, and use a Float parameter named MoveSpeed in your Animator controller, that causes the controller to transition between your idle and movement animations. For example, if its greater than 0.1, transition from Idle -> Run, and if less vice-versa.
    2. Drop the character into your scene, and use AC's Character Wizard on it. The tutorial I mention above covers this, but you'll want to use the Sprites Unity Complex animation engine this time.
    3. Once the wizard is complete, go to the object's root and find the "Mecanim parameters" section in the Player/NPC component. Clear all of the text fields in this panel for the moment, but set the "Move speed float" field to MoveSpeed (i.e. the parameter you created in step 1).
    4. You can then make this a new prefab, which can be assigned into your Settings Manager's "Player prefab" field to have them be spawned automatically when your game begins.

    The next step will be to have the Player be able to face left/right depending on input (this script would probably be the easiest way), but see how you go with the above and we'll take things from there.

  • Okay, so I'm stuck with the animator since I have never used it. I'll try to tell u what I did in detail.

    1. I made the Idle animation and the walking animation (only facing left). So I got this:

    https://imgur.com/M5kH592

    1. Now I don't really know how to continue, getting confused. I went to the animator:

    https://imgur.com/ep1SeEc

    But I don't really know how to do the rest. I assume I need to create some logic with arrows, so I went ahead and created what its in that screenshot. I dont know what is a Float Parameter, so I don't know how to create that or where I should put it.

    1. Also used the AC Character Wizard and I have this section like this:

    https://imgur.com/msFu6K6

    1. Didn't try anything more since first I need to do this steps correctly to follow your instructions.

    Thanks in advance and sorry for the trouble, trying to learn all of this!

  • Thanks for the details.

    It looks like you're currently using Blend Trees in your Animator. These are a little more complex, and allow for things like changing the speed of the walk animation playback with the speed of the character. They aren't strictly necessary, though, so I'd suggest doing without them for the moment.

    Instead, drop in your Walking animation clip directly into the Animator, and replace its current transitions with a simple pair - one from Idle to Walking, and another from Walking to Idle.

    You'll also want to make Idle your default animation. You can do this by right-clicking the Idle state and choosing "Set As Default" from the menu.

    For the parameter: you can access and define parameters by clicking the "Parameters" tab at the top-left of the Animator. Click the "+" icon, and then choose "Float". Name this Speed, so that it matches the "Move speed float" field in your Player's Inspector.

    Though it won't yet have a visible effect on your character, at this point you should now find that when the character moves, this parameter's value (on the left of the Animator) changes to reflect the character's speed.

    The next step will be to have this parameter control which of the two animations are played - so that Idle is played if Speed is very small (say < 0.1), and Walking is played otherwise (> 0.1).

    To do this, you can select each of the transitions and add an appropriate Condition in its Inspector. You'll also want to uncheck "Has Exit Time" near the top.

    Together, the transitions should look something like this:

    If all's well, at this stage your character should now transition between Idle and Walking when they move.

    Aside from the naming of the parameter to Speed, though, the above is all to do with Unity and not involving AC. If you're still fresh to Unity itself, I do recommend having a look through Unity's official tutorials first - for example, this one, which covers the Animator.

  • edited November 2021

    Thanks very much! Your instruction were so nice, I could do all the stuff of the animator and now I understand it perfectly.

    So, I did it and continued with the steps of your first post, when I encountered this steps:

    3. Once the wizard is complete, go to the object's root and find the "Mecanim parameters" section in the Player/NPC component. Clear all of the text fields in this panel for the moment, but set the "Move speed float" field to MoveSpeed (i.e. the parameter you created in step 1).

    4. You can then make this a new prefab, which can be assigned into your Settings Manager's "Player prefab" field to have them be spawned automatically when your game begins.
    The next step will be to have the Player be able to face left/right depending on input (this script would probably be the easiest way), but see how you go with the above and we'll take things from there.

    In the step 3, I think I should name it "Speed" instead of "MoveSpeed", but I don't know if Im right.

    And in the step 4, I don't know what element should I make a prefab of. I have this:

    https://imgur.com/ww7PaHa

    What element of those should I make a prefab of (and how)?

    Again, thank you very much for the help, I appretiate it a lot.

  • In the step 3, I think I should name it "Speed" instead of "MoveSpeed", but I don't know if Im right.

    You're right!

    What element of those should I make a prefab of (and how)?

    The root GameObject - "My New Player".

    To turn a GameObject into a prefab, drag/drop it into the Project window. It'll then appear as a new file in your Assets filesystem.

    From there, you can drag/drop it again into your Settings Manager's "Player prefab" field, near the top.

    Once done, you can choose to delete the original "My New Player" from your scene, and AC will take the prefab you've assigned in the Settings Manager and create him automatically each time your game begins.

  • Already did that! Somehow, when I play the game, character does not appear. Should it appear at this moment or am I missing some more steps?

  • Seems I can't edit last post, so I'll just update the topic writting again:

    I have been looking at Unity and found that if I keep the GameObject of the player in the scene, when I press play it resets to the position it has (even if I moved it, since it appeared of screen) and plays correctly the idle animation (but i can only see it on Scene window, since on Game it wont show due to being always at the original position):

    Before pressing Play and moving the character so he can enter the visible zone:

    https://imgur.com/aC70o63

    When pressing Play:

    https://imgur.com/XxXBJ9Q

    If I erase the GameObject, it doesn't even appear (and I put the Prefab on Settings):

    Here the mode is on Play and it doesnt appear on neither screen Game or Scene, but the prefab is dragged to where it should be:

    https://imgur.com/DPiIBgx

    Thanks in advance again.

  • edited December 2021

    In a situation like this, an important first step is to check Unity's Console for messages. AC has a number of messages it can display if it detects something is wrong. Once the game begins, bring up the Console window and check to see if it's reporting anything amiss - share them here if you're unsure.

    The Player prefab looks assigned correctly, so it should be getting spawned if your local Player has been removed. If you go to the bottom of the Settings Manager, set the Show 'AC Status' box field to Editor Only. When the game is running, you'll then be able to see the AC Status box at the top-left of the Game window. This'll include the active Player, if there is one. You can click on the Player's name here to "ping" the Player's object in the Hierarchy - is this showing?

    For the Player's position: when a scene starts, AC will position the Player at the correct "PlayerStart" Marker. You should have one already assigned in the Scene Manager's "Default PlayerStart" field - see this tutorial for details. You'll need to position this blue PlayerStart arrow at the position you want the Player to begin at.

    It's important to note, though, that the Player will be moved by their root object - "My New Player", in your case. Because of this, you will need to make sure that their child object is positioned such that their feet appear at the same position. Where are your Player's feet currently in relation to the root object? If there's a difference, then the Player will be at the correct position technically, but won't look correct visually.

    A quick way to test if your scene is set up incorrectly, or if there's an issue with your Player, is to temporarily swap out your own Player prefab for the one used by the 2D Demo game. If you navigate to /Assets/AdventureCreator/2DDemo/Resources, you'll find Brain2D. Drop him into your scene while in Edit mode, and he'll override the prefab you have assigned. He should move correctly to your scene's Default PlayerStart. You'll want your own Player prefab to then appear at this same position.

  • Console shows this:

    https://imgur.com/uZWU4uB

    I did the "Show 'AC Status box' stuff and I see that the characters appears now, just it appears off screen and that's why I couldn't see it.

    I tried moving "Default PlayerStart" and messing with it. Yes, the characters moves if I move that element but for some reason, it appears so high and not where the PlayerStart should be:

    https://imgur.com/WTy45iP

    I think it may because of this that you told me:

    It's important to note, though, that the Player will be moved by their root object - "My New Player", in your case. Because of this, you will need to make sure that their child object is positioned such that their feet appear at the same position. Where are your Player's feet currently in relation to the root object? If there's a difference, then the Player will be at the correct position technically, but won't look correct visually.

    But I'm not sure and I don't really know how to put it at the same position as the feet.

  • edited December 2021

    I'm not sure and I don't really know how to put it at the same position as the feet.

    You'll need to change the position of the Kid_PSB object that's a child of the "My New Player" prefab.

    Double-click the prefab to open it up in Prefab Mode, and then select the root object ("My New Player"). The position gizmo should tell you where its position is - this is where you'll want the character's feet to appear. Move the Kid_PSB child so that the feet are then at the same place as the root. When correct, the character will appear at the PlayerStart - though oversized at the moment.

    The scene's graphics are much smaller than your character, so the next step will be to correct this. While you can make use of a Sorting Map to dynamically adjust the character's size at runtime, it's a good idea for your graphics to have a comparable default size. You can either reduce the size of your character, or increase the size of your background/scene.

  • All the first part worked! :)

    Now I tried to resize the character using this into the prefab:

    https://imgur.com/86eDTJl

    But it gets deformed but the scale doesn't change :/ Does this mean that I need to change the size in the original PSB file with Photoshop or can I do it inside Unity?

    Thanks.

  • edited December 2021

    If you want to resize your character's default size in the prefab, you'll need to update their skeleton - not the root object.

    AC will control the scale of the root ("My New Player"), so you can either reduce the size of the sprite child object ("Kid_PSB"), or rebuild the character's skeleton with smaller graphics.

    You can reduce the default size of a graphic asset by increasing the "Pixels Per Unit" setting in the texture's Inspector.

    Again, though, you could instead make your background art bigger to have things match up that way. To do that, you can decrease the "Pixels Per Unit" setting of your background texture to make it appear larger in the scene.

    These concepts do not involve AC, however. I do urge you to check out Unity's own docs and tutorials on working with art assets and animation with Unity in general before incorporating AC into the mix.

  • Hey Chris, spent the weekend reading Unity stuff and also managed to get the basic animation with script you linked above. Also, tried the animation with sprites.

    Thanks a lot for the help over this thread. One last question, now that I managed to animated both way, what are the pros and cons of PSB vs Sprite Swapping?

  • edited December 2021

    Sketal animation by its nature is more complicated to set up than sprite-swapping in general, as it involves having to manage a rig and animate it from within Unity.

    This is made moreso with traditional adventure games, which normally have the player be able to face different directions e.g. up/down/diagonals. Often it's necessary to create a separate rig for each direction, and show/hide the correct one through animation depending on which direction the character is facing.

    This was the approach taken by Broken Age - though it doesn't use AC, the principles can be applied to games in AC/Unity.

    Sprite-swapping by comparison is a lot more simple: you create the frames outside of Unity, convert them to animations, place them in an Animator Controller and you're done.

    Once you're over the technical hurdle, though, it's really down to personal choice based on the artistic approach you want to take, and way of working you prefer.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.