NPC pathfinding

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

No one has asked James yet what game he's working on...
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Post by guo »

James, what game are you working on?

I have a question about nightlies. I want to use the new NPC pathfinding, but I've always used the current stable release. What should I know before switching over? Are there any risks?

Regards.
vvight.wordpress.com
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

The screenshot is just from a tiny test rpg using slightly modified versions of some of Fnnrf's free sprites.

I might make it into a real game later, you never know ;)

Nightlies are more likely to have bugs, so report them if you find any.

Make a backup of your rpg file before using it with the nightly, since the nightly makes some file format changes so you sometimes can't easily go back to the stable version after having used the nightly.

There is also a file named IMPORTANT-NIGHTLY.txt which lists some specific issues to be aware of.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Ah, I didn't recognise the tiles as Fnnrf's, and modifying the walkabout seemed like an unnecessary step for a test game!
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Post by guo »

Thanks,

Is it safe for me to use the nightly for regular work on my game? Is there any risk that it will be incompatible with a later stable version?
vvight.wordpress.com
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

If you edit your game with a nightly, it will be compatible with the next stable release
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

By the way, I'd wait for TMC's input on this, but supposedly dwimmercrafty will be released fairly soon, considering how many new features have already been included since callipygous. Might be worth waiting, depending on how long that'll actually be.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, I mentioned that I think we should do a release soon instead of waiting for all the animation stuff to be finished, because that might take a while.

There are some things that should be finished first (like, obviously, pathfinding; there's lots left to do on that).
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Post by guo »

Thanks guys. If Dwimmercrafty isn't far away then perhaps I'll just wait for the delicious pathfinding feature.
vvight.wordpress.com
Billiard
Slime
Posts: 9
Joined: Sun Feb 26, 2017 6:54 pm

Post by Billiard »

TMC wrote:Yes, I mentioned that I think we should do a release soon instead of waiting for all the animation stuff to be finished, because that might take a while.

There are some things that should be finished first (like, obviously, pathfinding; there's lots left to do on that).
Can you increase the size of walkabouts very easily for Dwimmercrafty, or will that also require an extreme amount of work? If you decide to increase it soon, please allow the size to be as large as easily possible. I know the whole engine is built around tiles that are 20x20 pixels, and larger walkabouts will have negative effects, but that won't affect my plans. You could add a setting for choosing different sizes.

I will try a daily build later to try this pathfinding feature:
https://bitbucket.org/rbv/ohrrpgce-svn/ ... 99b98ae15e

That description seems like a method for on-map battles, like in Action-RPGs (Zelda-Style). Am I misinterpreting what that is? Could you extend your pathfinding idea to allow enemies to follow your character and he can "splat" them? That would be a great addition to this engine! I hope I'm not misinterpreting it.

My idea is to have enemies follow you, and you and your enemies would each receive a few swipes before they die (a death would remove a walkabout from the map, possibly with a fade-out effect). The animations for the swipes won't need to be added because this method of battling would be an experimental setting. It would have a disclaimer that says "this battle method is experimental. I may or may not ever improve it. It's just for fun."
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

I have been doing some more work on the pathfinding.

Now with support for NPC collisions and zone collisions

Image

I also added some limits so that pathfinding doesn't grind to a halt on a giant map.

Right now I have the pathing limited to searching 30 tiles away from the NPC's current position, which prevents them from getting around some obstacles larger than that size.

Eventually I want to have an option to allow an NPC to override this limit, in case you want an NPC to be able to solve a complex maze on a gigantic map, fps-be-damned

Its also still super easy to bog down a map's speed by adding too many pathing NPCs all at once (see the map with 25 slimes in my gif. The gif recorder skips the slowdown, so it fails to capture how laggy that map is when I actually play it)

I haven't started profiling and optimizing performance yet, so hopefully eventually we will be able to have even more than 25 pathing NPCs all at once without problems, but we shall see.

@Billiard this could be used for an action rpg, but in my experience A* pathfinding is not actually what you want for most action RPG games. I recently re-played Zelda 3, and I don't think there was a single enemy in the whole game that used real pathfinding. Many would run towards you, but they would always get stuck on walls if you could get a wall between you and them. Most other enemies moved in fixed patterns.

EDIT:

Oh, and I also added some internal debugging tools to visualize the pathfinding search, which was helpful in spotting a few of my mistakes

Image
Last edited by Bob the Hamster on Fri Jun 02, 2017 10:17 pm, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Debugging is fun when you have test games like you to play with!

Hmm, I guess that gif shows "Press Ctrl-F12 to stop recording" because of the way that the A* debug works; it's not meant to happen normally. So I don't need to fix anthing
Billiard wrote:Can you increase the size of walkabouts very easily for Dwimmercrafty, or will that also require an extreme amount of work? If you decide to increase it soon, please allow the size to be as large as easily possible.
There won't be any size limit (well, maybe 1024x1024 or something like that).

Doing a stable release won't have any significant effect on when this is all implemented. As soon as animations are ready, I definitely will want to do another stable release; but you could just use nightlies until then.

I don't know whether larger sprite sizes would make it into Dwimmercrafty, but the idea was not to wait for that.
That description seems like a method for on-map battles, like in Action-RPGs (Zelda-Style). Am I misinterpreting what that is? Could you extend your pathfinding idea to allow enemies to follow your character and he can "splat" them? That would be a great addition to this engine! I hope I'm not misinterpreting it.
You misinterpreted it; that is a test game, it's not part of the engine. However, it shows that this sort of thing can be scripted without much trouble (as you can see, the "try to splat" script is very simple). someone should create a set of free scripts for creating zelda-likes, like Mogri's SideSidescroller 101 scripts which have been used to create many side scrollers.
I don't think it makes sense to add engine built-in features for zelda-likes right now. But after battlescripting is added, it would be cool to try to allow creating NPCs which can be treated like in-battle enemies with stats, so that attacks can be used on them (like how the "map cure" command already allows using attacks on heroes out of battle).
But it's certainly not necessary, in fact it would barely help you script a zelda-like.

We haven't explicitly said what license the scripts for the test games are under, but we should probably release them into the public domain (like the default resources are (all the existing music is public domain, although we allow CC too)). I'm certainly happy to release all the test games I've added as public domain. The exception is autiotest.rpg, which mostly contains public domain music, but also has a file by Mr 8bit and a couple files under the ModArchive Distribution license, which allows redistribution as long as it's "unbundled"... so it looks I might be in the wrong there.
Last edited by TMC on Sat Jun 03, 2017 8:31 am, edited 2 times in total.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

TMC wrote:someone should create a set of free scripts for creating zelda-likes, like Mogri's SideSidescroller 101 scripts which have been used to create many side scrollers.
I once used those scripts to make a top-down game ;)
Last edited by kylekrack on Sat Jun 03, 2017 9:36 am, edited 1 time in total.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I never realised. Yes, they're pretty flexible.

I'm not sure whether Billiard wanted pixel based movement or not. (If not, then there's not much to script.) I guess the SS101 scripts are a half decent place to start if you want to create a Zelda-like with pixel-based movement.
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Post by guo »

I'm getting major slowdown with just 3 pathfinding enemies on a map. It is a rather large and complex map, however.

Also, I'd love an option to set how far an NPC can "see" before it starts following the player.
Last edited by guo on Thu Jun 08, 2017 4:27 am, edited 1 time in total.
vvight.wordpress.com
Post Reply