Report article RSS Feed Interaction System

One of the biggest systems in From Earth is the complete overhaul of how weapons and items work in Source.

Posted by Au-heppa on Feb 3rd, 2013

If you haven't heard about From Earth before, read the outline of the project here.

One of the biggest systems in From Earth is the complete overhaul of how weapons and items work in Source. Early on I completely discarded the default weapon classes, removed all their references from the source code, and started working on my own. I even completely removed viewmodels, since I render the player's world model even in first person.



Redoing the weapon and item system was necessary, because how differently I needed to do things. Item have functions, such as pressing the trigger, or pushing buttons in them. The player character, however, doesn't always know what they do. The player can examine items, and see all the different buttons and triggers on it, and which mouse and keyboard keys activate them. I needed to integrate all the data about the buttons, and how they should be visible in the HUD during the examination, into the models and the item base class.

I also wanted to have pick up, drop, holster, and deploy animations so that you can see the player character place the item on her magnetic belt. This meant I needed to handle the way weapon animations work, and have different states for when the item is being picked up and so on.

Not only does the player entity handle items differently, but NPC's handle them differently as well. In Half-Life 2, the way most weapons are used by NPCs, is coded into the NPC's AI, and usually are limitied to playing a single animation for pressing the trigger. In From Earth I needed to be able to do something little more complicated in case of some of the items. Each item can have their own specific instructions when or in what kind of situations the NPC can use the item, how to use it, how to run the AI task and which animations to play.

It's pointless to do redo work you don't have to, but sometimes better to start from a scratch than to work on top of someone else's code. If I would have used the existing weapon classes as basis, it would have meant I would have had to edit their behavior and structure significantly anyway.

There's three type of interactive entities.

Items:
Items can be picked up, and in most cases, can also be holstered to inventory. They can have up to three buttons, and the item can be examined with a press of a key to show the different buttons on the HUD. The three button (or rather three function) limit comes from the number of attack keys: +attack (default mouse1), +attack2 (default mouse2), and +attack3 (default mouse3). This limitation can
be restrictive, but it's the best way to give the item easy functionality. The item model has all the data about where in the model the buttons are, and what type of buttons they are. Some items can also be combined with each others, such as attaching an ammo clip. Items can be placed into Interactive Machines.

Interactive Machines:
Interactive Machines are stationary machines in the world. They can have as many buttons as you want, since the player simply looks at a button and always uses the +attack key. The +use key is used to place Items into item slots. We use a different key for this action, because in some cases a button and a item slot can overlap, and it would be annoying pixel hunt to get the action you want.



Just like with the Items, the Interactive Machines have built into them all the data about the buttons and where the player should move to use them. Interactive Machines also have attachments for Inverse Kinematics, to tell the player entity where the hand should be when pressing a button.

code:
$keyvalues
{
  "hlss_settings"
  {
    "continuous"    "0"     //some interactive machines can be entered inside
  }

  "hlss_buttons"
  {
    "Button"
    {
      "attachment"  "Button"    //name of the attachment on the model
      "type"    "normal"    //there are different type of buttons that have different behavior
      "hitbox"  "1"     //the hitbox helps to define how the button is drawn on the HUD
      "position"  "position"    //the name of the attachment to where the player entity will move to use this button
    }
  }

  "hlss_useposition"
  {
    "position" "1"          //reference to the position attachment and which hitbox in the usebox hitbox set to use
  }
}  

Currently the player entity doesn't have a navigation system, meaning it only knows how to move locally. This is, because the AI navigator class in Source 2007 requires it to be embedded into a NPC. The buttons in Interactive Machines can only be used if there's an empty spot in the use position, so only having local navigation for the player is enough.

Interactive NPCs
The third type of interactive entity is the NPCs. From Earth doesn't have any kind of dialogue trees to choose what the player wants to say to an NPC. Instead, there's only simple Output function that gets fired when the player tries to comminicate with an NPC. The Level Designer can hook this to a choreographed scene or scripted sequence. You can also trigger a Response Rule or Pointing Mode similiar to that of Water.

However, if the NPC is holding an item, the player can ask a question about it by looking at it instead of the NPC. Similarly, if the player is holding an item herself, the player will automatically try to ask a question about that item. The response can be anything from simple bit of dialogue, the name of the item in the alien language, a small shake of head or nod, to giving the item to player, or firing an Output function.

They use Interact Scripts to define what action or output they should fire when the player tries to communicate with them. This came from the need to be able to easily define bunch of different reactions depending on what item the player is holding. Without using some kind of script file, it would have been nearly impossible. There would have had to be several different logic_relay and logic_branch Hammer entities and filter_classname entities to make sure the right output is fired in the right time. The only downside of the scripts is that it can cause part of the map's outputs to be hidden from the Level Designer.

code:
  "hlss_bottle"         //in this case, the classname of the item
  {
    "type"    "item"      //we are responding to an item the player is holding in her hand
    "point"   "1"     //the player should do an animation of pointing at the item before the NPC can fire the response
    "response"  "take"      //the NPC should take the item from the player
    "name"    "wantbeer"    //name of the entry which can be referenced to by level designers to enable and disable responses
    "enabled" "1"     //if disabled, the entry is ignored

    "requirements"
    {
      "beer" "yes"      //special requirement to make sure the bottle is not, you know, empty
    }
  }

In this example, the "wantbeer" response can be disabled after the NPC has his beer bottle. There's also the option to set the item classname as "ANY", to give a generic response the any item the player might be holding. The code will go through all the enabled entries in the script, and it will pick the entry that has most unique conditions. For example, if an entry has the class name set as "hlss_item" and a modelname defined, it will choose that entry over any entry that doesn't.

In Point Mode the player can simply point at items or Interactive Machines the player wants to ask about.

Thoughts

The system for Items, Interactive Machines, and Interactive NPCs has been improving and growing since we started the project over an year ago. I have also been redoing parts of it to make it better. the current system allows for a lot of things including wearable items as well as combining items together.

Next month we will tell you a little bit more about the Climbing System in From Earth.

Looking for help


We are still looking for people. If you are interested to apply, you can send me a message on Moddb, Twitter, Facebook, or e-mail me at au-heppa@hlssmod.net.


Level Designers
We are looking for two different types of Level Designers. Firstly, we need people that can bring existing levels an aesthetic quality, and are experienced with lighting, texturing, and the general make up in Hammer. Screenshots and/or example maps are required.

We are also looking for puzzle designers, such as anyone who has a lot of experience designing different types of puzzles for games like Portal 2. Source engine or Hammer experience is not necessary.

Concept Artists
Most of the concept work will revolve around the industrial era Alien technology and architecture. Samples of previous work required. We already have a strong set of existing concept art for you to draw on.

Voice actors and actresses
Although the script is nowhere near ready, we are looking for people to play the parts of Zenaida, Anthony, as well as the generic voices of aliens, both male and female actors. All voice actors applying should provide some kind of samples. You should be able to do big range of emotions. Some lines might be delivered at a later date.

The aliens will be speaking an alien language specifically designed for this mod. Their dialogue is partly already written and ready for recording. Examples will be provided if you are interested.

Other
We are interested on getting any help we can get, especially world texture creators and prop modellers.

Post comment Comments
Maxen1416
Maxen1416 Feb 3 2013, 8:38pm says:

this system actually looks great so far

+10 votes     reply to comment
alvarofer0021
alvarofer0021 Feb 3 2013, 8:39pm says:

Indeed its really taking its shape good luck!

+6 votes     reply to comment
Deltaslayer
Deltaslayer Feb 3 2013, 9:03pm says:

I like everything about this.

+3 votes     reply to comment
BlahDog
BlahDog Feb 4 2013, 12:27am says:

I like the animation system but, personally, I found the camera animations a bit disorienting.

Is there any way you could make the animation move without moving the camera? Or at least make the camera move a bit more smoothly?

+2 votes     reply to comment
Au-heppa Author
Au-heppa Feb 4 2013, 12:56am replied:

Yeah, I have been thinking about adding a console command for that, but as playtesters haven't complained about it so far, so it hasn't been high priority. Still it's something I will definitely add before release.

+2 votes   reply to comment
billyboob
billyboob Feb 4 2013, 2:31am replied:

Will you also add it to the game menu for people to find without having to know the console commands?

+2 votes     reply to comment
Au-heppa Author
Au-heppa Feb 4 2013, 2:40am replied:

Yeah, either in the actual Options, if I figure out how to add stuff there, or separate "From Earth Options" window.

+2 votes   reply to comment
wnuk2380
wnuk2380 Feb 4 2013, 6:37am replied:

I think if you just slow down the animations, then it would be better. Or, just work on them a little more, to make them seem more human like. Right now, they seem a little too fast and unnatural.
Btw, this mod is looking great so far! Very impressed with the coding.

+2 votes     reply to comment
Au-heppa Author
Au-heppa Feb 4 2013, 2:48pm replied:

We increased the fps of the animations from the default 30 to 40 at one point. I think we did it after one playtester commented that the interaction took too long. It's not really a problem to switch it back and see if a lot more people starts saying that again or if we should keep the default speed animations.

+2 votes   reply to comment
adelina1985a
adelina1985a Feb 5 2013, 2:44am replied:

it only looks fast from 2 minutes of playtest but you get used to it pretty quickly, i had no issues whatsoever and i'm actually pretty sensitive about this myself, i hate head bobbing realism mods where you can't run without getting nausea

+1 vote     reply to comment
MODSTERMD90
MODSTERMD90 Feb 4 2013, 2:09am says:

so far so good!

+2 votes     reply to comment
sbnewsom
sbnewsom Feb 4 2013, 5:46am says:

Just as I imagined such a system to work. You're proving a lot of my concepts right. :D I really can't wait to test this game out. :D

+2 votes     reply to comment
animastudio50
animastudio50 Feb 4 2013, 8:22am says:

This is very complex and good system.

+2 votes     reply to comment
SPY-maps
SPY-maps Feb 4 2013, 10:08am says:

wow, simply,....WOW!!!
what a awesome animations you have made here!!!
they do play rather quick, but there are not to quick/fast. I still can see clearly what is done. And i don't have any trouble with the camera movement, so for me you don't need to change that.

I also love how the door model looks, does make me think of Bioshock, what is a good thing!!
one very, very small remark. I did find the way the wrist is compaired to the hand a bit odd looking. When the right hand presses a button on the machine, (not when it opens a door) the wrist is bend a bit and that looks a bit odd. But not really so that it is disturbing!
And when the player looks through that glass window at that other figure i really love the small touche of the hand against the glass, like if he is leaning against it, so well done!!!

this is the first time i see something of this mod, but immediately i have pressed the Track this Mod button.

hope to see much more of your project,
keep up the excellent work!

a fellow mapper/modder,
Leon

+1 vote     reply to comment
adelina1985a
adelina1985a Feb 5 2013, 2:46am replied:

nice to see such a big name appreciate this :) it's really hard work put into this but to the normal player is seamless, only modders would understand haha

+1 vote     reply to comment
cardboardtheory
cardboardtheory Feb 4 2013, 10:34pm says:

Holy crap, that looks awesome. Nice work on the animations!

+1 vote     reply to comment
adelina1985a
adelina1985a Feb 5 2013, 2:48am says:

again for me it's bit too technical, tho the concept code is easy to understand, but I think you should leave those details bout how things work for later, let the player experience these and learn themselves, and maybe after the release to have info for fellow coders

+1 vote     reply to comment
wezsel11
wezsel11 Feb 5 2013, 10:26am says:

Nice job, I love it. <3

+1 vote     reply to comment
KEEP_IT_UP!
KEEP_IT_UP! Feb 5 2013, 5:38pm says:

impressed by the the interaction onscreen happening with the bodyparts. awesome! keep it up. :)

+1 vote     reply to comment
Vaktezraj
Vaktezraj Feb 7 2013, 11:29pm says:

Pure genius. You are doing a fantastic job, and I am extremely impressed.

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

News
Browse
News
Report Abuse
Report article
Related Mods
From Earth (Half-Life 2)
From Earth Half-Life 2 - Single Player First Person Shooter
Related Games
Half-Life 2
Half-Life 2 Single & Multiplayer First Person Shooter
Related Groups
Half-Life: Short Stories Team
Half-Life: Short Stories Team Developer & Publisher with 7 members