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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Tarra2012

Pages: [1] 2
A lot of forum topics are answered with "use spec system". The justification,
why its used, is not transparent. Thats why i started a small decision list
with hints, when to use "Spec System" vs "Prototypes/Scripts."
Reading -data storage options- in the HEwiki is a good prerequisit.

When you are close to do sth. that in other languages is done by use of "global" values

When the amount of data is "overviewable"
  say 70 skills with 8 attributes
  say 20 areaeffects with 20 attributes

When your derived objects are easy to manage
  say you spawn ~2 different classes out of the definition

When your own knowledge is limited with HE Systems
  say be true to yourself and even if you handle HSL the dependencies of HE frameworks are not
  your deepest knowledge

When you prefer direct access in coding (synchronous)
  function a) calls and gets values immediate

When you dont need editors to "change constant values"

=> you should go with prototypes / scripts

When you are close to do sth. that builds complex objects (mutable,non-mutable data in objects)

When your amount of data is "big",
  say  500+ dialogdata
       1000+ Items with lots of categories
       120+ NPCs with different attribute sets (shop npc, boss npc, regular npc, trainer npc)

When derived objects are architected in strong OO manner
  say main class: task
        derived classes: killtask / findtask / talktotask / delivertask
        optional decorator classes: timedtask  / rewardedtask / collectingcountertask

When you dont hesitate to use indirect access in coding (asynchronous callbacks)
  function a) calls
  function b) retrieves callback

When you need editors for teammembers to change constant data

When you support the category based browsing of big number of data (300NPCs,1000Items....)

=> you should go with SpecSystem

Note 1)
I didnt mix more storage options. But remember you can use them.

Repository is shortly spoken a filestorage possibilty that exists for server n client.
Normal Text or even serialized complex objects can be saved/loaded as XML/STRINGS.
Infact the Whole SpecSystem is a mixture of Prototypes/Repository Storage,
with interal synchronizing features.

Using Repository standalone:
- For Saving "Player Customized" GUI/CHAT Settings. (Clientside)
- Generating timed Reports "ItemDrops per 24hours" (Serverside)
- Filebased data (remember: DB persistancy for objects is given by DOM flags
                            and the createpersistednodefromclass)

Note 2)
The spec system is harder to setup, to debug und to understand.

-You will write more classes and lines code. The code itself will be scattered around in MANY
different places. The factory of different "nodes" that represent the same object on server / client
is a major point in all of this. It is solvable in many fashions.

-You need to care about the editor. When you use complex datatypes (path references, lists of "objects", 1:n relationships) the standard editor is limited. DO think how much time you want to spend on developing "developer tools".

-There are many base concepts to be understood before diving into spec world
GOM/DOM Handling
Debugging and Using /commands
Replication vs RPC
Event Handling (Events with Observer/Listener)
GUI Creation
Startup/Shutdown Callchains (Areaserver, Character Loading, Entry Points)

I wrote this initially many month ago, then stopped a bit with HE.
I still think, a valid discussion when to use what is a benefit to many coders.
Especially to people, that are using HE in the first month.
Basically i dont want to convince that one system is better than another one, but i want to give a bit realistic view on what awaits you.

Maybe some experienced coder can add their views on "when to use what".

Scripting & Programming / Where to find physic server logfiles?
« on: Feb 01, 14, 01:05:31 PM »
Where can i find debugging info or logfiles for the physics server?

Code: [Select]
   safepath2 as String="\ScriptData\ZEO_PhysicsLog_"+SYSTEM.TIME.NOW

   if PhysicsCoreDump(safepath2) == true
     println("saved debug log")

This Code returns a true, but:
The RepositoryBrowser doesnt show a logfile at the desired location. (Serverside)
Anyone ideas where to find the logfile?

In my journey through physic i am using the "CreatePhysicsBoxCharacter()" _external Function, but it leads to some questions:

1. What is the parameter "physics_character_id_out references ID" representing ?
How can i get information about the Character_Object referenced?
I cant access any information. "\sn /sn" doesnt show any properties. Which seems normal, as its an ID that starts with "1". If you create more PhysicBoxCharacters() this ID is counted upwards.
Which function is meant to be used to get information about the physics_character_id?

2. Is there a tool that displays properties for PhysicsBoxCharacter?
The output shows, that the Object has been created, but i cant trace anything.
Do I need to search for a PhysicServer Logfile?

3. If MovePhysicsCharacter() is called and it returns "true", what does the vector
    in the callback method mean?

The Callback Methods looks like: _PHYSICSCHARACTERMOVECOMPLETE(a as ID,b as Vector3)
In the case below the returned vector is always (0,0,0).
Does it mean the move operation was calculated, but the move was denied?

4. Explanation of Parameters in CreatePhysicsBoxCharacter() 
I dont untersand parameters like "extents as Vector3, slopeLimit as Float, skinWidth as Float"
Is there any documentation available? Or a working code example?
If i search ALL client and ALL server scripts I still dont find a single code line that uses this _external function.

Code: [Select]

acct as NodeRef of Class E_playerAccount = SYSTEM.REMOTE.CLIENT
pc as NodeRef of Class E_playerCharacter = acct.GetMyChar()
phys_id as ID
pos as Vector3 = pc.GetPosition()

//We need a requester Node, simply take the selected "clicked" target
ctarget = MiscUtils:ClientToServerNode( acct.GetClickTarget() )
myid as ID = ctarget

//Specify class that handles callbacks from physic operation

//Extents - ? no idea what the input means
newvec as Vector3

//FYI: How the Method is described in _external
//CreatePhysicsBoxCharacter( requestingNode as NodeRef, physics_character_id_out references ID, extents as Vector3, slopeLimit as Float, skinWidth as Float, position as Vector3, gravity as Float ) as Boolean

if CreatePhysicsBoxCharacter( myid, phys_id, newvec, 2.0, 1.4, pos, 1.0 ) == true
   $CHAT.ChatPlayer( acct, "","Physic Created box: "+phys_id)

if MovePhysicsCharacter( ctarget, phys_id, pos ) == true
  $CHAT.ChatPlayer( acct, "","Physic Box moved: "+phys_id)

Output when Executed:
Physic Created box: 1
Physic Box moved: 1

[hsl_debug] 9223372056307022385,4: SCRIPT[EO_Physic_NodeClassMethods]: physchar created:9223372073882021740 a:1 b:true

[hsl_debug] 9223372056307022385,4: SCRIPT[EO_Physic_NodeClassMethods]: physchar moved:9223372073882021740 a:1 b:(0,0,0)

Code: [Select]
Class EO_Physic_Node

method _PHYSICSCHARACTERCREATED(a as ID, b as Boolean)
  println("physchar created:"+me+ " a:"+a+" b:"+b)   

  println("physchar moved:"+me+ " a:"+a+ " b:"+b)

// !Information
//  the me object in those objects is not kindof PhysicInstance
//  So you cant access properties or handle it alike

How would a true serverside physics object be "created" and "replicated" to all clients in HSL?
Are there any hints? A simple cube that is pushable and updated to all clients would be sufficient.

The Dynamic Replicated Object Tutorial
- has only a "HBnode" and "Physics" Properties on Clientside.
- If you move it, no other Clients gets the new Position.
   (This can be fixed, by updating the Position with a servercall that then updates SASAwareness Position)
   Yet this doesnt mean there is a true physic Object existing on Serverside.

I have asked some people and scanned the forum/wiki entries. Couldnt find any answers.
My best guess lies within the following "non working" serverside code.

Code: [Select]
  myphs as NodeRef of Class physicsinstance = $EDIT._CreatePhysicsInstance("default")
  myphs.PhysicsBeginAwake = "0"
  $EDIT._SetInstanceCreated( myphs, 0 )

Similar open, not resolved Topics:
Dynamic Physics replication

Playground Equipment Physics questions:


If you have a player with skills. Where skills are hard associated to the player and carry persistantly mutable data, as experience.

1. Should a replication group be created once during player creation Or each time the player logs in?
2. Where should the noderef to the replication group be stored?

ATM i create a new replication group and add the skills to it, each time the player inits. This seems like a lot of redundant work. I wonder how this is "intended". And if there is a way, to do it only once.
On the other hand, i am not sure where to correctly store the "repgroup" noderef itself. With the player?

Code: [Select]
  //Example during init
  rg as NodeRef of Class _ReplicationGroup = createNodeFromClass("_replicationGroup")
  foreach s in players.E_SkillList
    myskill as NodeRef of E_Skill = players.E_SkillList[s]

Scripting & Programming / iterate / show all specs of one type
« on: Aug 13, 13, 10:30:54 AM »
The objective is to create a list of all Specs of a certain type Clientside.
In the example code below I use the "CollectionIterator".

It works until i create a new Spec. The new ID/Spec will not be listed.

Does anyone know why? Or anyone has an example how to truely get ALL OracleSpecs of one Type?
Do i need to update something clientside ahead of the Iterator Usage?

Code: [Select]
oracle as NodeRef of Class EO_NPCSpecOracle = $SPECORACLEUTILS._GetSpecOracleByClass( "EO_NPCSpecOracle" )
  var listener1 = oracle.createScriptListener(SYSTEM.EXEC.THISSCRIPT,false)
        // Iterate through all EO_NPCSPecs
         iterator as NodeRef of Class collectionIterator = oracle.CreateCollectionIterator()
         elements as Integer = iterator.length()
         nextnode as NodeRef of Class EO_NPCSpec
         while iterator.HasNextCollectionElement(nextnode) == true
           println("req:"+nextnode.SpecKey+ "total elements:"+elements)
           if nextnode.EO_NPCSpecType=="Dialog NPC"
              oracle.RequestSpecByKey(nextnode.SpecKey, listener1)

In InitProcedures I link a QuestMGTNode with a Player via an "EO_Player_QuestMgt_Association" association.
Its an hard 1:1 relationship.

Unique Source:Yes
Unique Target:Yes
Hardness: hard
Hard Group:base_hard_association_group

On next Login the Link can be found, yet the Target QuestNode is not in GOM!
I have no idea, cause normally a hard association means it will be loaded automatically.

Any suggestions?

Code: [Select]
where entity is kindof E_playerCharacter
       questnode as NodeRef=QueryAssociationOneTarget(entity,"EO_Player_QuestMgt_Association")
       if questnode <> 0
         [b] //Next Login - Questnode should be usable, but it is not in GOM![/b]
         entity.EO_Noderef_QuestMgt = questnode
         println("Using old Questnode:"+questnode)

         // First Login - Create Questnode and Association
         QuestMgt as NodeRef of Class EO_QuestMgt = CreatePersistedNodeFromClass("EO_QuestMgt")
         AddAssociation( entity, "EO_Player_QuestMgt_Association", QuestMgt)
         entity.EO_Noderef_QuestMgt = QuestMgt
         println("Using new Questnode:"+entity.EO_Noderef_QuestMgt)

       entity.EO_Noderef_QuestMgt.ListenToAreaEvents()   // This line crashes as the Node is not in GOM

I have trouble loading from the server repository when not using folder "/scriptdata".
external function DownloadRepositoryData()

The target document lies in "scriptdata/mydoc.txt" & "scriptdata/dialog/mydoc.txt".
Via the Repo Browser I created the subfolder scriptdata/dialog and the mydoc.txt inside.
So the document is existing and i can download it via the Tool, but the function above cant find the file.

Works as it always Points to /scriptdata
safepath ="mydoc.txt"
 myIDs as ID = DownloadRepositoryData(safepath, SYSTEM.EXEC.THISSCRIPT)

All dont Work. Trying to access a SubFolder
safepath as String="/ScriptData/Dialog/mydoc.txt"
safepath as String="/scriptdata/dialog/mydoc.txt"
safepath as String="scriptdata/dialog/mydoc.txt"
safepath as String="/dialog/mydoc.txt"
safepath as String="dialog/mydoc.txt"
 myIDs as ID = DownloadRepositoryData(safepath, SYSTEM.EXEC.THISSCRIPT)

Scripting & Programming / How to store NPC Dialog Data
« on: Jul 25, 13, 08:34:23 AM »
I have trouble deciding how to store NPC Dialog Data efficiently.
The sofar data hierachy for Dialogs and Dialog-Bricks looks like:

Dialog has 1. Dialogname              (String that Identifies a Dialog)
              has N- DialogBricks
              had N-Prerequisists                    (Structure 4 Prerequisit-Checks ...PC has MinLVL/FactionLore)

DialogBrick has 1 BrickText                 (String that the NPC Says)
                             has N- Answeroptions

Answeroption has 1 Text                   (String that the PC Answers)
                                   has 2 PossibleActions  (String that can Trigger an Action later)

How can I store this Data best with an NPC? Fewest possible overhead in Network Communication?

Option1: Softlink
Soft Link "Dialog_to_NPC" the Dialog to an NPC
Hard Link "Brick_To_Dialog" All Bricks to the Dialog.

Search for Associations "Dialog_to_NPC" everytime a player triggers an NPC.
If the Dialogs for the NPC arent loaded, it should then be done. All DialogBricks will be loaded automatically(due to hard_link) nature.
Now the Dialog needs to be send to Client for Displaying.

Option2: Spec Oracle
Store all Data in a Spec Oracle

Search for Spec Oracle (NPC) that are connected to the NPC ID:
Load Spec Oracle + Instance a Dialog class.
Now this Dialog needs to be send to Client for Displaying.

Option3: Store Dialog only on Client Repository ?
Is this even possible? I mean it makes no sense sending Dialog Data from Server2Client.
Only the trigger actions from the Dialog need to Travel Client -> Server
and then be check for valid circumstances (e.g. player is close to NPC; player has correct level)

Is Option3 maybe solvable by an "ClientSide" only Prototype?

Am i wrong and missing the "ultimate" solution to efficient Dialog-Storage?

I wonder where exactly the "mousetargetable" area of the NPC Mobs (Monkeytoks) is defined.

Dealing with dynamic created objects, i needed to activate physics on a new instanced prob to make it mousetargetable. SO my Sphere has a good physics mesh and mouseclicks are exactly recieved.

However all monkeytoks have a flurry area, which is much too large.

The screenshot shows a "green point" on the purple sphere. IF i click on this point or even lower, not the sphere is recieveing the mouseclick  but the monkeytok.

Why is that so? How can i decrease the "mousetargetable area" for the npc? the physics capsule looks so much smaller of the monkeytok.


Am trying to implement a Pre-Factory Mechanism of the following type.

40 nodes are Created with Init values. They rest in a factory pool until a process needs them.
20 of those nodes are pre-glommed with a special class a
20 of those nodes are pre-glommed with a special class b

All of those should later be safed in an ITEMContainer. So they are Items.
But when they are used, the hefty DB Operations and Init Times are already "done".
Thus only normal operations as setting some vars are running.

When the pool reaches close to 0 elements, again 40 more should be created.

Where do i best have the anchorpoint for the Factory ? (Area Node?)

Whats a good approach on Creating 40 Objects and Glomming onto them?
Any pitfalls concerning performance?
Any Thoughts WHY not to do it?

How to define a reasonable ammount? (40 items enough? or scale with active players in area?)

Wondering if anyone did this before.

Am using System Nodes, created out of a Prototype, to safe standard Vars.
I use them frequently in Server Scripts and the easy access via  $nodename.attribute is great.

Now we need them more often in Client Scripts.
ATM the only way is to clone the Prototype. 

Is there a way to trigger a copy process (server prototype to client prototype)?

A Solution i might dwell into:

Using the DOM Editor or the CLI Commands to
  - Delete Client Prototype/Delete underlying Class
  - Copy server class to client class
  - Create Client Prototype out of new underlying Class
  - Instance the Client Prototype to have System.Node in Client

Sounds like a long way. And i wonder wether this is actually suitable for a HSL function?

Scripting & Programming / GetGroundUnderMouse vs. Raycast
« on: Jan 23, 13, 10:57:44 AM »
I am using the GetGroundUnderMouse Function.
It works on many surfaces, but anytime when i position the mouse over a "steep" heightmap ground it doesnt deliver any results. Is this working as intended? Or is there another function that would work with "all" grounds?

Attached a screenshot with
   -green dots that show where it works
   -red     dots that show where it doesnt work

I have used dynamic Prop Creation. So far everything worked out.

Am looking for
 1. Changing the Pivot Point of the Prop
    Its always rotated around the center. I like to move the pivot point.
 2. Changing the Alphablending
    The property instance["Alphablending"] didnt exist on the following.
    Do i need special setup for alpha manipulation?


 instance = CreateInstanceFromPropBucket( "DYNAMICREPLICATEDOBJECT", me.DRO_AssetID )
    me.DRO_InstanceID = instance
    SetNodePosition( instance, me.DRO_Position)
    SetNodeRotation( instance, me.DRO_Rotation)
    instance["LODFactor"] = 10
    instance["DiffuseColor"] = "#.267,.0,1.0,1.0"
    instance["AmbientColor"] = "#.267,.0,1.0,1.0"

I have a design question and a implementation question.

1. Which one is a better choice: Marshal node or create event with data?   
    Which one uses more resources? Is faster?

In my example i have a node with 2-3 classes glommed on and many string n integer variables.
I need to transport such nodes a lot in setup and less frequent during normal gametime. (server -> client)


2. I implemented 2 variables on e_common_character and used the relication (i + r ) flags to make them replicate. And of course set up mapping of variables (client-> server with callback yes and initial delta priority). I used this alot with normal classes and it worked.

With e_common_character it didnt?
Was it because the variable is type of noderef?
Or are there special things going on with player chars?

Pages: [1] 2