### EnderEngine

**The EnderEngine is a brand new Dynamic Pricing Engine, introduced to DynamicEconom in v.8.9. This radically new way of calculating item prices is** *scalable, efficient, unique, customizable, and realistic*.

#### How EnderEngine works

Previously, DynamicEconomy determined prices dynamically simply by adding or subtracting a set value, called a *velocity* to the price of an item for each unit of the item sold or bought.

EnderEngine takes a radically different approach: It uses a strict mathematical formula based on the item ceiling, floor, "span", and most importantly, stock. So, essentially, the price of an item is based on the stock, or, quantity of it available in the market.

**Why does this work?** Following the principles of basic economics, **demand** gets what we call *inelastic* when stock approaches 0, and *elastic* when stock approaches infinity. In essence, any aspect of demand can be meaningfully expressed through supply (stock).

Above is the formula used by EnderEngine to calculate price. In this formula:

- c represents the ceiling value of an item
- f represents the floor value of an item
- s represents the "span" of an item
- x represents the stock of an item

There are two important effects of using this mathematical formula to calculate price:

- Price will ALWAYS fall between ceiling and floor. It will be equal to floor when the stock is approaching infinity, and equal to ceiling when the stock is equal to 0. This is represented by the following limits:
- In between a stock of 0 and infinity, price will change naturally and fluidly. In addition, the higher the "span", the slower the price will change; the lower the "span", the faster the price will change.

### How to use EnderEngine

Using EnderEngine to its maximum potential, much like using DynamicEconomy, is all about tweaking it to work for you and your server. There are a few important aspects you should address upon installing DE v.8.9 or later (which have EE).

##### Stock

Stock is the ultimate and sole determinant of the price of an item (generally speaking). As you increase the stock, the price decreases. As you decrease the stock, the price increases. This makes sense because when an item is more rare, it's expensive, and when it's very common, it's cheap. As such, there is no longer a /setprice command like the one that existed pre-EnderEngine. In order to set the price of an item, you must simply modify its stock. As soon as stock is modified, the price will adjust according to the EnderEngine calculations.

##### Span

Span is a special property that replaced "velocity" from pre-EnderEngine DE (yes, meaning /getvelocity, /setvelocity, and velocity dynamicsigns are gone).
Span determines how fast or how slow the price of an item changes. The higher the span, the slower the price of an item will change because the curve (the curve of the EE function) is more stretched out. The lower the span, the faster the price of an item will change because the curve is less stretched out.
**What does this mean for you?** Well, it means that setting the right span is very important for having fluid and good prices for any item. Follow these two rules of thumb:

- For items that either A) Usually have an extremely high stock (like dirt, cobble, etc), or B) Are generally cheap and useless (dirt, cobble, etc), set a
**HIGH**span. For example, many users sell dirt, and rarely users will buy it. Dirt is also very cheap, usually less than $1 or even $1/2. Therefore, setting a high span will mean that it will take a LARGE stock (hundreds of thousands or millions) of the item for it to be worth its floor price. Additionally, a high span means the price of the item will change relatively slowly. So instead of selling 1 dirt and seeing a price change of $0.20, you'd see a very tiny price change, sometimes < $.001 - For items that either A) Usually have a generally low or extremely low stock (rarities like diamonds), or B) Have a very high price, set a
**LOW**span. For example, few users sell diamond OR diamond is very expensive (one of the two is usually the case). Since diamonds don't enter or leave the market often, you'd want a higher effect on price for every diamond sold/bought, which is what a low span accomplishes. Additionally, having a lower span means that a diamond will reach its floor or ceiling price faster.

Here's a few graphs, to show you visually. They are all graphs of the price of diamond, based on stock, with a ceiling of 900 and floor of 450.

This graph shows diamond with a span of 100. You see that even after a stock of 1800, diamonds price is still at about a little over 500, so it's not approaching its floor price very fast at all. This is a pretty bad choice of span for diamond, because you'd have to sell tens of thousands of them before the price reaches the floor price.

This graph shows diamond with a span of 1. You can see that diamond gets to its floor price relatively quickly compared to the last graph, yet not that quick (1000 diamonds is a lot!). So while you want the floor price to be at an extreme stock, you don't want it to be extreme as to be unachievable, but extreme enough. This is a good choice of span for diamond.

This graph shows diamond with a span of .1, or, 1/10. You can see that diamond gets to its floor price VERY fast, after less than 500 sales. This is a good choice of span for diamond as well, for the same reasons as the last one. Honestly, it all depends on how much you think is "extreme" as a stock value on your server.

### Prediction

Sine EnderEngine follows this straightforward mathematical formula, I urge you to take advantage of that. By clicking HERE you will be taken to a page on WolframAlpha with this formula inputted. Simply put in the settings for your respective item, such as floor, ceiling, stock, and span, and you will be able to see what the price would be at that stock level. Additionally, you can graph this function on an online graphing calculator and see the curve for your particular settings, and it will show how fast or slow an item changes.

## Comments