$ACCC

From HEWIKI
Jump to: navigation, search

The $ACCC system node supports the Advanced Customizable Character Controller system.

Overview

The $ACCC system node serves as an access point from C++ whereby HSL is provided the opportunity to control the instantiation of a game-specific character controller. By default, HeroEngine is supplied with a character controller instantiated from the class HeroEngine_ACCController which closely mimics the behavior of the original C++ character controller.

A character controller manages how a character representation "moves" on a client, the transformation of mouse/keyboard/behave input into animation inputs, the interpretation of movement packets into animation inputs, and the effect of collision/gravity and other factors upon the final position of a character each frame.

Contents

What problem(s) does this solve?

Concepts

$ACCC is a System Node

System nodes were adopted as the primary mechanism at the HSL script level enabling game-specific implementations of a licensee to extend/override the Required functionality included in Clean Engine. As with all system nodes, this is accomplished by GLOMming a game-specific class onto the ACCC prototype, from which a singleton node $ACCC is instantiated for a particular local GOM.

$ACCC exists on both Client and Server

The $ACCC system node is both a Client as well as a Server System node, so you can call its methods in both client and server scripts.

$ACCC is responsible for factorying Character Controllers

The $ACCC system node is responsible for the factorying of a character controller both on the server and client.

Client Representation of a Character

Client representation of a character

The representation of a client is a complex one composed of C++, HSL and game-specific classes. At a minimum there are several major parts to consider:


Usage

Adding game-specific functionality

As a required class/script, it is not permissible to make changes to the _acccClassMethods script. Instead, extension/overriding the script is accomplished by the creation of a game-specific class (and class methods script) that is GLOMmed onto the ACCC prototype.

Create a game-specific class

Using the DOM Editor create a new (server|client) class. Our recommendation is that you use a class name that incorporates the _accc as a suffix to the name (ex. HJ_accc), this makes it easier to locate the pair of classes (the required script prefixed in _accc and your game-specific class).

Once you have created the game-specific class, create a new client class methods script for that class.

Adding a game-specific class

Adding your game-specific class to the ACCC prototype is achieved using the System Node Configuration GUI or the CLI server command \mpac or client |mpac in the Console Panel. The System Node Configuration GUI is the preferred method because it handles the communication to update any instantiations of a system node to reflect the changes you have made.

Using the System Node Configuration GUI

UtilitiesInterfaceConfigureSystemNodes.jpg

Opening the System Node Configuration GUI requires you to access the hidden Utilities Interface toolbox, located in the top left corner of the render window with ctrl-shift-click (or press F5), which will open the Interface. On the Tools tab within the menu, is an option to open the System Nodes Configuration GUI.

See also: Adapting Clean Engine



Using the CLI

It is important to recognize that modification of the prototype from which a system node is instantiated will not update any instantiations that have already been made in various local GOMs. That means your changes will not take effect until the area (in the case of server system nodes) restarts, or the client (in the case of client system nodes), restarts.

Adding a class to a prototype is done via the CLI command Modify Prototype Add Class(MPAC).

Server: \mpac ACCC, hj_accc;
Client: |mpac ACCC, hj_accc;


C++ logic flow

When a character is created on the server:

Notification of clients:

When a client is notified that it needs to instantiate a character:

Specify a game-specific Character Controller Class

The most basic type of override for game-specific functionality, implementing the override method allows you to specify the use of a class other than the HeroEngine_ACCController class to be used in the instantiation of character controllers. More complex game-specific behaviors may require you implement the HE_factoryCustomizableCharacterController() method instead.

This override would be implemented in the game-specific class for the server $ACCC system node. The class specified should exist in both the client and server DOMs.

method HE_getACCControllerClass( character as NodeRef, ACCControllerClass references String ) as Boolean
// Used by $ACCC the Advanced Customizable Character Controller
//
// Return true if you want the class specified by setting ACCControllerClass to be used
//   the class must have _ACCController as parent classes
  return false
.

Factory a game-specific Character Controller (server)

By default, HeroEngine factories a character controller for each character from the MMO Foundation Framework class HeroEngine_ACCController. This controller mimics the behavior of HeroEngine's original C++ character controller, but by the nature of the system may be replaced with a fully game-specific one without requiring any changes to the source code.

Character controllers are factoried on the server when a server first becomes aware of the character (beginning of a session for player characters or during instantiation of non-player characters). The actual instantiation of a character controller node is done by the $ACCC System node during a call to the method _factoryCustomizableCharacterController() which performs a call to a game-specific override method.


method HE_factoryCustomizableCharacterController( character as NodeRef, acccTag references String, controller references NodeRef of Class _ACCController ) as Boolean
// Used by $ACCC the Advanced Customizable Character Controller
//
// Return true if you factoried up a controller
//   if true, then acccTag must be set as well as the controller reference
 
 
  handled as Boolean
 
  return handled
.

Two variables are passed by reference and it is important that they are set when this method returns.

Factory a game-specific Character Controller (client)

The client's method HE_factoryCustomizableCharacterController() is called during login to an area or when a character is first introduced to the client. The server passes the controllerID of the server character controller and the acccTag that was specified when the server's controller was intantiated. Using the information passed, the client then must instantiate a client character controller.

The client character controller should be instantiated using the ID specified by the server.

method HE_factoryCustomizableCharacterController( HB as NodeRef of Class HBNode, acccTag as String, controllerID as ID ) as Boolean
// Used by $ACCC the Advanced Customizable Character Controller
//
// Return true if you factoried up a controller
//   if true, then acccTag must be set as well as a node created with the appropriate controllerID
  return false
.

Reference

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox