Differences
This shows you the differences between two versions of the page.
— |
guidelines:pogamut_3_item_message_processing [2011/12/22 15:08] (current) michal.bida created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Items and Inventory====== | ||
+ | |||
+ | == IInventory == | ||
+ | |||
+ | * get(id) | ||
+ | * getAll(interface) | ||
+ | * has(id) | ||
+ | * getCount(id) | ||
+ | |||
+ | Events | ||
+ | ItemPickUpEvent | ||
+ | ItemLostEvent | ||
+ | |||
+ | IWorldViewObject <- IWorldViewItem <- IWorldViewItemContainer | ||
+ | |||
+ | Note that there is no method " | ||
+ | |||
+ | ===== What is this about? ===== | ||
+ | |||
+ | |||
+ | As you can assume, there are plenty of items in UT2004 and some of them has some attributes. For instance a flak cannon is clearly a weapon, it can cause certain amount of damage and has a maximum of ammo you can stuff in it. As we can assume, those attributes does not change during the game and thus it is useless to send them all over again every time. Thus we can export those "fixed item characteristics" | ||
+ | Moreover a user can need his own items - let's say a cucumber, which has a certain taste, color and weight. So we need some way how to allow this and keep the communication low at the same time. | ||
+ | Problem is that every item has different attributes. More precise every item class has different variables - thus we need a mechanism that translates string identificator of the item class into real Java Object (preferably with real fields not string map). So we need ItemTranslator object. | ||
+ | |||
+ | =====Where the item is used in GB===== | ||
+ | |||
+ | The item (or more precisly it's class) is sent inside AIN, IPK and INV messages. AIN messages states that the you has gained a new item into it's inventory (comes only the first time the bot gets the item). IPK message tells you that you have just picked up some item. And INV message tells you that you see some item. Each of those three messages should be transformed into a certain event that will be propagated to the world view - the problem is that each of those events should have information about the item written inside themselves. That's why we will have an object that can return you an " | ||
+ | |||
+ | =====General idea===== | ||
+ | |||
+ | So the idea is the same: | ||
+ | 1) we make GameBots to send informations about item classes in the handshake (simply GB will iterate through all the items in the map and send those informations for every item class encountered) - it will be ITC message (ITemClass message) | ||
+ | 2) based on ITC message we will create a Java factory that will produce new item's (java objects) of that class | ||
+ | 2.1) those factories will be configured by the map of attribute_name: | ||
+ | 2.2) when INV, IPK, AIN message came it will take " | ||
+ | |||
+ | Just the item translator doesn' | ||
+ | |||
+ | New proposal. We will have allmighty ITC batch info message in the handshake. ITC message will recognize attributes of all UT weapons and inventory. Because not all of the weapons/ | ||
+ | The ITC message will consist of ITC {PickupType xPickus.RocketLauncherPickup} {InventoryType xWeapons.RocketLauncher} {1Damage 30} ...... a lot of other attrs. | ||
+ | |||
+ | This message will be accepted by a translator. Its position is marked on the picture below. It processes the given map of attributes and values and creates a factory which then produces configured items. | ||
+ | |||
+ | The problem is when we want to add some new item to UT at runtime. Solution: When using Pogamut add methods we will check if we have exported item of sel. class, if not we will send ITC message before spawning the object. | ||
+ | |||
+ | If some mutator does the same then the user will be notified that his bot sees something he doesn' | ||
+ | |||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | | ||
+ | |||
+ | * INV contains: | ||
+ | * Item item; | ||
+ | * Location location; | ||
+ | * boolean reachable; | ||
+ | * something else? | ||
+ | * IPK: | ||
+ | * Item item; | ||
+ | |||
+ | ===== Proposition of Item Hierarchy ===== | ||
+ | |||
+ | {{wiki: |