We need to create a table in our virtual world database to store the items. Similar to creating a table player's position in Chapter 6, Walking Around the World, we use PhpMyAdmin
to create the items
table with the following schema. The id
is an auto incremental primary key.
Field |
Type |
Description |
---|---|---|
|
|
Auto incremental ID for reference to a unique item entry. |
|
|
The type ID of the item, specifying which item it is. |
|
|
The owner avatar name of the item. |
|
|
The bag that this item is in. |
|
|
The position of the item inside the bag. |
|
|
The creation time of this item. |
|
|
Some string extra information. |
As items can be in the avatar's bag or placed somewhere else, the bag ID is used to indicate if the item is carried with the avatars.
The creation time of the item is useful to calculate the fatigue of...