Making NPCs feel more alive in my indie game | Godot devlog

Поділитися
Вставка
  • Опубліковано 12 лис 2024

КОМЕНТАРІ • 21

  • @LandonDevelops
    @LandonDevelops  7 днів тому

    To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/LandonDevelops/ . You’ll also get 20% off an annual premium subscription.

  • @timmygilbert4102
    @timmygilbert4102 4 дні тому +2

    I just hash time, use the hash as index in the schedule, then lerp between spot, and apply the hash of the lerp value to a list of points that encode the path between spot, spot has an animation tag for context emotes. No simulation as the map areas hold reference to possible npc relative to time, npc position is a stateless function. Random schedule entry for variations, deterministic with a seed, abuse determinism to query were a character would be at all time, useful for a pseudo simulation of knowledge without storing anything.

    • @LandonDevelops
      @LandonDevelops  3 дні тому +1

      That's a lot of words I don't understand 🤣For real though, that sounds like a much more clever solution than what I've come up with

    • @yt_n-c0de-r
      @yt_n-c0de-r 2 дні тому

      @@LandonDevelops Hashing is essentially calculating a very specific value from ... well... anything - objects, values, strings. A good hash is (almost) perfectly unique and as such can be referred to get destinct data(points) in a collection. And I'll try to explain it a bit more, if I understood the idea correctly.
      For the example mentioned in your video: hashing the times between entering the house (let's say 7:50.00) and reaching the bed (for example 5s, so 7:50.05) would give you 5 specific values (for each second) your code could refer to. When the Player enters the house, for example at 7:50.03, on loading the scene your NPC would check the time, calculate the times curent hash value and look for a hash in its own list, telling it where it should spawn. That way it "looks" like they advanced towards the bed, but have obviously not reached it yet.
      The idea is very good, hashes are very quick and efficient!

    • @LandonDevelops
      @LandonDevelops  2 дні тому

      Yeah that does sound cool! Would you then just precompute the paths and associate them with the hashes?

    • @yt_n-c0de-r
      @yt_n-c0de-r 2 дні тому

      @@LandonDevelops Oh sorry, I forgot about that part. Yeah, you would build a table with hashes (for times of a day an NPC would experience) and some waypoints - usually a HashMap (very popular data structure) is used. Hopefully, you'd need this only for transitional events, but could in theory every NPC could have their own hashmap for all seconds of the game day and where they should be.
      Maybe the OP can explain the concept better.
      (Now, I wonder how TLoZ:MM did it on the limited tech of N64...?)

  • @FillMakesGames
    @FillMakesGames 6 днів тому +4

    This is a cool logical way to make NPCs feel more alive! Sadly, I don’t have any NPCs in my game so I can’t steal your idea 😁 Overall, cool concept and cool video! Thank you.

  • @yt_n-c0de-r
    @yt_n-c0de-r 2 дні тому +1

    I always like games with clockwork-mechanics, where NPCs behave like cogs in a complex machine (similar to real life, but obviously smaller).
    GOAP is a great way to do this. Hope to find some NPC-NPC interaction events soon ;)
    Reminds me of Zelda: Majora's Mask every time... ^^

    • @LandonDevelops
      @LandonDevelops  2 дні тому

      Yeah I really love when NPCs feel like they have their own stuff going aside from what the player is doing

  • @Negreb25
    @Negreb25 6 днів тому +1

    Good job! 👏
    I really like what you did, tho i think they shouldnt come to a full stop for so long

    • @LandonDevelops
      @LandonDevelops  6 днів тому

      Thanks! Yeah the schedules in the actual game will definitely look different, this initial version was just a proof of concept 😊

  • @joshuaneiswinter253
    @joshuaneiswinter253 3 дні тому

    I am making my own game, but in Unity. I too am just getting to the point of wanting/needing to add NPC scheduling. You went with a very similar method as I did. I have a custom script for "waypoint" which currently consists of a time (just the hour) to leave the current waypoint and a vector3 for the location. On the NPC script I have an index and a List and if the time matches the current index's time, the counter goes up and updates the target position.
    I was really hoping for more .. insight.. as to how you were going to approach the zoning of the NPCs as well as what your approach to having them do something besides go to the next location.
    For me, (using you to bounce ideas / check high level logic) I am thinking of having an enum with different states that can get set once they reach their target position and then some kind of check for which state they are in and have an AI function/loop based on their state.
    As for the different areas/rooms/zones/scenes... honestly mine is still just the one area because I haven't had the mental fortitude to tackle zoning properly yet.

    • @LandonDevelops
      @LandonDevelops  3 дні тому +1

      Yeah I think a sort of "sub-FSM" using an enum would be a good idea! Once I have the insight myself, I'll be sure to share it 🤣

    • @yt_n-c0de-r
      @yt_n-c0de-r 2 дні тому

      How about a distict "state" datastructure that you can design yourself? Gives you more advantage and control (yes, more work too ^^), and fits FSM rather well.
      I love enums, they give you lots of bit operations to play with (especially in C#), but they can be a bit limited imho. They can work if you have different "types" of enums, that can be "combined" to reflect very unique state(-structures). Very interesting :D

    • @joshuaneiswinter253
      @joshuaneiswinter253 2 дні тому

      @@yt_n-c0de-r I already have in place things for day (number), day name (string), enum season, all of those are in a "time manager". My idea is to basically let the NPC choose what state it should be based in off of those global variables, and some local ones for the indivisible NPC. Honestly I haven't even opened it in a couple of days because I've been kind of chaise-paralysis with it. I'm probably going to take a pad of paper and pencil somewhere and sit down away from distractions and figure out what I actually need to do.

    • @yt_n-c0de-r
      @yt_n-c0de-r 2 дні тому

      @@joshuaneiswinter253 Just a design question: why not make "day of a week" (aka "name") an enum too?
      Internally they are just numbers which you can do math on and more, but also gives you type checks, easier comparison and auto complete - more code security and correctness - compared to strings. And if needed you can always get the "string" representation of the enum with less room for typos ;)
      I love taking time off from the screen and design on paper (it's used in the "industry" too). Take your time. It all sounds pretty well so far :D

    • @joshuaneiswinter253
      @joshuaneiswinter253 День тому

      @@yt_n-c0de-r I originally did that, but I couldn't figure out how to blah blah = Dayname[date % 7] so I just made it a list of strings. The dictionary key will be something along the lines of "Spring3" or "Autumn25". I tried getting an NPC to use a few different navigation methods tonight but struggled and now I'm tired lol.

  • @zejugames5045
    @zejugames5045 4 дні тому

    Wait, what's the game again? I lost the plot!

    • @LandonDevelops
      @LandonDevelops  4 дні тому +1

      It's kind of like Stardew Valley mixed with Mount and Blade but I'm realizing that might not be the best description. I think in my next video I'll go over the whole idea of the game because I don't think I've ever actually done that lol