Jump to content
The Dark Mod Forums
jaredmitchell

Pathfinding on moving platforms?

Recommended Posts

Hey there,

I'm writing this with egg on my face. Basically put, the level I'm currently working on depended on the assumption that I could get AI patrolling and pathfinding on moving platforms. Unfortunately I think I misremembered what TDM can do, as I've quickly found out that monsterclip brushes need to be worldspawn. Does anyone know a way around this, a way to achieve a similar effect, or am I just shit out of luck?

The concept of my map centers around a ship moving through a multi-lock canal; the player is supposed to sneak onto the ship while it's moving, steal an item off the ship, and then get back onto shore. My assumption is that having enemies on the boat would require the aas32 data to update. This is the map I've been streaming the making of, if it helps to have a sense of how far in I am.

I've been messing around with small experiments in test maps to find a workaround or hack, but I've been unsuccessful. I tried looking at using aas_obstacle brushes, but they only seem to generate walls for AI, and not a walkable surface (despite them being used as such in this example on the wiki).

Push comes to shove I can just have the ship docked and static throughout the mission, but I feel like that's not as fun. Any ideas?

Share this post


Link to post
Share on other sites

It is true that simple pathfinding across moving platforms is limited to elevators. But this is based on the AI standing still and letting the elevator platform carry him to the destination floor. Probably not what you want. All AAS areas (defining the scope of pathfinding for an AI) is nailed down by dmap (AAS boundaries, reachability tables, traveling times, etc.); there's no functionality that lets you move the pathfinding info dynamically in-game.

An alternative is to make your ship static and make everything else around it non-static. See "Swing" for example. People have worked on moving trains (though I don't remember a released mission with this design) where the scenery outside the static train moves backward, giving a sense of moving forward.

Share this post


Link to post
Share on other sites

It might be possible to take that suggestion and teleport the player to/from an alternative version of the ship, hiding the transition either with a cutscene/fade or by making sure the player is somewhere that won't have jarring views. This gets increasingly complex the more thorough you want the illusion to be (positions of AI, moveables...), but I think Illusionist's Tower used teleporters to create the impression of a non-Euclidian layout.


Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites
17 hours ago, VanishedOne said:

It might be possible to take that suggestion and teleport the player to/from an alternative version of the ship, hiding the transition either with a cutscene/fade or by making sure the player is somewhere that won't have jarring views.

I've thought about the teleporter idea, but I don't know how viable it is, given that the player can jump off the side of the ship into the water from any point on the top decks. If there's a trigger or set of triggers that could be attached to the ship, and I could get the offset of the player from the ship's center, then maybe.
 

21 hours ago, grayman said:

It is true that simple pathfinding across moving platforms is limited to elevators. But this is based on the AI standing still and letting the elevator platform carry him to the destination floor. Probably not what you want.

Do they have to be absolutely still while the transition happens? I ask because in the context of the canal, the ship only moves vertically at a couple of different spots. I made a diagram for my design doc:

340697197_CanalDiagram.png.1195c0958c05fde559fc8ded6068f70c.png

The elevator wiki page is ambiguous, but it gives me the impression that both the AAS solid and AAS obstacle brushes used form an invisible floor at each stop for the AI to walk on. If so, my thinking is that I could just have a few planes of AAS brushes and selectively toggle them as the ship progresses:

761658351_CanalDiagramw_AAS.png.90e1cab16138c4c491c9180efa796f82.png

Is this viable?

EDIT: Should mention that the proposed solution above would be paired with AAS obstacle entities lining the perimeter of the ship that would move with it, in order to prevent AI from walking off the sides of the ship or bumping into the walls. I'm assuming you can set the AAS obstacle entities' position, as I've been successful in doing that for the func_liquid volumes that will form the water of the canal.

Edited by jaredmitchell
Forgot to add some detail to my explanation

Share this post


Link to post
Share on other sites

It's not just the pathfinding, it's also the visportalling. I don't see any way to move the latter especially.

There's possibly a way to make your idea work: I'm also making a ship mission, in which I've split the exterior from the interior and transfer the player between them via script. The great advantage of this is you can build your interior without being restricted by the exterior; a further advantage in your case is you can turn your ship exterior into a func_static.

You have 2 options to transfer the player:

A ) frobbing a door teleports the player. You may want to handle what happens if the player is being pursued by an AI (level 5 alert). The easiest solutions by far and away are to either make an objective not to get spotted by ship AIs, or to do nothing. Most people quickload anyway when they get spotted.

B ) use rooms in which the teleport happens. It's very tricky to teleport AIs without disturbing their behaviour, so these rooms should be AI-free. I'd recommend option A therefore.

That leaves the issue of pathfinding on the moving ship exterior. I've experimented with dynamic pathfinding while setting up my stagecoach and came to the conclusion you can only have dynamic walls, but not dynamic floors in pathfinding.

On the horizontal plane this should be easy enough: you can use a very long (permanent) monsterclip brush for each deck as well as for the ship's sides (east-west). You can then then use AAS obstacle to limit north-south movement: depending on what works either bind it to the ship or toggle a series of AAS obstacle walls.

The vertical plane is an issue, because to my knowledge you can't have dynamic floors. My suggestion here would be to use only archers on the ship exterior as they don't need to move between decks to attack the player.

Archers will also come in handy when the ship is moving downwards, as they'll have to stand still in this phase.

Edit: An issue that remains is how to move the AI forward while they're patrolling on the ship. You can't bind AIs to something, so in my stagecoach I've used a func_mover monsterclip brush to push the AIs forward (named stagecoach_pusher, see either mission in Down by the Riverside). You may need to use a script to continually update the position of such a brush behind each AI  as they move around. I haven't tried if this works.

Edited by Dragofer
  • Like 1

Share this post


Link to post
Share on other sites

A far easier option would be to show a short cutscene each time the ship moves and have a set of permanent monsterclip at each position of the ship's journey. The ship would spend most of its time in the water elevators anyway, and the water level doesn't really change perceptibly here. You'll need to combine this with the interior-exterior split described above.

Share this post


Link to post
Share on other sites
22 hours ago, Dragofer said:

There's possibly a way to make your idea work: I'm also making a ship mission, in which I've split the exterior from the interior and transfer the player between them via script. The great advantage of this is you can build your interior without being restricted by the exterior; a further advantage in your case is you can turn your ship exterior into a func_static.

You have 2 options to transfer the player:

A ) frobbing a door teleports the player. You may want to handle what happens if the player is being pursued by an AI (level 5 alert). The easiest solutions by far and away are to either make an objective not to get spotted by ship AIs, or to do nothing. Most people quickload anyway when they get spotted

Oh, that's smart! I think that might work. I was assuming prior that the exterior would be part of the off-stage recreation.

As for getting the pathfinding working on the exterior, my concern is that the monsterclip brush seems to form collision, not just AAS data, so I don't know if there's a way for the guards on the deck to "sink" through to a lower level when the ship changes locks. I think I can fictionalize reasons why there wouldn't be any crew outside, so I'm not too concerned.

Anyways, thank you! I think I have a way forward now.

Share this post


Link to post
Share on other sites

@jaredmitchell you're welcome, and I think VanishedOne was thinking of something similar to this.

Re monsterclip floors: the way it works is if you have a freefloating monsterclip platform AIs will sink down ~34 units as they walk across it. If there were a solid func_static surface (i.e. a grass patch) within 34 units above the monsterclip platform they'd instead walk over that.

 

I'd do the vertical movement in the locks by having the ship make 2-3 small 'jumps' accompanied by a very brief fadeout (if the player's outside), with monsterclip at each stage.

The horizontal movement from lock to lock could be done via the sequential AAS obstacle wall method described in my first post. An alternative is a cutscene, but can cause problems if it happens just as the player was making a dash across a brightly lit area.

Share this post


Link to post
Share on other sites

What about moving the world and not the ship? I remember playing, Life Is Strange, and on it there's a bus ride, to me looked like the bus was moving but in the making off of the game I saw that they moved the world instead?! 

How would you make the AI "walk" on your moving world? If you wanted people to walk about in the streets, you could make them into idAnimated entities (not idActors so no AI) and have them play a walk animation in place, bind them to a func_mover (idMover) and move that around (at different speed to the world), simulating AI walking around. Of course this expects the player to never be able to left out the boat or ship. 

Share this post


Link to post
Share on other sites

The tricky part is that he wants both the ship and the world to be playable space. What he's settled for is to move the ship's interior to another part of the map and delete all exterior AIs so that the whole exterior can be made into a moving entity. Teleportation takes place when entering transition zones around the entrances to the ship interior.

Though personally I'd have used Skyrim-style doors that open just a crack before fade out & teleporting, because it'd seem a lot of trouble to get a correct representation of a constantly changing scenery beyond the transition zones to avoid jarring visuals when the player is teleported.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...