Hello everyone… whoever might be visiting this site. I have been messing with a few things in QuakeC particularly the ability to seamlessly transfer the player to new locations without special effects. This has been done in a few doom maps and is very prevalent in horror games.
Examples:
- A player looks up to see something on the ceiling but when they look back down the room around them is totally different.
- Looking out of a window a continuous swarm of troops pass by (in reality it is only 3-4 enemies looping continuously)
- When the player walks down the hall in one direction the hall is endless but when he walks back he can return the way that he came
I showed the following gif on the Quake Mapping discord:
It was met with a lot of excitement but a question was raised, “How can we make sure the player is looking the right direction?” and that is how a new series of experiments involving directions were created.
What is the problem?
As always I am going to state the problem I am trying to solve first then what logic I employed to find a solution, the difficulties I faced and then the final solution I came up with.
So what was I trying to solve? This time. Multiple things. I wanted to understand if I can determine with a player is looking in a direction before triggering another entity. There are multiple ways to do this:
- Create a brush with a mangle and determine if the player is looking towards the mangle while touching the brush.
- Create a brush with flags that have directions (up, down, left, right, forward, back) and see if that player is looking in the selected directions.
- Create a brush that has a target. Determine if the player is looking at the target.
Each one of these has a potential problem. Let’s look at the pros and cons to each.
1. The brush with a mangle to look at
Pros:
- Super easy to set up for mappers
- Mappers can define their own tolerance
- One line of code for horizontal detection
Cons
- Looking up or down is difficult to get right due to the fact the pitch values change according to if the player is facing “left” or “right”
- Might be confusing if the mapper doesn’t direct the players to look in the expected direction
2. The brush with flags
Pros:
- This logic is fairly straightforward and provided by the makevectors function
- If configured correctly in a .fgd then this would be even easier for mappers to use
- Mappers can set the tolerance
Cons:
- Easier to set, harder to understand. Left, right, forward, and backward are relative terms and might be confusing without experience with the trigger
- Not as accurate. This trigger provides 24 (8*3) possible directions though
- Might have the same issue as #1. The mapper needs to direct a player to look in a direction regardless of where they are standing in the brush
3. The brush with a target
Pros:
- The mapper can make anything a target
- Might make more sense for the player to look at a symbol or object of importance to trigger an event
- The mapper can set distance and tolerance values
Cons:
- More steps to implement correctly
- More required settings for mappers
- Not compatible with vanilla QuakeC sources since it requires target2 (one to trigger and one for the direction detection)
To be continued…
This article is long enough. We have taken a look at the ideas behind the solutions I would like to investigate. In Part 2 I will go into what I did to solve the first of these trigger types and the issues I ran into while testing it.