Atavism Blog

Atavism Blog

Here you will find Blog posts about atavism

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that have been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Team Blogs
    Team Blogs Find your favorite team blogs here.
  • Login
    Login Login form
Subscribe to this list via RSS Blog posts tagged in properties
Creating and Accessing Properties Part I

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 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 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.


Final Notes

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.






Tagged in: atavism MMO properties
Hits: 3549



S5 Box

Sign On