0 Favourites

Best behavior for a topdown RPG NPC?

This forum is currently in read-only mode.
  • So I was messing with different behaviors just to see what they can make 1 of my NPCs do. I ended up combining RTS, Custom Movement and Line of Sight but still has some bugs in terms of acting like an NPC.

    My question is which behavior should I use? And how do I make them randomly move around the map?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • The answer to this question isn't easy. It hugely depends on what you want your NPC to be able to do. In order to mimic a pseudo-reaistic behavior, where the NPC will randomly move, react to things like monsters or do certain things at day/night time, you'll have to have a very solid concept. And a lot of breath.

    Combining stuff like RTS + LOS doesn't sound like a bad idea, although it might be challenging to handle. Again it's hugely depending on what level of detail for your NPC behavior you're trying to achieve.

    For starters I'd stick with a rather simple NPC behavior. Sorry that I can't really give a more profound answer to your question.

  • Well, I guess we can start a random movement, like the npc will move at some point to a random location, and stay there for a bit, then probably move again.

    What behaviors would be required for this?

  • The grid movement behavior set to npc is a pretty good start for this. Its in a grid, so it will give an old school rpg feel to it. Theres a demo of the rts with turret behavior in with the templates. The turret behavior is a little easier to use than line of site, so you might give that a try as well.

  • It would be a start, but the main character in my game moves in RTS movement, which is 8 directional. Would 8 directional behavior work? I'll probably set the controls to none or something so that the player cannot manipulate the NPCs, if any is online right now, go to chat

  • Hey JanMan. Here's the .cap for a little RPG engine I've been working on. It's not brilliant, but it does work (Except for the conversations, but that's just because I haven't bothered working out all the logic, the method is sound).

    http://dl.getdropbox.com/u/1378330/RPG.cap

    Its not commented, its pretty rough, but maybe it can help.

  • Oh since we're in a sharing mood:

    http://dl.getdropbox.com/u/2306601/inventory_007x3.cap

    It's not NPC but still RPG-related. So this might interest some reading this. TheJanMan might already have it though.

  • It requires AdvanceCamera.csx, now where do I get that? And yes, I already have that one Pix. Seems to be like Diablo to me lol.

  • It requires AdvanceCamera.csx, now where do I get that? And yes, I already have that one Pix. Seems to be like Diablo to me lol.

    You don't know about the wonders of advanced camera plugin yet?

    There you go: http://www.scirra.com/phpBB3/viewtopic.php?f=2&t=4687

  • Ooohhh nice! Thanks. Back to topic, I'm pretty sure it would be laggy if I make my rpg in ONE HUGE LAYOUT and fill it with.... EVERYTHING... How big can a layout be in its size?

  • Hmmm there are some limitations. Biggest layout I've been able to get away with was 12000x12000, and that was with a fair bit of optimisation.

    I've tried systems that don't work with a layout per se, but actually store the level in an array which is drawn as the "virtual position" of the player is changed. With that, I really can't see a limitation on level size. Couldn't get it working but I haven't tried that hard, and I realise thats not an amazing explanation...

    Diagram may help:

    <img src="http://dl.getdropbox.com/u/1378330/Untitled-3.png">

  • Actually, roofs, treetop and stuff could be drawn on layer above, only including obstacles on base layer (where player is located). So, you'd use two-level array (or more if you include more levels). Then you draw additional stuff on these layers with offset, turn on/off for visibility etc.

  • I was thinking that if I make one city in one layout and trying to avoid NPCs from going anywhere, I would just set roofs in houses to opacity 0, and that if the player goes in, the roof's opacity becomes invisible or something. But of course, it does not apply to NPC since they wont need it. And if the town is big enough, then probably NPCs going outside of that map may be needed no longer.

    And if they do, I'd just make some kind of counter that:

    If NPC1 goes out of map1, then NPC1Outsideoftown=1 indicating that NPC1 is no longer in map1 and but in Map2.

    If Map2 is loaded, it checks which NPC has a value of 1 in the NPC1outsideoftown variable. Maybe I could make it a private variable. But I think that would be time consuming.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)