Hello,
i would like to create a basic npc schedule for the npc's
is it possible to Ork work with XML files ? to create something like this


<day1>
<npc name="george">
<schedule start="0:00" end="8:00 armor="base">
<sleep at="home"/>
</schedule>
<schedule start="8:00" end="9:00 armor="leather cloth">
<walk leave="home" destination="smithy"/>
</schedule>
<schedule start="9:00" end="17:00" armor="leather cloth">
<runshop at="smithy"/>
</schedule>
<schedule start="17:00" end="18:00 armor="leather cloth"">
<walk leave="smithy" destination="home"/>
</schedule>
<schedule start="18:00" end="24:00" armor="base"> <!-- note: no warp-around -->
<sleep at="home"/>
</schedule>
</day1>
</npc>
<day2>
ets...


and allow them to change armor equipment

or to create it other way ?

i really need help with this

other question is how to all npc that walk around interact with door's(open them, closing them),items(pickup,drop item),ets...?
  • I intend to include these sort of daily routines in my own game (being a huge Ultima fan), but I'm nowhere near the stage of implementing them. I have thought about how to best do so, however.

    The best tool for this is probably a behaviour tree, as those are designed around decision-making like this. You might combine a behavior tree with a finite state machine (FSM), with the BT monitoring the time of day and determining which FSM to transition to (Eating, Sleeping, Working at the Forge, etc).

    Behavior Designer and NodeCanvas are both excellent assets for building behavior trees. NodeCanvas also includes FSMs (and dialogue trees), whereas Behavior Designer would need to integrate with Playmaker to set up FSMs.

    There is a Behavior Designer integration for ORK, but it is currently broken and presumably unsupported, given that the developer's website no longer exists (if you go to www.gamekakkak.com, you see a message that the domain name has expired). So best to stay away from that one (same with his Playmaker integration; it's also currently broken).

    To have NPCs interact with items, you can adapt a tutorial I wrote some time ago. Basically, for any object that you want characters to interact with, create an empty GameObject as a child of the object prefab and position it where the character should move to when interacting with the object. Not only so that the animation lines up properly, but also to ensure that the character never targets a position they can't reach. When placing this "interaction point" always check your generated NavMesh to ensure that it will be reachable.

    Essentially, any action you want an NPC to perform will need to be set up as an ORK Event. An ORK Game Event can call a Battle Event or Move Event, but not another Game Event, so try to encapsulate the common, reusable bits of logic in a Move Event.
  • edited June 2017
    this is a game mechanic i'm keen to implement into my own Ork games

    i got Behaviour Designer a long while back, but i never really got on with it, so for Ork games i'm using the basic Ork movement AI (which unfortunately, because it doesn't support root motion, always looks kinda floaty) and for most of my other games i use my own homebrew AI written in c#

    it's pretty basic - "walk around randomly, if you bump into an NPC stop and talk to them. stop and talk to the player if he's not armed. run away from the player if he's armed and you're not, run and attack the player if he's armed and you are too", that kind of thing

    i really want to implement some more sophisticated time-based system eventually though. as most of my games are in modern settings that would come down to: "sleep at night. leave house in morning. go to work. leave work in evening. come home. do stuff at home" etc, but also incorporating player interactions, and also NPC/NPC interactions. NPC/object interactions would be a nice to have, but aren't usually essential for my games (although, i might want them to be able to open doors)

    anyhoo, i'll be keeping an eye on this thread to see if i get any inspirations from it, but i can't really give any suggestions for your own particular use case i'm afraid
    Post edited by HarryOminous on
  • thanks for the responses
    i did some research for a few days learned new stuff that i didn't knew about
    when i started mt project i didn't think about AI,Behavior Trees,FSM
    so i would like to know any recommendations about AI in Assets Store because i believe to create my own AI will take me for ever

    so i'm looking froward to buy the NodeCanvas next month for the AI Behaviors and Navigation i would like to know if there any other better solution for it
    also i'm planing to get Final IK and PuperMaster now i study there documentations
  • @VagrantVX - To do what you're asking about here, NodeCanvas should be all you need. In your thread asking about Day/Night cycles with Tenkoku, I saw you also listed Playmaker. I don't think you really need PM if you're going to use NodeCanvas, as NC already does FSMs.

    The main thing Playmaker has going for it is extensive 3rd party support. But if you can write C# code, you can create the equivalent NC actions quite easily.

    I've got everything you mentioned on that list, although I haven't had a chance to explore all of them thoroughly. I would suggest waiting until you need an asset before buying it, unless it goes on sale at a good discount. I've bought a number of assets that I thought I'd use but either turned out to not be what I wanted -- or in many cases, the author stopped supporting it.

    I got Puppetmaster during the recent Madness sale, but I'm honestly not really sure what to use it for. :-) It's complex and requires an odd setup for your character that doesn't always play well with other assets. I might change my mind if ai have time to mess with it, but I'm inclined to use a simpler ragdoll solution. Also depends what character controller you're using.

    Final IK is more generally useful, I think. The interaction system looks cool, but I haven't tried doing anything with it yet. But it works great for foot grounding and fixing hand placement on two handed weapons. :-)
  • I am not sure what you want to achieve, but can't this be done in ORK totally? Playing with variables i mean, and checking which part of the day is... instead of focusing on a tablesheet, you can focus on single npc with events: i did something like that in my small game for ICGM2015, and even if ORK was surely less expanded results where quite good..

    About second questio, it would be surely complex but if you make characters move randomly and events on prefab that can be started even from npc (not player only) you can surely achieve something.

    These are just my thoughts, i hope you can get some ispiration. :-)
  • edited June 2017
    @VagrantVX - Okay, I did a quick proof of concept with Enviro and NodeCanvas, and I've got a very basic setup that should work.

    I whipped up a simple component to capture the Enviro events and then broadcast them to NodeCanvas graphs as a global event (i.e. to all Behavior Trees in the scene):

    using UnityEngine;

    public class EnviroActorScheduler : MonoBehaviour
    {
    void Start ()
    {
    EnviroSky.instance.OnHourPassed += OnHourPassed;
    }

    private void OnHourPassed()
    {
    NodeCanvas.Framework.GraphOwner.SendGlobalEvent<int>("OnHourPassed", EnviroSky.instance.GameTime.Hours);
    }
    }


    Obviously, you'd need to fill this out with the other events, but the basic framework is there. You could put simple BTs on your lights in the scene and have them turn on and off in response to OnDayTime and OnNightTime, for example.

    I put together a simple BT that listens for the OnHourPassed graph event and then displays a simple message based on the time:

    image

    The conditional decorator on the first Selector also looks at a "ResumeSchedule" boolean that currently doesn't do anything. I just put that in there because we'd need a way to check these again if the NPC is interrupted and then needs to resume what he was doing. It would need more than just that, as you would want to resume in the middle of that particular activity and not start over, but hey, it was a quick proof of concept. ;-)

    Each sequence of movement/animations/whatever in an activity might be best implemented as an FSM that is run by the BT. Might also want to standardize the list of possible activities as an enum. Can't really know until I really start digging into it.

    And obviously you'd want to split off each activity into its own BT or FSM, rather than having everything in one giant BT.

    @Kaemalux - I wouldn't say it can't be done totally in ORK. I'm just saying that I don't think ORK is the best tool for the job. Event-driven systems typically perform better than ones that are continuously polling, especially as you scale up.

    I think that the approach I've outlined above is also far simpler. The "Time and Day" tutorial works but in my opinion it's a square peg fitting into a round hole situation. It seems overly complex to me, plus you still have all of your time-related objects needing to poll it. You could set up some simple routines using the Move AI and its Idle events. You'd put an Auto-start GameEvent on each NPC that runs a continuous "Check Time" -> "Wait" loop and then switches out these Move AIs, or runs different Events for more complex activities. But we're already getting more complex than using a behavior tree, and I suspect that the BT would also offer significantly better performance.
    Post edited by Keldryn on
  • It can be done in ORK but bear in mind of the time and skill level needed to achieve it. You can either:
    1. Do it all in ORK
    2. Get a third party add-on and try to integrate it
    3. Code your own system and set up calls between ORK

    While getting NodeCanvas does solve your problem, you still need time learning how to use it for just this one function.

    I agree with @Keldryn. For events that are continuously updates itself, you're much better off with Behaviour Trees or State Machines.

    Personally I don't recommend adding more third party add-ons unless it's necessary. It will cause more problems for me to debug and having to rely on its developer if the problem is on their end. If you're gonna add in add-ons, do it early.

    Note: Regarding the NPC interactions part, you also have to figure out a way to chain actions for them if they are to dynamically go around their schedules. For example, select destination > moving to destination > walk to door > Do 'open' animation > moving to destination > reached destination.
  • @Raiulyn -
    While getting NodeCanvas does solve your problem, you still need time learning how to use it for just this one function.
    Well, for me, I'm also using it in place of ORK's BattleAI and MoveAI. For a responsive, real-time game, they just don't seem to produce very convincing behavior (in my experience). A behavior tree is a lot more flexible.
    Personally I don't recommend adding more third party add-ons unless it's necessary. It will cause more problems for me to debug and having to rely on its developer if the problem is on their end. If you're gonna add in add-ons, do it early.
    Definitely need to choose 3rd party add-ons carefully. Select ones that are known to be reliable and well-supported. Most importantly, avoid ones that use compiled DLLs and don't include the source code, as you are well and truly screwed if the developer stops supporting it or disappears (case in point: Playmaker Actions for ORK).

    I wouldn't be too concerned about adding NodeCanvas or Behavior Designer to the mix though. They're rock-solid, widely-used, and well-supported. And if you're doing a responsive real-time game, you probably need to use a dedicated character controller as well.
  • @Keldyrn
    Keldryn said: Well, for me, I'm also using it in place of ORK's BattleAI and MoveAI. For a responsive, real-time game, they just don't seem to produce very convincing behavior (in my experience). A behavior tree is a lot more flexible.
    Well. I'm speaking more in terms of - Is it faster to learn and implement assets than not doing it the vanilla way? - kind of thinking.
    Keldryn said: Definitely need to choose 3rd party add-ons carefully. Select ones that are known to be reliable and well-supported. Most importantly, avoid ones that use compiled DLLs and don't include the source code, as you are well and truly screwed if the developer stops supporting it or disappears (case in point: Playmaker Actions for ORK).

    I wouldn't be too concerned about adding NodeCanvas or Behavior Designer to the mix though. They're rock-solid, widely-used, and well-supported. And if you're doing a responsive real-time game, you probably need to use a dedicated character controller as well.
    To those people who bought Playmaker Actions for ORK, you all have my sympathy. Buying assets comes with the risk of depreciation. Do keep this in mind.
    That said, there are some asset developers that deserve praises. Don't worry GiL, you belong in that group. :)
  • Just purchased the NodeCanvas on last hours of sale big thanks @Keldryn for sending me a PM
    @Kaemalux im trying to create a game like Gothic1/2 Link to Gothic 1 Trailer/Gameplay with aditional options
  • I do understand doing it vanilla would be time-consuming and would need a lot of attentions/tricks, but i suppose it can be done.
    You could just divide day and night in different moments: morning, evening, lunch... And whenever there is a new step, you let npc change their behaviour.
    I do like the setting in that BT image, very clean, but i honestly prefer using no other asset if possible, i would probably give it a shoot in ORK and if the results are totally unsatisfying i would switch to 3d party.
    I cannot remember if there is a "broadcasting" event in ORK, something like check variable --> send command to all npc, i suppose Makinon would handle it better, but if you use autostart events i think you can achieve it properly:
    - npc check time
    - npc check position
    - npc do proper things, depending on where it is
    - you can check other variables / quests / logs to change behaviour (ie a npc could get in a specific spot if the player has done something special...)

    I hope it helps. ^^
Sign In or Register to comment.