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

Author Topic: Simplify the creation of DOM data  (Read 1660 times)

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Simplify the creation of DOM data
« on: Nov 20, 16, 08:18:46 PM »

I never was a fan of the DOM editor or the Command Line Interface to make changes to the DOM. I made a program to automate the process of the creation of DOM data for Enums, Classes, and Fields. I call it  "Auto_CLI".

This program looks for two JSON files. One for the client and another for the server(in that order).
run.bat:
Code: [Select]
%CD%\CLI_Automation Example_Client.json Example_Server.json
If you have nothing to add to the server or client you can leave one of the files empty with:
Code: [Select]
{
}
Below are examples showing all properties and DOM objects supported on both the server and client:
Both The field: minimumField and the class: MinimumClass are examples of what the minimum requirements for a field, and class are.
Anything that is not defined in the JSON* object has the same default value as the Dom Editor.
Code: [Select]
{
  "Fields":
  {
    "someField":
    {
      "description": "enter a description",
      "field type": "enum ENUM_EX",
      "reflect to ghost": false,
      "write strategy": "lazy",
      "watching script": "None",
      "private": true,
      "distribution package": "game"
    },
    "minimumField":
    {
      "description": "enter description",
      "field type": "integer",
      "distribution package": "game"
    }
  },

  "Classes": {
    "SomeClass": {
      "archetype": "Data",
      "description": "Enter A description",
      "distribution package": "Game",
      "parent classes": [ "MinimumClass" ],
      "fields": [ "someField", "minimumField" ]

    },
    "MinimumClass": {
      "archetype": "Data",
      "description": "Enter A description",
      "distribution package": "Game"
    }
  },

  "Enumerations":{
    "ENUM_EX": {
      "description": "Enter A description",
      "distribution package": "game",
      "enum values": [ "ENUM1", "ENUM2", "ENUM3" ]
    }
  }
}
Example_Server.json
Code: [Select]
{
  "Fields":
  {
    "someField":
    {
      "description": "enter a description",
      "field type": "enum ENUM_EX",
      "reflect to ghost": false,
      "write strategy": "never",
      "watching script": "None",
      "private": true,
      "distribution package": "game",
      // Replication properties are server side only
      "discrete": true,
      "change callback": true,
      "destination field": "someField",
      "destination field client": "someField",
      "reverse replicate": true,
      "reference adjust": false,
      "initial priority": 123,
      "delta priority": 123,
      "lifetime": 1234,
      "distance factor": 100
    },
    "minimumField":
    {
      "description": "enter description",
      "field type": "integer",
      "distribution package": "game"
    }
  },

  "Classes": {
    "SomeClass": {
      "archetype": "Data",
      "description": "Enter A description",
      "distribution package": "Game",
      "destination class server": "SomeClass",  // Replication properties are server side only
      "destination class client": "SomeClass", // Replication properties are server side only
      "parent classes": [ "MinimumClass"],
      "fields": [ "someField", "minimumField" ],
      // Replication properties are server side only
      "replicated fields": [ "someField" ],
      "initial set fields": [ "someField" ]
    },
    "MinimumClass": {
      "archetype": "Data",
      "description": "Enter A description",
      "distribution package": "Game"
    }
  },

  "Enumerations":{
    "ENUM_EX": {
      "description": "Enter A description",
      "distribution package": "game",
      "enum values": [ "ENUM1", "ENUM2", "ENUM3" ]
    }
  }
}


Most errors are displayed and then stop the execution of the program. Errors that are caused by attempting to create a definition that already exists are ignored.


Limitations:
*This program will not work with any reference worlds.
*Requires the console to be visible .
*It may take some time before the program finds the console. It's recommended to close the dom editors to speed up the search.
*It may not work very well, or at all if your console is spammed with messages.
*Doesn't support creation of association DOM definitions.

Benefits
*Use the JSON format that this program uses to share DOM definitions with others.
*A class or field is fast and easy to create
Code: [Select]
{
  "Fields": {
    "field": {
      "description": "enter description",
      "field type": "integer",
      "distribution package": "game"
    }
  },

  "Classes": {
    "class": {
      "archetype": "Data",
      "description": "Enter A description",
      "distribution package": "Game"
    }
  }
}
*A way to manually Backup the DOM definitions using the JSON format.
*Includes templates for the DOM definitions for spec creation.
----------------
To use
Download the zip file here
Create one JSON file for the server and one for the client.
Edit the .bat file to change the arguments to the names of the files you want to use
Have the HeroBlade open with the console visible.
run the .bat file and wait until it's done or an error has occurred. If an error occurs make the corrections and run it again.

Please let me know if you encounter any bugs.
-------------------------------------------------------------
« Last Edit: May 19, 20, 05:20:24 PM by Jrome90 »
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: Simplify the creation of DOM data
« Reply #1 on: Nov 21, 16, 01:21:22 PM »

Cool tool!

My 2 cents is I dont understand why the DOM editor isnt more like an SQL editor.
I understand there are some fundamental differences but you can still follow the same layout.
I feel like the navigation is clunky but I really dont have much more to add than that.

Would maybe be nice to see the classes/fields segmented into alpha parents first so you can easily go to a letter and start to scroll rather than loading every single class/field etc.
Allow fields to be fully editable directly from a class instead of having to click in.

I have learned to deal with it and have made due so far. I am sure this will help some, thanks for your contribution.