I'm working on a 2D game and my world features a lot of NPCs. I'm new to ORK, so I'm not trying to do anything complicated right now. But I want to make my workflow as efficient as I can for now.

For creating an NPC template, would it be best to create a prefab instead of duplicating NPC game objects? If so, what would be the best way to set up a simple NPC prefab in ORK 3? Is it as simple as creating a game object, giving it a sprite render component, a box collider, an animator, a move AI (to allow it to move), and then an interaction machine? Am I missing anything else?

Alternately, because NPCs tend to be so different and varied, is there really any advantage to using a prefab instead of just making copies of game objects?
Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • I think it largely depends on what you want the NPCs to do. For example, if they will be static and just repeat dialogue / be a shop keep then you could just make them be basic game objects with an Interaction Machine component and the associated schematic. You wouldn't need to set them up in ORK at all really in that situation.

    Prefabs are nice with the (somewhat) new variant feature if you're going to have a lot of shared behavior or components even if you don't use that same prefab multiple times. In my project, I have a "Player Combatant Base" prefab and then each player combatant prefab is a variant prefab of that. While I will only have 1 of each combatant ever instantiated, any changes I make to the Player Combatant Base prefab will then propagate to each of my player combatants as well. This base is where I dump all of my components like player control, nav mesh, etc.

    Currently the only real difference for example is just the character mesh.

    If I just created duplicate objects, any time I wanted to make a sweeping NPC change, I'd need to do it to every single object and introduce the possibility of making issues.

    Hopefully that makes sense!
  • Well, I'd be creating NPCs that will animate and have movement, so they wouldn't just be static. At the very least, I want them to be able to face the player with the Turn To setting in interaction controllers.

    Additionally, I saw an asset which will set up a sprite library so that you can use the same animation controller for many different objects that use the same animations, just with different sprite sources. Is this something that ORK's animation settings can automate for me? Or would it be something worth looking into?
    I ask because I have literally dozens and dozens of NPC sprites that all need an idle animation and a walking animation, so it would be incredibly tedious to set up the same animation controllers and blend trees for 50+ NPC sprites.
    Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • If you want to take advantage of ORK's animation setup and move AI, you need to make your NPCs into combatants (e.g. via an Add Combatant component). That way they can move around and animate like other combatants.

    Alternatively, you can also use schematics/machines or custom scripting.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • So if I create a basic 4-way animation controller and set it with ORK's animation, I can use that for all NPC combatants?
    Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • From ORK's perspective yes.

    However, for sprite animations, you still need to set up different animations for each NPC, or they'll all animate using the same sprites and look the same. E.g. using an animator override controller to replace the used animation clips.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Hmm, if I need to use an override controller either way, is there any advantage in making 50+ NPC combatants who will just be random NPCs in the overworld?

    Can I still use move AI if they're not combatants? If not, can I just use a schematic/machine to have them randomly walk around? But if I do that, could I run both a schematic that makes them randomly walk, and a schematic for interacting with them?
    Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • You don't really need to set up 50+ combatants, unless they all have a different setup. You can e.g. just set up a single combatant for the move AI and animation handling. Since ORK playing animations is independent of what actual animations are used, you can just swap out the animations on the NPCs (e.g. via override controller) and still use the same combatant.

    Move AI is only for combatants. You can also use schematics to walk around, but you'd also have to handle animations in that case (can also be handled via schematics).
    You can have multiple schematics/machines on the NPC.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Okay great! If I decide to create an NPC combatant, that will be helpful. However, right now I'm trying use schematics to create random NPC behavior and I cannot get it to work at all.

    Right now I have the following schematic:

    image

    It's running on an NPC prefab that has another interaction machine that simply plays a dialogue. The dialogue works fine when interacting, but the NPC will not move.
    Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • The Move node is used for per-frame updates, so the 2 second wait kinda makes this a very, very slow movement.

    Use a Change Position node instead.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.