Skip to content

How to add new attributes

kytooooo edited this page Mar 16, 2021 · 10 revisions

How to add new attributes to entities?

In general, we can only use the attributes that come from the attribute system in NF's world. We have two kinds of data that can describe as attributes: static data and dynamic data.

What is static data?

The static data means the data can't be changed after loaded from configuration files, normally we called it as configuration data.

The only way to change the static data is to reload it when you want to fix some error data.

What is dynamic data?

The dynamic data means the data will be modified by business requirements then store into the database, normally we called it as player's data.


Each data in NF's world is an attribute(or record), it's the minimum data unit. The framework uses the excel files to design the attributes that belong to the player or global static data.

Let us have a look at what it looks like.

We can know from the graph that there have these attributes in the entity named Player

The attribute defined in Excel files located in [_Out/Server/NFDataCfg/Excel_Ini] will be transformed into code by utilizing the NFFileProcess application that will be located in [_Out/Server/NFDataCfg/Tool] after building the framework.

Besides the property name, also type and attributes can be defined:

  • Public: Whether to inform other players about the modification in this attribute. For example, the game server will broadcast the modification of the player's level if you set the value of "Public" as TRUE.
  • Private: Whether to inform the client about changes to this property. If this property is only meant to be visible to the server but not to the client, this attribute should be set to FALSE.
  • Save: Whether the property should be persisted in the database (i.e. the state should be stored on logout). This attribute should be set to FALSE for transient properties (e.g. a calculated total_hp property that combines character HP and equipment HP).
  • Cache: Store this property into Redis when offlane.
  • Ref: The content is the key of another entity
  • Upload: The client can upload the data for this property
  • Desc: A small description for the property.

Example: To add the new attribute Test for the Player entity.

Open the Player.xlsx and add a new Property like shown below: