PDA

View Full Version : Magic Octroks can't find the bait



Joeiiii
12-28-2018, 03:24 PM
Hi! :smile-new:

If I put a bait on the screen, that octroks comes to it (as it should be). But if anything is between the bait and the octoroks, a tree, a stone or whatever, they can't find the way. And that even, if the bait is only two tiles away.

https://abload.de/img/fleisch-problemzodyz.png

It stays as seen on the screenshot: The right-sided octoroks stays on the right side of the tree and NEVER come to the bait.

What can I do (except removing all barriers)?

Chris Miller
12-28-2018, 08:18 PM
About all you can do is move the bush. Someone with more scripting knowledge might know a way, though.

Joeiiii
12-29-2018, 04:51 AM
Normally they find the way to the bait:

https://abload.de/img/fleisch-problem2ihe0i.png

Pic 1: The enemies are anywhere.

Pic 2: I put the bait on the screen and they come from wherever they were before.

Pic 3: Normally it also works with octoroks (if hunger is set)

ZoriaRPG
12-30-2018, 06:35 AM
It all depends on pathing. ZC Enemy AI isn't that advanced. Remember that the screen layout is pretty much defining a 3D object, in a 2D space. That#s a tree, not a bush, and its intended scale is a depiction of a forest patch.

In ZC, even if the Octorock was attracted to the bait, it'd hit the solid combo, and change direction.

It would be possible to write more advanced pathing as an npc script, but believe me, writing realistic pathing routines is absolute hell.

You can try tinkering with both the enemy step speed, and the hunger value. One issue with high step, is that the read-ahead for a solidity check is at a greater distance.

Joeiiii
12-30-2018, 01:26 PM
writing realistic pathing routines is absolute hell.
What is the problem? The bait is anywhere and the enemies too (elsewhere). And between the enemies and the bait a tiles. Solids and others.

https://abload.de/img/fleisch-problem3rdcia.png

Ok, a single fast way doesn't always exist, because it doesn't matter if the octrok for example goes down, left, left, left, down, left OR left, left, left down, left, down OR down, down, left, left, left, left... or whatever. The route is the goal.

A magic octorok can kill you in a few seconds, but a tree between the octorok is a problem? :smile-new:

Saffith
12-30-2018, 02:53 PM
The bait is to the left, so it tries to go left. It can't, so it goes down instead. Then it sees that the bait is above it, so it goes up. Then it sees that the bait is to the left, so it tries to go left, but it can't...

Proper pathfinding would be a lot of work, but randomly choosing between the vertical or horizontal direction when moving toward bait would be enough to mostly solve this simple case. I don't believe the NES version does anything like that, though. And a column of two or three trees could still be an issue.

ZoriaRPG
12-31-2018, 08:35 AM
What is the problem? The bait is anywhere and the enemies too (elsewhere). And between the enemies and the bait a tiles. Solids and others.

https://abload.de/img/fleisch-problem3rdcia.png

Ok, a single fast way doesn't always exist, because it doesn't matter if the octrok for example goes down, left, left, left, down, left OR left, left, left down, left, down OR down, down, left, left, left, left... or whatever. The route is the goal.

A magic octorok can kill you in a few seconds, but a tree between the octorok is a problem? :smile-new:

In software logic, valid paths look more like this:

http://timelord.insomnia247.nl/zc-dev/2.55/paths.png

Each of those arrows is a valid node, from which you derive coordinates, and movement to go from A to B. In theory, the object (circled) may never reach B, because it can walk an infinite path. That's where logic such as A* helps:

That's an algorithm to resolve stuff like this, but it isn't perfect, and implementing it is a complex process.

Joeiiii
12-31-2018, 09:35 AM
In software logic, valid paths look more like this:

http://timelord.insomnia247.nl/zc-dev/2.55/paths.png
Where is the logic?

The command should be (and in the most causes it is so): There is a bait in the left corner. Find the fastest way and run like hell!

The last picture is an extreme example with 15 solid combos. It should bei never a problem, but in my quest a single tree is the problem.

OK! If it can't solved, it is so. :smug:


Another question: What does "duration = 768" in the bait-item means?

Saffith
12-31-2018, 09:39 AM
That means the bait will disappear after 768 frames, which is 12.8 seconds.

Asuna Yuuki Nagato
01-20-2024, 03:53 AM
I believe this has been implemented in resources/include/std_zh/astar.zh:


// Credits to Lejes for making the A* algorithm actually work in ZC! I probably wouldn't have ended up making my version (which is older than this) work without the assistance!
// Optimised for 2.55 on 24th May, 220 by ZoriaRPG.

I'm impressed that Zoria implemented this all the way back in 220 AD. Tell me, can I borrow your time machine?