Here you will find Blog posts about atavism
Every player character and mob in Atavism uses properties to keep track of appearance, combat and other game progression information. Properties are generally given to the player/mob on creation and accessed and updated as events happen in the game.
Properties can only be created and updated by the server (to prevent synchronisation issues and cheating), and are sent down to the client as the player comes within range of another player or mob. The client (Unity) can listen for property changes and/or grab a property value from a player/mob and use it to display information in various ways (such as numbers/text in the user interface or the visual appearance of the player).
In Part I of this two part blog how to create properties for your players and mobs is explained below. Part II next week will cover how to access that data in Unity and set up listeners. Part II will also be accompanied by a tutorial to add a Title property to your characters which will be displayed beside their name.
Creating Properties for Players
Player properties can be added in different ways depending on the property type. Stat properties for combat (such as health, strength etc.) are added using the Stat plugin in the Atavism Editor (see more here: <insert page>). Other properties, such as appearance or general game progression properties, can be added either in the Character Creation scripts in Unity, or in the Character Template in the AGIS code on the server.
Adding Properties in Unity
Adding properties to the character creation in Unity is done by adding in a new entry to the properties map that is sent to the NetworkHelper.CreateCharacter() function. In the standard Atavism setup this is located in the LoginUI.cs file, in the DrawCharacterCreateUI() function, and in the UMA setup it is in the CharacterSelectionCreation.cs file, in the CreateCharacter() function.
Any new properties added in to via the Unity method need to have “custom:” at the start so the server knows not to confuse it with the standard properties. For example, an age property to be given to player characters upon creation:
properties.Add ("custom:age", 27);
Note: An example of a few properties are provided in the LoginUI file, commented out among the rest of the property setting code in the character creation.
Adding Properties in AGIS
Adding properties in the AGIS code is done by modifying the CharacterTemplate.java file found in the objects package. New properties need to be added to the template for a character which is setup in the createCharacter() function. Adding the properties in the AGIS code comes with the added complexity of deciding which Namespace the property should be added to (Namespaces relate to different areas of the server such as combat, inventory, world). Properties relating to combat should be added to the CombatClient.NAMESPACE, inventory related ones to InventoryClient.NAMESPACE, and most others to the WorldManagerClient.NAMESPACE. Other Namespaces exist, but I won’t go into detail here about what it all means as it is another topic in itself.
Note: All custom properties from Unity are added to the WorldManagerClient.NAMESPACE.
As an example, if I wanted to add the age property directly on the server rather than through Unity, I could add:
player.put(WorldManagerClient.NAMESPACE, "age", 27);
Creating Properties for Mobs
New Properties for mobs can only be done in the AGIS code, by editing the loadMobTemplates() function in the MobDatabase.java file located in the database package. Mobs use the same template system as the CharacterTemplate setup listed above. For example, mobs could be given an age property as well by adding:
tmpl.put(WorldManagerClient.NAMESPACE, "age ", 27);
to the loadMobTemplates function.
It is important to note that any new properties will only exist for newly created characters. You can always wipe all existing characters in your game by re-sourcing the install.sql file if needed.
All properties of your character, or of the player/mob you have targeted can be viewed by typing /props into the chat box when in game. It is a good idea to try this after creating a new property to make sure it is coming up as expected.