HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Help understanding how Behave and ACC works  (Read 918 times)

Legacy

  • General Accounts
  • *
  • Posts: 117
    • View Profile
[Resolved] Help understanding how Behave and ACC works
« on: May 03, 12, 02:53:03 AM »

Hello,
I encountered this just yesterday but found no information on wiki so I am asking here. I am using two things for my combat animations:

first I have in character's .AAS script two base modes defined (just like in the clean engine version): Normal and Combat. If I detect that character has weapon equipped, I set this to Combat, elsewhere it's set to Normal. Then I use the account["Behave"] = "anim ..." command to play a combat animation. Both work great on my local client, but other players around me cannot see the behavior.

So how do you do this on server? The code that sets character's base mode is found in the default clean engine E_ACCController script. I am mostly curious because if I use the account["Behave"] = "hold ..." command to attach a weapon to character's hand, it works perfectly and others can see the weapon attached too, so I'd guess this is replicating somehow...

What is the difference between hold and other commands such as anim or input?
Thanks
« Last Edit: Nov 01, 12, 02:49:04 PM by HE-Cooper »
Logged

HE-JAY

  • HeroEngine
  • *****
  • Posts: 122
    • View Profile
Re: Help understanding how Behave and ACC works
« Reply #1 on: May 03, 12, 10:53:56 AM »

In general, character controller state is communicate from a controlling client to the server and then replicated to observing clients; those observing clients then interpret the state change by changing animation inputs on their client-side version of your character to play the correct animations.

The process is basically:
  • Look at the class _ACCCClientControl, which is glommed onto a client-controlled character on the server and then replicated down with the controller to the controlling client
  • Note that this class has several fields which are marked to reverse-replicate
  • Look at the client and server-side scripts for _ACCCClientControl and note the replication callbacks; look at what they do
  • Duplicate this behavior in your own controller or extend the functionality of the client control glom to suit your needs

To understand what the "hold" command is doing, you'll have to look at the script for the character controller attached to your character; by default, this will be HeroEngine_ACCControllerClassMethods -- look at the doBehave method and find the "hold" section (you'll also see sections for other commands such as 'anim' and 'input' -- these are all defined in script and can be extended as needed).
Logged

Legacy

  • General Accounts
  • *
  • Posts: 117
    • View Profile
Re: Help understanding how Behave and ACC works
« Reply #2 on: May 03, 12, 12:13:33 PM »

Hey Jay,
thanks for in-depth answer, I'll dive into this :)
Logged