Design FAQ

Jump to: navigation, search


How do you make special water blocks that players can walk on?

The physics external functions should be able to provide a reference to the water node (if they don't already, its simple to expose that information).

As far as knowing that a particular water node is "special" you have a variety of options available to you to mark the node as different from other water:

How can I enable a player to walk on water when they use a special item, but only in certain water blocks?

All of that can be handled in the Character Controller ( how and when a character moves is 100% under its control. The controller needs to know that it either has to check a class added to the water node or the character itself to know whether or not it needs to keep the character above the water plane or engage normal swimming.

How do I allow player changes to persist?

If you want to persist the change for the player, you must persist the information on the server. Since the value is unique to a particular character, that suggests that the information is either added to the character's hierarchy of nodes. Or if you intend to store a lot of this type of information, you may want to consider creating an arbitrary root node to store these things for a character and loading it as needed (perhaps when the player logs into these types of areas). Either way, it is recommended that you create replicated objects (that replicate only to the player whose objects they are) that are in the spatial awareness system. When the "owning" player enters the object's awareness you would then modify the player changes on the server object and allow replication to send the change to the client.

See Also: Replication Tutorial

How do I implement special areas of unusual shapes?

It is recommended that you use region nodes since they are capable of expressing complex shapes...along with the external function IsPointInRegion().

See: Region nodes

How do I change the position of a trigger instance from the client without having to make a remote server call?

Changes to the properties of an Instance on the client are by design local in nature, HeroBlade itself sends a message to the server to actually perform a "real" edit change. If you only want to change the local instance, then you can use the property interface or external function (faster) to do so.

  position as vector3 = somePosition
  trigger["Position"] = position   //  v1.23 supports vector3s natively in the script editor.  In v1.22 you need 
to use "(0,0,0)", or pass it a vector3 variable


  SetNodePosition( trigger, position)

How do I make a NPC drop items when it is defeated?

Transitory objects in an environment are created using the client's Prop buckets system. Sample code for the display of such a transitory object can be found in the replication tutorial, which depending on your design needs could serve as a foundation (the tutorial's sample code) for the implementation of your treasures. The replication tutorial teaches you how to introduce an object to one or more clients via replication and visualize it on the client(s).

Replication Tutorial#Instantiate a Visualization of the DRO During Introduction

How do I create a character?

Add Creature to Engine

The engine comes with some systems dealing with character selection and creation, but their functionality by is of course extremely generic and it is up to you to extend them (or write an alternative system) for your own game.


So from a step by step perspective...

  1. Art team creates
        1. model
        2. skeleton
        3. animations
              1. Animation Sequences
                 Animation Sequence
              2. Animation Agent
                 Animation agent script
                    1. if you are using the Default controller, your
                       animation agent script will need to support the
                       inputs it expects.
  2. Register your new model with the game
     Add Creature to Engine
        1. Test that the creature is properly implemented on the art
           side by attempting to instantiate it (/henpc create
  3. Override the Character Selection Mechanics
        1. please note, HJ overrides the majority of the engine's
           character creation/selection mechanics to perform highly
           customize code. That means following instructions for the
           "clean" game world you will get is probably not going to
           help in the evaluation world.
        2. Create a custom UI for your game
  4. Override the Character Creation Mechanics
        1. Create a custom UI for your game
  5. Implement a custom character controller (while not strictly necessary to start, you will eventually want to write a custom
     Advanced Customizable Character Controller

For additional information about overriding/extending the engine's script systems see the documentation on system nodes System nodes.

How do I make moused over NPCs glow like they do in Heroes Journey?

All you have to do is set the character's DiffuseColor property to a r/g/b values of 1.3 or something which increases the light affect on the character.

How do I implement character portraits?

Hero's Journey uses both virtual stages and textures rendered from a virtual stage and saved to the LRC (local repository cache) in its interface.

Virtual Stage documentation is found at Virtual stage and there may be additional functions that are detailed in the _ExternalFunctions Client Script.


If you do not need animated portraits, then your code needs to be able to generate a texture from a virtual stage and then save/retrieve that texture from the LRC. Once your shot is set up in the virtual stage, you use StageGetTextureAsRawData() (I'm told DDS is probably the best format for this particular use case) to capture a snapshot which you save to the LRC using the SaveLocalRepositoryAsRawData() external function. Using the FQN specified, you can now set GUIControls to use your new texture just like any other texture an artists creates in photoshop.

For Hero's Journey, we store all character portraits we generate in the LRC in a path "/portraits/" + <characterName> + <accountID> + ".dds".

Ultimately, if you want your characters to animate in the portrait you will need to use a virtual stage to display them.

How do I let players know when other players log on/off?

Other clients do not know about the arrival of the incoming player until the underlying C++ code creates a character in their local GOM. So the first client B knows about client A's login is that it got the _OnCharacterCreate() call.

Typically, attempting to send data to all clients in an area during the login process is not the ideal architecture for a number of reasons.

A classic optimization for MMOs is the concept of Area of Interest, whereby you essentially define a range at which a client is interested in other things. We are currently in the process of implementing our generic replication system for data which will include a sophisticated AoI mechanism as well as a customizable bandwidth shaping strategy for the replication.

It is important to remember that the HBnode created on the client to represent a character (sharing the ID of the account node) is a visual representation created by the C++ code which may be destroyed and recreated arbitrarily as the character leaves/enters your knowledge. Additionally, a character's HBNode does not exist to handle data for characters that are not in the current area (and visible) to your client. Consequently, most (all?)character data such as "health" is better stored in an alternate data structure independent of the HBNode and its visual representation.

We have a tutorial on dealing with character data discussing many of these issues at Character Data Tutorial, keep in mind this tutorial was written prior to the new RemoteCall syntax and the release of Replication and Spatial Awareness System. The Replication Tutorial describes the way you would probably implement this game mechanic with the newer technologies.

As a general Architecture, we recommend you create a cache on the client to store data for whatever you want a client to know (character data like health for example) which is implemented using the Model-View-Controller and Observer Patterns. Your UI subscribes ("listens") to your client's local cache for information and ideally should make any requests for data in an asynchronous manner.

Such an architecture works equally well for characters in your area as those elsewhere in your game world that you want a client to know about (group members, guild mates etc).

Does HeroEngine have a simple world wide chat channel?

The Chat Panel By Default does an "area" chat message and there is no built-in command for world chat. The creation of a command to do a simple world chat message requires you register the command with the command handler system Technical:/REGISTER with the following code:

$CHAT.ChatWorld( channelName, MessageString )

The channel name is intended to be used by your game specific implementation and does nothing in particular from the engine's perspective. Please note, that the ChatWorld method does make a remote call to the World Server and consequently is probably not appropriate for use in a live game as it is best to minimize the load that the world server is under.

To implement this feature as production ready code, you would want to implement a system area (or areas) to handle chat performing remote calls to them instead of the world server (after registering them for world "player" knowledge). This is probably more complex than you need initially.

How do I make damage number float up from the character when they are struck?

The reference copy of Hero's Journey has a client script named "combatInfo" that handles our flying combat text. While it does some stuff that you will certainly not currently need, such as play a FX handle our impacts, it demonstrates the basic concepts of creating a GUI control and animating it flying off the character's head.

How do I create a shop?

The actual design of shops or services depends greatly on your game design and as a consequence HeroEngine does not implement shops or "services", rather HeroEngine provides frameworks that you may choose to use to implement your game specific shop/services features.

There are many ways of persisting data in HeroEngine (Data_storage), but the Spec System (Spec_system) is used by most licensees to define significant portions (or all) of a game's data. Thus our example design starts by leveraging the Spec System to define immutable data and provide a factory for mutable instances (if needed). Since shops typically sell "items", the you also have to consider how you define your items (this also often involves the spec system).

So, our sample design needs to consider at a minimum defining the following types of data:

For the purpose of this discussion, we are doing to assume you have chosen to represent theses things using the Spec System. This means that the definition of a shop includes a list of shop inventory specs representing those things its allowed to sell. Shop inventory specs are in turn composed of lists of item specs (and if you want to be really flexible perhaps other shop inventory specs). Assuming we follow the traditional MMO model of "click on npc to see shop inventory", then our npc specifications may also be designated as "shops" which include a shop spec.


All of these different types of specs you might suppose could be confusing to the game designers, but fortunately you can hide the fact that things are separate through the UI so the game designer never has to think about it at all.

How do I make the camera rotate around the player based upon mouse movement?

This is all an interaction of the InputSystem and the ACCController, rotating the character based on mouse movement is just a matter of using either existing behaviors such as setting just snap rotation to true and setting the desired heading on the controller or whatever else you want to do in HSL.

How do I implement player/npc to player/npc collision?

By design, MMOs generally do not implement character-character collision because of the abuse of the capability by users to "grief" users by blocking entrances.

You could implement this type of behavior by performing multiple raycast feelers when characters are "close" to determine whether or not a collision is going to occur and impart an impulse to one or both characters.

external function RaycastPhysXNode(v1 as Vector3, v2 as Vector3, intercept references Vector3, 
                                   normal references Vector3, node references NodeRef) as Boolean
Personal tools