This is the multi-page printable view of this section.
Click here to print.
Return to the regular view of this page.
Trading Service
Trading Service
Trading Service Technical View
- Trading keeps a bank account for every player
- Trading debits bank account based on trading operation (Buy/Sell)
- Trading doesn’t care about game mechanics, it will happily sell you an upgrade for a non-existing robot and charge your account
- Trading announces prices at the start of each round
Player and Money
Trading saves a Player
. The playerId is known, by listening to the Player registered event of the game service.
Trading is also the only service which saves the money of the registered Player
as an attribute Money which is a numeric value.
Events for player
BankAccountInitialized
This event is produced when a player bank account is initialized.
BankAccountCleared
When a bank account has been cleared (at the end of a game).
BankAccountTransactionBooked
When the bank account has been charged.
TradablePrices
At the start of each round prices are announced
TradableSold
When something has been sold
TradableBought
When something has been bought
Service-oriented Functions
1 - Tradeables
Tradeables
Tradeables
Tradeables are Item, Resource, Restoration or Upgrade. They have an Name, Price and Type.
Resources
Resources types
Before you will be able to afford more than just your starting robot you will have to mine resources.
There are five resource types, which can be found on the planets.
These are the starting selling prices for the resources.
Value |
Name |
Price |
COAL |
Coal |
5 |
IRON |
Iron |
15 |
GEM |
Gem |
30 |
GOLD |
Gold |
50 |
PLATIN |
Platin |
60 |
Items
Value |
Name |
Description |
Price |
ROBOT |
Robot |
Buys another Robot |
100 |
Restorations
Value |
Name |
Description |
Price |
HEALTH_RESTORE |
Health restoration |
Heals the robot to full HP |
50 |
ENERGY_RESTORE |
Energy restoration |
Restores robot to full Energy |
75 |
Upgrades
Upgrades improve the variables of your robot. For example, a bigger health pool.
Upgrade types
Value |
Description |
STORAGE_N |
Storage Level N=1-5 Upgrade |
HEALTH_N |
Health Points Level N=1-5 Upgrade |
DAMAGE_N |
Damage Points Level N=1-5 Upgrade |
MINING_SPEED_N |
Mining Speed Level N=1-5 Upgrade |
MINING_N |
Mining Strength Level N=1-5 Upgrade |
MAX_ENERGY_N |
Energy Capacity Level N=1-5 Upgrade |
ENERGY_REGEN_N |
Energy Regen Level N=1-5 Upgrade |
MOVEMENT_SPEED_N |
Movement Speed Level N=1-5 Upgrade |
ATTACK_SPEED_N |
Attack Speed Level N=1-5 Upgrade |
MINING_EFFICIENCY_N |
Mining Efficiency Level N=1-5 Upgrade |
ENERGY_REGEN_SPEED_N |
Energy Regen Speed Level N=1-5 Upgrade |
Upgrade Prices
Level |
Price |
1 |
50 |
2 |
300 |
3 |
1500 |
4 |
4000 |
5 |
15000 |
Upgrade Restriction
There are two restrictions, when it comes to buying upgrades
:
-
You can only buy one upgrade
per robot per command. The reason for this is that an upgrade is seen as a single action. Just imagine it as giving your car to the shop for a tuning.
-
You can only buy an upgrade to the next level of the variable, you want to improve. For example, you only can upgrade your HEALTH_1 to HEALTH_2.
2 - Economy
Economy
Warning
The economy is a subject to change and is at the moment removed as a game mechanic.
However, It is likely that a eceonmy-concept will be part of the game at a later point. Therefore, you can keep this econmy here in your mind.
Economy
Price Economy
The special items and the resources in the game will have a simulated economy. This means that the prices will be adjusted according to a different parameter.
Every item and resource have an own economy entity. An economy consists of a buy/sell-history
and a stock/demand
. The item-stock will not influence the number of items that can be bought. Same for the resource-demand
. It will not influence how many resources can be sold. They are only a virtual parameter to simulate the price adjustments. Additionally, there is another parameter that determines a time range, over which the history should be analysed.
This economy basically implements a very easy form of price adjustments:
more items are bought => less stock => price high
less items are bought => more stock => price low
more resources are sold => less demand => price low
less resources are sold => more demand => price high
These economies will calculate new prices after every command-execution. The prices will then be published through their corresponding events.
All prices will always be Integers
.
Resources sell-price adjustments
There is a calculation done, which will be changing the prices of the resources gradually every round. For the calculation only matters how many resources of a certain type were sold in the past.
newPrice = ceil(originalPrice * historyFactor)
This factor is calculated as follows (if the factor is greater than or equals 1, the factor will be 1 and the price will stay the same):
historyFactor = resourceDemand / soldAmountInTimeRange
Example 1
demand = 10; sold = 15
factor = 10 / 15 = 0,66
factor <= 1
=> price will be changed by a factor of 0,66
Example 2
demand = 10; sold = 3
factor = 10 / 3 = 3,33
factor > 1
=> price will stay the same
Items buy-price adjustment
Items are calculated with the above presented buy-history factor and an additional round-adjusting:
newPrice = ceil(originalPrice * historyFactor * roundAdjust)
The buy-history factor is calculated as follows (if the factor is smaller than or equals 1, the factor will be 1 and the price will stay the same):
historyFactor = boughtAmountInTimeRange / itemStock
Example 1:
stock = 5; bought = 3
factor = 3 / 5 = 0,6
factor <= 1
=> price will stay the same
Example 2:
stock = 2; bought = 3
factor = 3 / 2 = 1,5
factor > 1
=> price will be changed by a factor of 1,5
Also, Items will be more expensive in the endgame phases, when players have collected more wealth. This ensures a fair play.
roundAdjust = floor(200 * (1 / (1 + e^(-0,014 * currentRound) * 199)))
3 - OpenAPI (Real Time MSD)
OpenAPI for the Real Time MSD
4 - AsyncAPI (Real Time MSD)
AsyncAPI for the Real Time MSD