Tiens on 22/2/2011 at 01:36
We all know, that sometimes the only way to increase FPS in some stubborn room/street/square is breaking the space of our map/loading zone into separate parts (without dividing it into several loading zones), deleting through passages and making local teleports from one part to another. Usually the main objection to this method was that the player will cheat by teleporting into non-guarded areas for hiding from a chase by NPC-guards. But T3Ed can teleport NPCs to the area where the player is trying to hide. This method works into my own fan-mission "The Cabal: Furious Flames" and into "The Cabal: Knife to the Heart" by Nomad. Let's make it on a testing map:
[CENTER]TELEPORTING NPCs THAT ARE CHASING GARRETT (tutorial):[/CENTER]1) First of all, make a test map with two separate big rooms (room N1 and room N2). They are going to be your teleporting zones, so mark their "Entrances" somehow. Then create 3 teleporting Playerstarts and 3 Volumes. Two Playerstarts and two Volumes will be the teleporting portals, so make sure that you positioned them correctly: each Volume should cover the "Entrance" into one of the rooms, and each Playerstart should be very close to the "Entrance" (but NOT inside the teleporting Volume). I hope, it is clear, that if the teleporting Volume is in the room N1, then its relevant Playerstart should be in the room N2. Playerstart N3 will be "the point to return", so place it somewhere in the centre of room N1. Volume N3 will be the mark for non-patrolling section, so make sure that it surrounds room N2.
[CENTER]
Inline Image:
http://i56.tinypic.com/29yrxhi.jpg[/CENTER]
2) Add into room N1 several guards and create a patrol path for them. Then add to these guards the following scripts:
a) Name: "Teleport_Guard_To_Part1" - this script is to teleport guards into room N1, if they enter the teleporting Volume.
CONDITIONS:
- When linked volumes [Trigger Script: ToPart1] are breached by objects at the end of [MYSELF].
ACTIONS:
- Teleport the objects at the end of [MYSELF] to Destination Teleporter [Part1].
- Reset script conditions and actions.
b) Name: "Teleport_Guard_To_Part2" - this script is to teleport guards into room N2, if they enter the teleporting Volume.
CONDITIONS:
- When linked volumes [Trigger Script: ToPart2] are breached by objects at the end of [MYSELF].
ACTIONS:
- Teleport the objects at the end of [MYSELF] to Destination Teleporter [Part2].
- Reset script conditions and actions.
c) Name: "Guard_Goes_Back_To_Patrol" - this script is to teleport guards back to patrol after they calm down.
CONDITIONS:
- Logic [AND] operator:
-- Query if linked volumes [Trigger Script: AreaOutOfPatrol] contains the linked objects at the end of [MYSELF].
-- Logic [OR] operator:
--- When my alert state changes to [ALERTSTATE_GREEN]
--- When my behaviour state changes to [STATE_RETURNING]
--- When my behaviour state changes to [STATE_PATROL]
ACTIONS:
- Teleport the objects at the end of [MYSELF] to Destination Teleporter [BackToPatrol].
- Delay [0.01] GAME seconds.
- Reset script conditions and actions.
3) Now link all your guards with all volumes using Trigger Script Links and rename all the links according to the scripts. Also add Destination Teleporter Names into properties of all Playerstarts.
[CENTER]
Inline Image:
http://i55.tinypic.com/156qy5u.jpg[/CENTER]
4) Now it's time to take care about Garrett to teleport. Add Destination Teleporter Names into both teleporting volumes properties.
Now NPCs can follow the player, even if he run into a teleport. After teleporting guards will continue the chase. If the player hides, NPC will search for some time, calm down, teleport back to his patrol path and continue patrolling.
In general, that's all. It works fine in my mission.
However the script named "Guard_Goes_Back_To_Patrol" could be made more complicated (thanks to Nomad for this modification). If you want to delay the return teleport of guards until the guard is not in sight (I mean, until the moment when Garrett doesn't see the guard), then the script should look like this:
CONDITIONS:
- Fire this condition every [10] seconds of GAME time
- Query if linked volume(s) [Trigger Script: AreaOutOfPatrol] contains the linked object(s) at end of [MYSELF]
- Logic[NOT] operator
-- Query if this object is within view
-- Logic [OR] operator
--- While the AI is in the behaviour state [STATE GREEN ALERT]
--- While the AI is in the behaviour state [STATE RETURNING]
--- While the AI is in the behaviour state [STATE PATROL]
ACTIONS:
- Teleport the object(s) at end of [MYSELF] to Destination Teleporter [BackToPatrol]
- Delay [0.10] GAME seconds
- Reset script conditions and actions
Beleg Cúthalion on 22/2/2011 at 09:42
Very nice, thanks for that.
Quote:
c) Name: "Guard_Goes_Back_To_Patrol" - this script is to teleport guards back to patrol after they calm down.
CONDITIONS:
- Logic [AND] operator:
-- Query if linked volumes [Trigger Script: AreaOutOfPatrol] contains the linked objects at the end of [MYSELF].
-- Logic [OR] operator:
--- When my alert state changes to [ALERTSTATE_GREEN]
--- When my behaviour state changes to [STATE_RETURNING]
--- When my behaviour state changes to [STATE_PATROL]
ACTIONS:
- Teleport the objects at the end of [MYSELF] to Destination Teleporter [BackToPatrol].
- Delay [0.01] GAME seconds.
- Reset script conditions and actions.
So if Garrett ran into room N2 and the guards after him, when they lost him and wanted to return to their patrol, they would just vanish? Have you tried making them walk back to the teleport volume first and are there any problems?
Tiens on 23/2/2011 at 05:53
Quote Posted by Beleg Cúthalion
So if Garrett ran into room N2 and the guards after him, when they lost him and wanted to return to their patrol, they would just vanish?
Yeah, but sometimes they go back though the teleport while searching process, and then calm down in room N1.
Quote Posted by Beleg Cúthalion
Have you tried making them walk back to the teleport volume first and are there any problems?
I tried to do it, but I don't satisfied with results. In this case (after coming into teleport and teleporting to room N1) NPC simply forgets to start patrolling again. For me patrolling function is much more important then the way of coming back. So I prefer NPC to vanish.
T3Ed always gives you three different way to make the same thing, so I'm sure that there's a way to force NPC to do all this long way back (come to teleport and then go to patrol), but I really like the way as it works now. So I simply stop searching for a decision.
nomad of the pacific on 26/2/2011 at 15:29
Quote Posted by Beleg Cúthalion
So if Garrett ran into room N2 and the guards after him, when they lost him and wanted to return to their patrol, they would just vanish?
This would be why you might want to add the condition that the guard not be in sight before they vanish. If Garrett can't see them, it doesn't matter if they vanish. ;)
I want to thank Tiens for providing this script for me to use in "Knife to the Heart". Without it, I would have been very unhappy about splitting the Estate into two sections. :thumb:
jtr7 on 27/2/2011 at 23:04
What necessitated the need to split the mission? What limits specifically?
nomad of the pacific on 28/2/2011 at 01:12
Frame rates of 5 fps was too low. :p Long lines of sight and too many objects cut off only by portals was a burden to render. Splitting the level into three sections (and eventually two after I decided to drop the roof access) divided into isolated zones seemed to help greatly.
nomad of the pacific on 28/2/2011 at 20:03
Don't know. I never tried DUMPINTERNALPROPINFO. I don't know that property values affect frame rates, though. Trying to render too many objects does, and clear lines of sight through multiple zones means everything in all visible zones need to be rendered. After I replaced the Estate building with a static mesh, I was able to block off my zones and still have the whole Estate visible at all times. I couldn't do that when the Estate was built from BSP brushes. I needed a huge open brush to build it in and that brought my frame rates down to single digits. :p
Beleg Cúthalion on 28/2/2011 at 21:59
It has nothing directly to do with framerates, just with basically the only hard-coded limit that matters. I'm a burnt child in that respect and these values can more or less show you if it was really possible to have the two maps together. Anyway, that's probably for the smalltalk newbie thread or another more fitting.