Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee

Thread Rating:
  • 5 Vote(s) - 4.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Third Person Perspective (VIDEO); roughly explained
fenjer Offline
Junior Member

Posts: 1
Threads: 1
Joined: Sep 2013
Reputation: 4
Third Person Perspective (VIDEO); roughly explained

Better than expected, not perfect, but does its job on very acceptable level.
In-game footage shows basic functionality of script incorporated with usual events and situations.
Created with original ATDD tools (plus Justine update).

For those interested, here is rough explanation for important and less obvious things about the script:

--> Position and Direction
Spoiler below!

Six invisible move objects surround the player and have collision callback set with him. Objects are grouped in three pairs where each pair moves straight along one of three axes and each member of pair represents direction (+, -) of this axis. Due to linear movement of objects, for the best results, camera must exclude rotation over Y axis to ensure straight player movement along each axis and straight diagonal when moving along two neighbor axes.

In collision callback function, according to the collided object, position value for this axis is updated and this object together with his pair is instantly moved to next position. Since position of objects is controlled through the script and since objects constantly surround the player, position of objects is the same as position of the player.

Direction of facing is determined according to object/s player recently collided with.

--> Body and Rotations
Spoiler below!

Character body is an invisible Wheel entity that is pushed around the map to follow the player. It consists of two movable bodies connected with joint. First/main body represents character body and is on the position of the player, while second body is pushed body and is positioned certain distance below (always below lowest map point).

In game, second body is surrounded with six invisible move objects (same as position colliders) and their job is to push second body, thus moving entire entity around the map. Objects position is updated according to change in player position. With character attachment, this entity gives an impression of being the actual player, while default player body is used on usual way, for collisions, triggers and movement.

Character rotation is calculated from direction that character is facing. There are only eight possible directions/rotations. Since character body entity type is Wheel, SetWheelAngle(...) is used to rotate character (first body).

--> Character Attachment and Animations
Spoiler below!

Player Character is regular static object with body. Attachment on character body is performed using AddAttachedPropToProp(...) and RemoveAttachedPropFromProp(...).

Animations are played using PlayPropAnimation(...) where the name of entity is the name of attachment. Walking animations are determined from player movement speed which is constantly checked in core fast-looping timer. Each animation (idle, walk, run) is active when player speed is inside certain range. Other animations are played according to what happens to player (hurt, free fall; also checked in timer) or player wants to do (performing an ability).

--> HUD
Spoiler below!

It is achieved by directly accessing billboard-light connection inside player_hands entity. Hand model is modified to contain one static joint for the purpose of easier control and billboard placement. All billboards with their corresponding PointLights are attached to this joint. In scripts, when needed, lights are faded in order to show/hide each image. This is not compatible with saving, so it has to be refreshed constantly or instantly once game is loaded.
Following logic in naming must be used: [name_of_entity]_[name_of_effect] (eg. box_1_Sound_1).
Example for HUD: FadeLightTo("PlayerHands_PointLght_interaction", 1, 1, 1, 1, -1, 0.25);

The same method is used to show items in player character hand.

--> Input
Spoiler below!

Three critical inputs (Perform Action, Change Character, Change Item/Ability) are achieved by manipulating usual Amnesia action, grab-hold-throw a box.

Invisible entity (Object-Slide) consists of two bodies connected with Slide joint (minimum slide distance) where first body is movable and meant for interaction, while second body is static and meant for keeping entire entity to float in the air. In level, object is scaled so the first body covers entire player area of interaction and also its Y position is set high enough so the entity is constantly in player focus of interaction. Very thin script area is placed on the edge of first body, in normal conditions these two collide. In scripts, interaction callback is set with entity and collision between entity and area.

On button press, interaction callback is triggered where two timers are set. First, fast-looping checks if player is still interacting with entity (GetPropIsInteractedWith(...)), second timer counts for about a second. If player releases the button before second timer counts zero, Perform Action is performed. If player holds button when second timer triggers, Change Character is performed. If player while holding the first button presses second button, he will apply some force to interacted body which will cause it to move, exit thin collision area, trigger collision callback and Change Item/Ability will be performed.
To help reliability and response, player must stand still while performing this.

Special input (eg. show hint, re-spawn player) is done through the inventory. Consumable items (Item-Sanity) are given to the player and their existence is checked (HasItem(...)) in core fast-looping timer. If player doesn't have any of them, intended action is performed and item again given to the player.

--> String Variable List
Spoiler below!

Since script uses alot of data that needs to be saved, in order to keep system compatible with game saving, variable values are stored inside some kind of string variable list with delimited text (eg. 100;0.5;ps_hit_wood.ps;hit_wood.snt; ). To extract the content of variable, script takes its content and separates elements according to delimiter ( ; ). Text that contains numeric values is than passed to another function that converts it into numbers. When necessary changes are made, all the elements are again stored inside the same variable.

--> Initialization and Handling of Interactions
Spoiler below!

Each object that is affected by script must be manually initialized. It doesn't mean every single object in the map, but only those reachable by player. Good organization, logic in naming, use of script areas (for grouped objects, eg. shelf with stuff) heavily simplifies this process.

Script function for initialization takes a bunch of parameters, among which: entity name, entity health, maximum damage applied by certain attack, maximum impulse given by certain attack, sounds and particles created when object is hit/broken, callback function and some other script specific elements. This allows good degree of basic customization, stays loyal to physics and effects behavior and also allows endless possibilities with use of callbacks.

Each initialized object consumes two string variables. First variable contains entity name, and name of variable contains distinctive index number (starts from 1 and increases for 1 for every next entity) (eg. GameplayEntity_43). Second variable contains all other settings and is organized as string variable list as described above. Name of this variable contains the name of entity (eg. box_8_Settings).

Invisible entity named attach_point is situated in the center of map and is used for attaching various invisible colliders. Colliders are attached according to player position, direction/rotation and certain offset from player center to simulate player area of interaction (normally straight in front of him). Abilities that work on distance use multiple colliders which are attached one after another with certain delay. Particle system for these is attached on each collider and is edited (speed and life) to give impression of continuity.

In for-loop (from 1 to maximum entity index number) GetEntitiesCollide(...) between collider and each initialized object is used to determine with which object player tries to interact. Then, for all positive results, content from variable with entity settings is extracted, necessary modifications are made and new values stored.
For example, an attack ability on positive result will, depending on previously set settings, give some damage to the objects, apply some force to them, play corresponding effects (sound, particles) and trigger intended callback function.

Some abilities use this kind of checking, while others are performed directly on player. Physics engine and smart approach allow good variety of possible abilities. Each ability on start/end of use calls callback function which can be used for adding extra elements.

Underwater ability is controlled with move object that carries the player and moves him in up/down direction. Due to simplicity of use, movement happens continuously while player switches direction by pressing the button. To detect lowest point, collider move object is used. Object collides with player and moves the same as first object. Few moments after player reaches the bottom, collision will be broken and movement of two objects towards down will stop. For highest point, script areas are used. When player hits an area, objects movement towards up stops. Surface is detected when first object reaches its starting position. At that moment, player from diving switches to swimming.

--> Movement Effects and Camera Altering
Spoiler below!

Default step sounds are removed in order to give distinctive set of step sounds to each character. Step sounds (walking, running) are events inside character animation, and sounds played on that way allow perfect synchronization with animations. For better feeling of surface player is walking, script includes predefined movement mods (eg. dirt, snow, liquid spill, etc.). According to player movement speed, surface specific sounds and particle systems are played on character body on certain rate. Wanted map area is covered with script area which name includes keyword (eg. movement_mod_area_dirt_1) that allows script to determine which effects to use.
An addition to script is support for multiple speed multipliers. Script adds/removes multipliers inside a variable list and uses the lowest value. This ensures free change of player speed without affecting the main script which also requires speed manipulation. Some surfaces (eg. water, snow) also include change in player speed.

Script takes default camera position values which are used in normal situations. For the purpose of better visibility, camera position must be altered. Wanted map area is covered with script area which name contains wanted values (eg. player_camera_;0;8;-2;_1). Script extracts position elements from name, converts into numbers and adjust camera accordingly.

--> Enemies
Spoiler below!

Script keeps logic of enemies that react on light and noise level. Lights are not problem because player body is on the same level as enemies. When it comes to sounds, enemies react on sounds which name starts with step or impact. Step sounds are not played on player body, but player camera, which is not good. Since default step sounds are removed, and rather played as events inside character animation (and played on player character), this is not an issue. Sound that makes enemies react and forces them to investigate the source is short silence (impact_silence.ogg). Snt files use this sound, volume is set to maximum, 3d options enabled and min distance = max distance is set to wanted value. Snt file is played on character body for each ability where hear distance is based on loudness of certain ability.
Function for entity initialization takes parameter that specifies if an entity is enemy. Louder abilities (eg. attacks) if performed near an enemy will instantly turn him into hunt (ShowEnemyPlayerPosition(...)). At the moment when ability is performing, invisible sphere collider is attached on player position and is used to check if an enemy is nearby.

Enemies can be hurt and killed, but only if impact force is applied on them (eg. throw box). When hurt, enemy will stop for a moment and Flinch animation is played. When killed, enemy is disabled and Dead animation is played. When involved, these two improve enemy presentation and make fighting more enjoyable. To provoke this states, two invisible thin entities are scaled to cover entire area of enemy movement. First entity (for hurting) has small damage value set under User Defined Variables, and second (for killing) has damage value set higher than enemy maximum health. When an used ability hurts/kills enemy, previously set callback function is triggered where corresponding entity is enabled and minimum impulse given by y+ axis. This will cause an impact on enemy and intended state will be achieved. In the next step, entity is disabled and reset.

--> Cinematics (in video)
Spoiler below!

Sticky areas are very powerful tool when it comes to simple cinematics. They allow movement and rotation in any direction and come with proper set of script functions. Event in the end of video with grunt and dogs is completely scripted and controlled as timed event. Sticky areas are used for object transformations while other corresponding functions for playing animations and effects. While enemies poses no threat for player, their appearance is convincing and under full control. Such an event is easy to spoil which makes its implementation difficult, but something simpler (rock worm fight from Penumbra) or something that happens outside of player reach can be nicely done.

If you are interested in more non-generic Amnesia, try my custom story, Where Is The Cuprite.
(This post was last modified: 10-03-2013, 02:07 PM by fenjer.)
09-26-2013, 09:50 PM
Paddy™ Offline
Posting Freak

Posts: 1,351
Threads: 43
Joined: Feb 2012
Reputation: 224
RE: Third Person Perspective (VIDEO)

I have no words to describe how fantastic this is. I see huge potential here.

Do you plan to do anything more with this idea?
09-26-2013, 09:57 PM
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
RE: Third Person Perspective (VIDEO)

waw xD
ah ahahahahh the guy jumping. Good job.
Looks like a lot of work!

How do you control the character?

(This post was last modified: 09-26-2013, 10:10 PM by Daemian.)
09-26-2013, 10:09 PM
DnALANGE Offline

Posts: 1,549
Threads: 73
Joined: Jan 2012
RE: Third Person Perspective (VIDEO)

W O W !!!
This might actually be VERY playable!
Maybe Jens or Patrik should look at this, they will be amazed as well!
How did you do this?
offcourse with a FC, but some more info?
Like the interface with the iceons down there?
Are those huds, only thing i can think off!
This is So cool!
Only maybe a LITTLE closer to the player : the less you see the scaryer.
It's an idea!
+++ For this guy!
09-26-2013, 10:24 PM
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
RE: Third Person Perspective (VIDEO)

Seriously, how did you do this? Amazing idea, but can you really key-callbacks?
Really amazed here

Trying is the first step to success.
09-26-2013, 10:36 PM
Change Offline

Posts: 50
Threads: 3
Joined: Sep 2013
Reputation: 1
RE: Third Person Perspective (VIDEO)

16 views?, give it a few of days and I bet this will be in the hundreds of thousands.

Are you planning on making this an add-on or standalone? I really want to play this.

09-27-2013, 12:24 AM
Kman Offline
Posting Freak

Posts: 4,187
Threads: 25
Joined: Jul 2011
Reputation: 219
RE: Third Person Perspective (VIDEO)

cool stuff

could be cool if you did some sort of thing where you have to hunt daniel as the monster

Posting Freak
09-27-2013, 12:42 AM
Website Find
Quizerno Offline
Junior Member

Posts: 39
Threads: 1
Joined: Jun 2011
Reputation: 2
RE: Third Person Perspective (VIDEO)

I've never been a fan of the top-down perspective style, but goddamn that is good work. You camera moves smoothly and the hud looks natural.

Good going.
09-27-2013, 12:46 AM
Yuhaney Offline
Hello Friends!

Posts: 3,466
Threads: 100
Joined: Mar 2007
Reputation: 64
RE: Third Person Perspective (VIDEO)

I would love to see their new game use this perspective.

09-27-2013, 01:56 AM
Website Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
RE: Third Person Perspective (VIDEO)

I'm more concerned with how the hell did you make a custom HUD? Still, so cool, had no idea it was possible.

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
09-27-2013, 02:56 AM

Users browsing this thread: 1 Guest(s)