How to make non turnbased movement

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Gunroar:Cannon()
Party member
Posts: 1088
Joined: Thu Dec 10, 2020 1:57 am

Re: How to make non turnbased movement

Post by Gunroar:Cannon() »

It's ...adjusted :crazy:

(E.g in Dust)
Enemies find a path to a place a certain distance away from you,
Enemies find a path to a place a certain distance close to you,
Enemies find a path away from you when they're running away,
Enemies refresh paths so they'll move around while attacking.

I get what you're saying though, even with these over the top path juggling it can get like that, though I find it necessary if you need your AI to do more than attack the player (like go find something in level, track down the player, etc).

And nice approach to the collision thing!
BrotSagtMist wrote: Mon Jun 06, 2022 11:29 pm, trails are cool for various stuff.
Couldn't be truer! :rofl:
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
togFox
Party member
Posts: 779
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: How to make non turnbased movement

Post by togFox »

If you want A* then construct your map first, accounting for widths, then invoke the jumper lib.

If you're looking for something more random then invoke jumper multiple times and queue all the waypoints for execution in sequence.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: How to make non turnbased movement

Post by milon »

BrotSagtMist wrote: Mon Jun 06, 2022 11:29 pm ...
Best method i found is to have precalculated pathways like a tree. This allows for enemies to eg avoid you just to reappear from behind.
Sounds like you're talking about Dijkstra Maps.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
BrotSagtMist
Party member
Posts: 613
Joined: Fri Aug 06, 2021 10:30 pm

Re: How to make non turnbased movement

Post by BrotSagtMist »

I certainly do not talk about fancy made up words, i talk about a tree, does that look like a tree? No.

The tree idea performs poorly on an open field or for following you.
You will need a "find the goal" game type. From that goal you create a path and save each step of that bound to the tile.
So say if you are on tile [3][3] this tile returns its next piece [3][4].
From any tiles on that path you create additional paths, branches, from that sub branches etc until the map is covered.
Enemies follow you by trying to get on your branch and from there simply follow it.
The catch is that for most of the map the enemy will take the way over the main path to reach your branch. Also you cant see these branches. This means that instead following the enemy may try to reach the goal first on a side track next to you, then turns around and blocks your path.
Then if you flee, it goes anywhere into the map for no reason BUT reappears on the same spot if you try that route again.

Or in other words: Imagine a rectangle with you in the upper left and the goal in the lower right, lift/down corners are the main path, the other the branch. A normal AI will chase you around this block, but this branch type will have it turn back to the goal as soon as you try to lure it away. Effectively making it impossible to outsmart it in this scenario.
obey
User avatar
Gunroar:Cannon()
Party member
Posts: 1088
Joined: Thu Dec 10, 2020 1:57 am

Re: How to make non turnbased movement

Post by Gunroar:Cannon() »

:rofl: Brogue uses Dijkstra maps to a good effect.

Does this branch method work on procedural Maps?
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: How to make non turnbased movement

Post by milon »

BrotSagtMist wrote: Tue Jun 07, 2022 10:39 pm I certainly do not talk about fancy made up words, i talk about a tree, does that look like a tree? No.

The tree idea performs poorly on an open field or for following you.
You will need a "find the goal" game type. From that goal you create a path and save each step of that bound to the tile.
So say if you are on tile [3][3] this tile returns its next piece [3][4].
From any tiles on that path you create additional paths, branches, from that sub branches etc until the map is covered.
Enemies follow you by trying to get on your branch and from there simply follow it.
The catch is that for most of the map the enemy will take the way over the main path to reach your branch. Also you cant see these branches. This means that instead following the enemy may try to reach the goal first on a side track next to you, then turns around and blocks your path.
Then if you flee, it goes anywhere into the map for no reason BUT reappears on the same spot if you try that route again.

Or in other words: Imagine a rectangle with you in the upper left and the goal in the lower right, lift/down corners are the main path, the other the branch. A normal AI will chase you around this block, but this branch type will have it turn back to the goal as soon as you try to lure it away. Effectively making it impossible to outsmart it in this scenario.
You're funny Brot. You basically just defined Dijkstra maps. ;)
Dijkstra is ultimately a pre-calculated set of this-node-leads-to-that-node directives that lead to a given goal(s). It can be a simple tree structure (read far enough down the link to see clearer examples), or a more complicated field with multiple goals.
But call it whatever makes you happy.
Gunroar:Cannon() wrote: Tue Jun 07, 2022 10:49 pm Does this branch method work on procedural Maps?
I don't see why not. Once you generate the map you can compute whatever path branches you desire.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
BrotSagtMist
Party member
Posts: 613
Joined: Fri Aug 06, 2021 10:30 pm

Re: How to make non turnbased movement

Post by BrotSagtMist »

That looks/sounds nothing like the page you linked. Its rather the complete opposite.
Also i refuse to define anything.
Gunroar:Cannon() wrote: Tue Jun 07, 2022 10:49 pm Does this branch method work on procedural Maps?
Last i used this i applied the map generation directly to the paths. I simply recycled data junk.
obey
Post Reply

Who is online

Users browsing this forum: No registered users and 239 guests