[MOD] Commodities markets [0.3] [commoditymarket]

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

[MOD] Commodities markets [0.3] [commoditymarket]

by FaceDeer » Post

This mod implements marketplaces where players can post buy and sell offers for various items, allowing for organic market forces to determine the relative values of the resources in a world.

The basic market interface is the same across all markets and market types, but this mod allows for a variety of different ways that markets can be configured to support different playstyles. Markets can have restrictions on what they will allow to be bought and sold, different types of "currency", and can share a common inventory across multiple locations or can be localized to just one spot at the discretion of the server owner.

Image

Currency

Each market has one or more "currency" items defined that are treated differently from the other items that can be bought and sold there. Currency items are translated into a player's currency balance rather than being bought and sold directly.

For example, the default market offered by this mod has this currency definition:

Code: Select all

	{
		["default:gold_ingot"] = 1000,
		["commoditymarket:gold_coin"] = 1
	}
When a gold ingot is added to the player's market account it turns into 1000 units of currency. When a gold coin is added it turns into 1 unit of currency. You can't buy and sell gold directly in this market, it is instead the "standard" by which the value of other items is measured.

There's no reason that all markets in a given world have to use the same currency. Having variety in currency types adds flavour to the world and also introduces opportunities for enterprising traders to make a profit by moneychanging between different marketplaces.

Account Inventory

In addition to tracking a player's currency balance, each player's account has an inventory that serves as a holding area for items that are destined to be sold or that have been bought by the player but not yet retrieved. This inventory is a bit different from the standard Minetest inventory in that it doesn't hold individual item "stacks", allowing for larger quantities of items to be accumulated than would otherwise be practical. If a player needs to buy 20,000 stone bricks for a major construction project then their account's inventory will hold that.

To prevent abuse of the market inventory as a free storage space, or just to add some unique flavor to a particular market, a limit on the inventory's size can be added. This limit only affects transfers from a player's personal inventory into the market inventory; the limit can be exceeded by incoming items being sold to the player.

Note that tools cannot be added to the market inventory if they have any wear on them, nor can the market handle items with attached metadata (such as books that have had text added to them).

Placing a "Buy" Order

A buy order is an offer to give a certain amount of currency in exchange for a particular type of item. To place a buy order go to the "Market Orders" tab of the market's interface and select the item from the list of items on the market. If the item isn't listed it may be that the market is simply "unaware" of the item's existence; try placing an example of the item into your personal inventory and if the item is permitted on the market a new entry will be added to Market Orders.

Enter the quantity and price you desire and then click the "buy" button to place a buy order.

If there are already "sell" orders for the item when you place a buy order, some or all of your buy order might be immediately fulfilled provided you are offering a sufficient price. Your purchases will be made at the price that the sell orders have been set to - if you were willing to pay 15 units of currency per item but someone was already offering to sell for 2 units of currency per item, you only pay 2 units for each of that offer's items.

If there aren't enough compatible sell orders to fulfill your buy order, the remainder will be placed into the market and made available for future sellers to see and fulfill if they agree to your price. Your buy order will immediately deduct the currency required for it from your account's balance, but if you cancel your order you will get that currency back - it's not gone until the order is actually fulfilled.

Double-click on your order in the orders list to cancel it.

Placing a "Sell" Order

Sell orders are an offer of a certain amount of an item and a price you're willing to accept in exchange for them. They're placed in a similar manner to buy orders, except by clicking the "sell" button instead of the "buy" button.

If there are already buyers with buy orders that meet or exceed your price, some or all of your sell order may be immediately fulfilled. You'll be paid the price that the buyers are offering rather than the amount you're demanding.

If any of your sell offer is left unfulfilled, the sell order will be added to the market for future buyers to see. The items for this offer will be immediately taken from your market inventory but if you cancel your order you will get those items back.

Double-click on your order in the orders list to cancel it.

Commands

This mod has several commands that a server administrator can use:
  • market.removeitem marketname item -- cancels all existing buy and sell orders for an item and removes its entry from the market tab. This is useful if you've changed what items are permitted in a particular market and need to clear out items that are no longer allowed.
  • market.show marketname -- opens the market's formspec
  • market.list -- lists the marketnames of all registered markets
If a corrupted market save state is preventing a world from loading, you can reset a market to its default state by going into the world folder and deleting the corresponding "market_<market name>.lua" file. This will delete whatever items players have put onto the market to that point, if you have a backup of a market_ file you can swap that in to revert the market's condition to how it was at that time. Please report any issues you encounter!

A collection of default markets

Image

The companion mod "commoditymarket_fantasy" contains a number of pre-defined markets that provide examples of what's possible with this mod. They can be enabled as-is with game settings and include:
  • King's Market - a basic sort of "commoner's marketplace", only open during the day
  • Night Market - the shadier side of commerce, only open during the night
  • Trader's Caravan - a type of market that players can build and place themselves, with a small inventory capacity.
  • Goblin Exchange - a strange marketplace that uses coal as a currency
  • Undermarket - where dark powers make their trades, using Mese as a currency
All of these except for the Trader's Caravan are intended to be placed in specific locations by server administrators or by mapgen, they can be set to be protected against being removed and don't have crafting recipes. Modifying these markets or creating your own from scratch should hopefully be a fairly straightforward task.

Dependencies

commoditymarket has optional depends = doc, mcl_formspec

commoditymarket_fantasy has depends = commoditymarket and optional depends = doc, lorebooks, default, mcl_core, mcl_sounds, mcl_chests, mesecons_wires

Downloads
This mod is released under the MIT license.
Last edited by FaceDeer on Mon Nov 30, 2020 08:07, edited 5 times in total.

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

Very interesting, so essentially, "eBay" for Minetest?

In my Linux server, the minetest world info gets stored into /var/games/minetest-server/.minetest/worlds/world/ I found the commoditymarkets data was getting saved into the "worlds" directory, and it required me to set "secure.enable_security" to false to get the game to boot up with the mod. For some reason "secure.trusted_mods = commoditymarket" hasn't been working for me on Debian. My server did this to me with Sokomine's mg_villages as well. I need resolve this first I think.

I found the interface a bit confusing at first, I think it makes more sense when it gets populated a bit, or one gets a bit familiar with it. Maybe the full item string name is too much? Just using the description field could simplify things a bit. However, dropping that and using description fields instead might result in confusion if mod items have the same description name. Should users be exposed to the item string names in the world? Perhaps that exposes the technical underbelly of the game a bit too much to the user?

I like the descriptions for each shop and the variations in currency used. I've held off using Minegeld or fiat in my game because I've wanted players to use items or gold to promote a more natural bartering and trading between people.

I can see how this system would make a lot of shops and vending machines already in the game and community obsolete. In my opinion, that would be a good thing, I don't like each player establishing a giant shop with a hundred vending machines, it seems too inefficient and after awhile, they are not very interesting to see, they are very redundant and large.

I know the "Laptop" mod has been looking for ways to make computers more useful. They were considering doing online banking with it. However, I think something like this could be an interesting utility to hook into for that as well. But that would likely change the way access to the shops work.

Looks cool!
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by rubenwardy » Post

This looks awesome! Is this a Continuous Double Auction? I need such a thing for buying and selling company stock eventually for my capitalism game
FreeGamers wrote:Maybe the full item string name is too much? Just using the description field could simplify things a bit. However, dropping that and using description fields instead might result in confusion if mod items have the same description name. Should users be exposed to the item string?
I suggest showing the item description and an icon
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [MOD] Commodities markets [commoditymarket] 0.1

by runs » Post

Very impressed.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

FreeGamers wrote:Very interesting, so essentially, "eBay" for Minetest?
Rubenwardy wrote:Is this a Continuous Double Auction? I need such a thing for buying and selling company stock eventually for my capitalism game.
It's not using auctions, unfortunately. There are no secret prices - you know up front exactly how much you're going to spend on a given "buy" or how much you'll get back from a given "sell" (provided there's anyone willing to meet the prices you're offering). You could simulate a Dutch auction by starting a "sell" at a high price and then over time repeatedly cancelling and reducing the price, but that'd take a lot of manual effort and require all the buyers to be online paying attention. Maybe I'll add options to automate that, or add a full blown secret auction mode, but I figured I'd stick with the basics for now to get started.

If you represent company stock with registered craftitems (actual physical certificates) then commoditiesmarket can already handle that out of the box. You can use the allow_item callback on a market def to restrict it to just those stock certificates. If they're more abstract things I'd need to know a bit more about how they're handled under the hood to see if I can tweak the code to handle them. I imagine you wouldn't want to use craftitems in the general case because there's no central way to track how much stock all players own, and you could physically lose stock in a lava pit or something (most real-life companies don't have to worry about that :)
FreeGamers wrote: In my Linux server, the minetest world info gets stored into /var/games/minetest-server/.minetest/worlds/world/ I found the commoditymarkets data was getting saved into the "worlds" directory, and it required me to set "secure.enable_security" to false to get the game to boot up with the mod. For some reason "secure.trusted_mods = commoditymarket" hasn't been working for me on Debian. My server did this to me with Sokomine's mg_villages as well. I need resolve this first I think.
I'm not sure why this is happening. When I save market data I use minetest.get_worldpath() to find the folder to use, which on my system gives me the folder that the particular world I'm in is using for save data. That should be considered "safe" to use, as far as I'm aware, I've used it before and never heard of problems. The lua_api.txt documentation says that method is "Useful for storing custom data", but also says it "returns e.g. `"/home/user/.minetest/world"`" which matches what you're seeing. It Works On My Machine™, though. I brought up a related question on the modding forum, I'll add this detail to it and confirm I'm using the right method.
FreeGamers wrote: I found the interface a bit confusing at first, I think it makes more sense when it gets populated a bit, or one gets a bit familiar with it. Maybe the full item string name is too much? Just using the description field could simplify things a bit. However, dropping that and using description fields instead might result in confusion if mod items have the same description name. Should users be exposed to the item string names in the world? Perhaps that exposes the technical underbelly of the game a bit too much to the user?
Rubenwardy wrote: I suggest showing the item description and an icon
I've tried hiding the item name and using just the description in other mods before and received complaints about doing so, apparently people like having the mod name visible because they see it as a way to group "related" items together conveniently. I suppose I can try doing what I do whenever I run into irreconcilable conflicts in user requirements - add some user configuration settings. In this case I already have handy "user account" data and a relatively sparsely-populated "info" tab in the formspec, so I've got a place I can put that configuration in-world so that individual users can choose their own settings. I'll give that a shot.

I also considered using icons, but the way formspecs handle images in tables is complicated so I figured "eh, I'll figure that out later if anybody turns out to like this thing." Seems like I might have to get to that now. :)
FreeGamers wrote: I like the descriptions for each shop and the variations in currency used. I've held off using Minegeld or fiat in my game because I've wanted players to use items or gold to promote a more natural bartering and trading between people.
I can imagine possibly modifying my code to do trades by barter, where you set the item desired along with the price for your order. But I went with using a defined currency for the same reason currencies get used in the real world - it's just so much simpler and more convenient to manage. A barter market would make it very difficult to figure out what prices are overall. If one player offers to buy 8 lumps of coal for 10 bushels of wheat, and another player offers to sell 10 lumps of coal for 100 stone cobble, I have no idea what I could do with that information to determine a "price." If there's a third player offering to exchange wheat for cobble I could perhaps automate all three trades somehow, provided the proportions demanded in exchange are compatible, but that's way more complicated than just comparing currency values.

I'll pencil that in to look at for version 2.0, perhaps. :)
FreeGamers wrote:I can see how this system would make a lot of shops and vending machines already in the game and community obsolete. In my opinion, that would be a good thing, I don't like each player establishing a giant shop with a hundred vending machines, it seems too inefficient and after awhile, they are not very interesting to see, they are very redundant and large.
Indeed, and the difficulty of finding what you want to buy or sell probably reduces the usage of such things a lot too. I do like the idea of there being some limitations on these markets, though. I've already put some framework in for restricting what items a market will deal with or how much capacity it is so that different markets can have different "flavor" and gravitate toward different niches. And most of the default markets are intended to be placed by server admins, so their locations can be kept distinct too. I like the idea of a player traveling back and forth between two markets doing arbitrage between them. But as with other things, I try to keep the system's behaviour configurable so you can have whatever play style you prefer.
FreeGamers wrote: I know the "Laptop" mod has been looking for ways to make computers more useful. They were considering doing online banking with it. However, I think something like this could be an interesting utility to hook into for that as well. But that would likely change the way access to the shops work.
Probably not as much as it might seem, you just need to call the method commoditymarket.show_market(market_name, player_name) to pop open the market formspec for use. I've never looked at the "laptop" mod but I could imagine it might have a place to put something like that. If not, I can do some tinkering to make the market formspec more easily embeddable inside other formspecs - I'll need that if I'm going to eventually allow the option to integrate this into SFINV anyway.

I take it this is the laptop mod in question? I'll drop a note in that forum thread mentioning commoditymarket to make sure they know about it.

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

Yes, thats the mod I was referring to. I think its a well done mod and its fun. But I just haven't been able to find much real use for it, the apps currently all have limited utility. I'm not suggesting you go out of your way to support it, it was just an idea that could probably work well for another mod or people that want to go a different direction or implement a single online commodity marketplace.

I also didn't mean to imply you should include auctions by referencing eBay, I use eBay for "Buy It Now" stuff a lot, and don't really consider it just for auctions anymore. I'm quite happy with setting static prices and buy orders. Markets should eventually just sort of settle on a fair price anyways. But auctions could be exciting now that **you** mention it :) That sort of depends on the amount of users active and searching, as you've previously stated.

By denouncing Minegeld as a currency and referencing bartering, I didn't mean to request a bartering system either. I quite like the standard gold/coal/etc standards of shops. Some acceptance of a standard currency is needed for convenient commerce anyways. In my game, I expected it to eventually be gold or ingots. I just didn't like implementing currency that was so analogous to real life fiat. One of the fun parts of a game is to get away from some of the tiresome oddities and mundane practices that life sometimes has, I just felt Minegeld imitated the real systems too closely. Bartering with stone for torches sounds like it would dilute listings.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by rubenwardy » Post

FaceDeer wrote:It's not using auctions, unfortunately. There are no secret prices - you know up front exactly how much you're going to spend on a given "buy" or how much you'll get back from a given "sell" (provided there's anyone willing to meet the prices you're offering). You could simulate a Dutch auction by starting a "sell" at a high price and then over time repeatedly cancelling and reducing the price, but that'd take a lot of manual effort and require all the buyers to be online paying attention. Maybe I'll add options to automate that, or add a full blown secret auction mode, but I figured I'd stick with the basics for now to get started.
This sounds pretty close to CDA. CDAs aren't like normal auctions. https://en.wikipedia.org/wiki/Double_auction
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

FreeGamers wrote:I also didn't mean to imply you should include auctions by referencing eBay, I use eBay for "Buy It Now" stuff a lot, and don't really consider it just for auctions anymore. I'm quite happy with setting static prices and buy orders. Markets should eventually just sort of settle on a fair price anyways. But auctions could be exciting now that **you** mention it :) That sort of depends on the amount of users active and searching, as you've previously stated.
Heh. Well, I'll shelve looking at full-blown auctions until later, then. Once all the other basic interface stuff has been sorted out, and maybe some of my other pressing mod updates are done.
FreeGamers wrote: By denouncing Minegeld as a currency and referencing bartering, I didn't mean to request a bartering system either.
Whew! Shelving that even farther back, then. That one seemed very complicated to handle indeed. :)

Are you okay with how I added the ability to split a gold ingot into 1000 "coins" for the default markets? I figured gold ingots would probably be considered too pricey to serve as the smallest unit of currency in their own right. If you don't like the coins (they're actually pretty useless) the markets will work perfectly fine without them, it just means players won't be able to withdraw their full currency balance from the market if they've got a fractional gold ingot in it. That's already the case with the Goblin Exchange and Undermarket, I didn't implement centilumps or Mese chips as explicit craftitems like I did with gold coins.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

rubenwardy wrote:This sounds pretty close to CDA. CDAs aren't like normal auctions. https://en.wikipedia.org/wiki/Double_auction
Sounds like commoditymarket would behave like a "double auction" if a buyer and a seller happened to simultaneously submit their buy and sell orders near-simultaneously, without refreshing their market formspecs and being aware of each others' prices. That, at least, would seem simple simple enough to automate - I could add the ability to submit a "pending" buy or sell order that gets automatically posted at a particular time interval.

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

Are you okay with how I added the ability to split a gold ingot into 1000 "coins" for the default markets?
Yes, I like it. I was going to search up a gold coin mod or something eventually, because I wasn't sure if ingots were too big of a unit to realistically use as currency. Could you imagine slapping one of those onto a counter-top? I believe you've already made it possible for admins to set the conversion rate of ingots to coin, so I have no worries there. I wasn't even anticipating needed that to be honest.

inb4 Federal Reserve Bank of Minetest, someone else was working on a cross-server currency system before. Also, someone was pitching to me the (bad) idea of selling in-game homes for some sort of real digital currency before too. "What hath God wrought!" Soon we'll have tax/vat collectors in game waiting for us when we surface from mining.
Last edited by FreeGamers on Sun Jul 28, 2019 18:53, edited 1 time in total.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

FreeGamers wrote: inb4 Federal Reserve Bank of Minetest, someone else was working on a cross-server currency system before. Also, someone was pitching to me the (bad) idea of selling in-game homes for some sort of real digital currency before too. "What hath God wrought!" Soon we'll have tax/vat collectors in game waiting for us when we surface from mining.
Heh. Taxes and other sorts of market-related fees are actually something I've got on my list of things to investigate as options to add to a market definition once I'm confident in the basic design of the mod working. Stuff like maybe having a % "withdrawal fee" on currency withdrawn from the market account to encourage continued economic activity instead, or maybe a "storage fee" to discourage people using the market as a free warehouse (the inventory limit is a simple shot at this already).

And I'd be lying if I said the thought "I wonder how I could integrate <insert favourite cryptocurrency> support into this..." never crossed my mind. I shooed that particular thought away immediately, of course. Minetest isn't Second Life. :)

Something else I've been considering is a system for server admins to set up simple "bots" to stimulate market activity and drive other in-game events. Like perhaps instead of having monsters drop piles of coins when you kill them, have them drop a monster ear and then have a bot post bounties for them on a market. Or offer to purchase stuff like gems that players might otherwise not care about digging for, or offer to sell items you want to inject into play in a controlled manner that wouldn't make sense to have just lying around in the wilderness. Haven't really thought about the details yet but it's on the horizon to ponder.

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

Heh. Taxes and other sorts of market-related fees are actually something I've got on my list of things to investigate as options
That's OK. stu has a musket mod for MT laying around in his git. I'll just have to upload that for disgruntled players frustrated with taxation. I can definitely see taxes being a cost of doing business at King's markets. That would likely incentive more use of the caravan traders.
% "withdrawal fee" / "storage fee".
*groans*... Ok well, the storage fee may be a good idea. I didn't even think of using it as an alternative to storage. I don't really see the point, chests are cheap enough, but I know there exists the player types that would figure this out as an cheap alternative to locked/protected chests. I'm not crazy about the withdrawal fee but I can see how it would encourage buying instead of withdrawing. Shouldn't the appeal of obtaining items with your gold be enough of an incentive to encourage purchases though? It also adds risk/cost to using the market. I imagine you could implement a fee onto sellers as well for using the market to liquidize goods (this is redundant with taxation I suppose). Hmm.. Lots of scope creep potential with this mod! Maybe stick to the core first? Its a cool idea for sure though.
simple "bots" to stimulate market activity
That does sound interesting. A capitalist's questing system.
Last edited by FreeGamers on Mon Jul 29, 2019 12:44, edited 1 time in total.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

FreeGamers wrote: *groans*...
Options! All just options! :)
FreeGamers wrote: Lots of scope creep potential with this mod! Maybe stick to the core first? Its a cool idea for sure though.
Indeed. I'll see if I can get the UI cleaned up a bit more later today, first. Make it so players actually like using the mod before presenting them with a fee assessment for using it.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

I just did a whole bunch of work on the interface.
  • Whether the itemname is displayed or not is now a setting that players can configure on the info tab of their market. It's not shared across markets, unfortunately - player accounts in each market are isolated from each other to make storing the data more compartmentalized.
  • Added little image icons to the market and inventory tables. This was, as I expected, a major pain. In addition to the arcane formspec syntax required, there's actually no way to get Minetest to give you an inventory image. this old issue suggests there used to be a hacky way to do it but Minetest no longer functions that way. So for items that don't have an explicit inventory_image defined the icon is just the +Z facing tile's texture. Should be good enough for most things at a glance, in combination with the item's name.
  • I added a few tooltips to various UI elements to make it easier to figure out what they're for.
Okay, whew. I'm taking a break now. :)

User avatar
Yvanhoe
Member
Posts: 140
Joined: Fri Jul 05, 2019 03:18
Location: Japan

Re: [MOD] Commodities markets [commoditymarket] 0.1

by Yvanhoe » Post

Nice! Now that will probably require a different kind of tech tree to be used, I did not really ever feel the need to buy much stuff on any servers...
rubenwardy wrote:I need such a thing for buying and selling company stock eventually for my capitalism game
Just found out about it: https://capitalismgame.rubenwardy.com/ looks really interesting! How does the markets work there? Do you abstract a consumer groups or do you rely on the players to create a demand for goods?

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by rubenwardy » Post

There will be consumer groups which will buy from shops depending on their demands and the shops location and pricing. Normal players can already buy from shops
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

Do you recommend disabling or whitelisting this mod through Minetest's mod security? I don't think you do or you'd likely have mentioned it somewhere already.

This is the message I get when I try to run this on my server:

Code: Select all

2019-07-29 06:37:29: ACTION[Main]: Server: Shutting down
2019-07-29 06:37:29: ERROR[Main]: ModError: Failed to load and run script from /usr/share/games/minetest/mods/lib_system/commoditymarket/init.lua:
2019-07-29 06:37:29: ERROR[Main]: Mod security: Blocked attempted read from /var/games/minetest-server/.minetest/worlds/world\market_caravan.lua
2019-07-29 06:37:29: ERROR[Main]: stack traceback:
2019-07-29 06:37:29: ERROR[Main]:       [C]: in function 'loadfile'
2019-07-29 06:37:29: ERROR[Main]:       ...minetest/mods/lib_system/commoditymarket/persistence.lua:169: in function 'load_market_data'
2019-07-29 06:37:29: ERROR[Main]:       ...ames/minetest/mods/lib_system/commoditymarket/market.lua:422: in function 'register_market'
2019-07-29 06:37:29: ERROR[Main]:       ...test/mods/lib_system/commoditymarket/default_markets.lua:130: in main chunk
2019-07-29 06:37:29: ERROR[Main]:       [C]: in function 'dofile'
2019-07-29 06:37:29: ERROR[Main]:       .../games/minetest/mods/lib_system/commoditymarket/init.lua:6: in main chunk
I'm thinking perhaps this is something looked over since you don't use GNU/Linux? We don't use backslashes for file directories. So it's trying to create a new file in "/var/games/minetest-server/.minetest/worlds/" called "world\market_caravan.lua" (This problem stems from directory syntax choices made all the way back in the 80's, GNU & Linux are both Unix-like, while Windows is DOS-like in this regard)

Looking forward to trying this though. I'm going to hold off until this is worked out so my save data isn't separated and because I really like to avoid turning off mod security if I can. I'm just going to start off with the caravan market and see how my few players take to that first.

That new screenshot on the OP looks nice! I still don't really like the stringnames being there, its too technical and redundant for players. But I'll see if I can adjust it via settings somewhere (a settingstype.txt switch would be nice). I think Au1000 is not as clear as 1000 Gold or Coal or even 1000 Au in the currency field. Also, something about the buy and sell button placement doesn't feel intuitive to me when I used it the other night. I'll have more feedback and suggestions for you after I try the mod more though. I like to pester server-regular players for feedback too.
Last edited by FreeGamers on Mon Jul 29, 2019 12:41, edited 11 times in total.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by rubenwardy » Post

Mods should always use forward slashes. Lua will correctly translate forward slashes to backwards slashes on Windows
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

Ah, that explains it. Switching to forward-slashes, hopefully that fixes the mod security problem.

I was thinking of having both a "currency_symbol" and "currency_name" on the market definition. Currently there's just the symbol, which fills the role of "$" and so in English it is supposed to be placed in front of the amount with no space between it and the number. I picked "Au" for gold's currency symbol as it's the atomic symbol for gold, the best I could think of at the time. However, I just remembered that European alchemy had symbols for representing various elements, and for gold they used the Sun's astrological sign: ☉. Unfortunately Minetest isn't rendering that unicode symbol for me, but it is managing the lesser-used alternative ☼. I'll try switching that symbol in for now, let me know if it's not showing up.

I suppose I can add a server-level override for the item names display. Though not this morning, that'll take a bit more coding than just swapping a few symbols around. :) I also just remembered that the text search filter is still operating on the itemstring even if it's not being displayed, I should fix that too.

The default markets are currently just a result of me going "I need to throw together a variety of these things to show off some of the variety the mod is capable of," so if you have any balance issues with how they're set up or any suggestions at all really for tweaking them by all means I'm game to implement them. In an earlier comment FreeGamers expressed disappointment with the appearance of the market nodes and I definitely agree in the case of the caravan market, I wanted something that looked like a wagon and I don't think just a cube works. But I haven't had time to do modeling for a proper replacement. Similarly, I don't think the Goblin and Under markets quite look right - Undermarket's supposed to look a bit like a sacrificial altar and I think that worked, but now it doesn't look so much like a shop. And the Goblin Exchange doesn't really look like something Goblins would run (though it amuses me to think that a Goblin shopkeeper would have a big crudely-drawn picture of his face on the front of his stall like that to show "this is mine"). I'll refine the art for that when I've got a chance.

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

A symbol would make more sense, but the players need to build the association with the symbol. I'm sure it will get associated through using the interface and experience. Could it be added contextually to the info-box to help this a long bit?
e.g: "yada yada yada, this shop uses gold (☼) currency".

Then keeping the symbol there would make more sense if you used the logo/symbol. I was remembered that Au meant gold luckily though.

I've already become accustomed to using the itemstring in a few guide menu searches and the default creative menu. So the search-bar for me will not be hard to use, but if there is a dissociation between searches and item description string, I would agree with you that it could be a confusing issue for end-users (players).

How will caravans manage buyer inventory? If a buyer adds an ingot and gets 1000 gold coin in the caravan inventory, but the seller's caravan moves, will the inventory coin for the player be accessible at other caravans? Can buyers add their own items to sell at other player's caravans? I would imagine, he/she could not. But If so, what happens when those shops move? Sorry, I'm sure testing will answer some of these questions, I'm going to check out the github now, but these uncertainties have lingered in my head for a day or so after pondering the appropriateness of this mod in my game.

I quite liked the goblin face, but I guess they likely wouldn't put their own face on their shop. I have the mob_goblins mod in my world, they are very cool, and match the face on your market node quite closely. I use duane's geomoria mod to produce abandoned dwarven citilike caverns undeground. This is where goblins tend to spawn and work. I could probably place a goblin shop in these ranges (-130, -170). But nonetheless, I look forward to seeing what you come up with.

I'll try the update now. (Edit: loaded up fine without errors).
  • So far noticed right off the bat, tool-ranks / description fields may be wrapping or toolranks is adding too many lines (see attached). Perhaps take just the first line? Also, how would worn tools be handled?
  • The icons are a really nice touch and a great suggestion by ruben. Very cool.
  • I like that the option to show string names is opt-in, not opt-out, so I'd like to withdraw my request for a settings type.
  • Without creating any buy/sell orders yet, I only see default items listed in the "Market Orders" tab. Hopefully this populates with orders added. (Edit: It certainly does populate new items as they are added)
  • Maybe it could simplify things even more to add a separate tabs for buy orders and sell orders. I'm talking dead simple though. I can follow this interface OK the more I study it. But most modern online marketplaces are so streamlined and easy to use, I personally would target creating a simple design that anyone could pickup and use.
  • Now that the symbol is present, I've built the associate of my currency units with the symbol very quickly. However, its more illusive that these represents gold coin as well and can be withdrawn. Not a big deal, and will be learned quickly upon using this system after trying the withdrawal function.
  • The hover tips are helpful.
  • Not really an issue but what if I really dislike one player and don't want to do business with them? There is no list of sellers. (I'm nitpicking here) But this is otherwise a very free and utilitarian market that sticks to the point.
  • A filter for items in supply or in demand could be helpful. (nevermind: it seems to auto-sort by volume)
Whats funny about this is there are no sales pitches, no shipping times, service fees, we're strictly in the realm of simple node economics. Its funny how when selling inventory is so homogenized, all that matters is competing on price. Marketing really plays an interesting role in business with added-value propositions like warranties, returns, loyalty discounts, promotions, branding, etc. etc. etc. Ned's Node Vending Machine Emporium is going to have a hard time keeping up in this decentralized market. I think you are going to end up doing to vending machine shops what online retail is doing to local retail.

Error report: Invalid table column option:"" (value="") after making a purchase from myself. Now its showing up a lot. I think this occurs when a player filters for items he has listed, but doesnt have any items listed.
Attachments
issues-with-tool-ranks-wrap-around.png
issues-with-tool-ranks-wrap-around.png (155.28 KiB) Viewed 2209 times
Last edited by FreeGamers on Mon Jul 29, 2019 18:36, edited 18 times in total.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

FreeGamers wrote:How will caravans manage buyer inventory? If a buyer adds an ingot and gets 1000 gold coin in the caravan inventory, but the seller's caravan moves, will the inventory coin for the player be accessible at other caravans? Can buyers add their own items to sell at other player's caravans? I would imagine, he/she could not. But If so, what happens when those shops move? Sorry, I'm sure testing will answer some of these questions, I'm going to check out the github now, but these uncertainties have lingered in my head for a day or so after pondering the appropriateness of this mod in my game.
All markets are "global" so the location of the node doesn't matter - all a node does is give something to right-click on to trigger the "show the market" code. So all caravan market nodes will open the same market, whatever you put into one will show up in all of them. This is one of the reasons I want to limit the temptation to use the market's inventory as a generic warehouse space, it's perhaps a little too convenient for just carting around mass quantities of stuff (markets in fixed locations like the King's Market probably aren't such a big deal for this).

The way I imagine it, putting down the caravan trader represents the player somehow summoning a wandering merchant rather than the player "owning" that particular caravan. Once the nitty-gritty coding side of this mod is settled and I've got time to spend on polish and art I'll try to make that a bit clearer, perhaps having the player craft a "trade flag" that they plunk down to summon a caravan and then a few minutes later a caravan spawns near it.
FreeGamers wrote: I quite liked the goblin face, but I guess they likely wouldn't put their own face on their shop. I have the mob_goblins mod in my world, they are very cool, and match the face on your market node quite closely.
I pulled the face off of that mod's goblin model so it should. The "coal goblin" specifically since goblin markets take coal. :) The thing that doesn't feel "gobliny" about the market to me is mainly the wood texture, though, so I'll leave the face in when I re-art it.

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

All markets are "global" so the location of the node doesn't matter
OK, I see that makes things a bit easier to understand.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FaceDeer » Post

FreeGamers wrote: So far noticed right off the bat, tool-ranks / description fields may be wrapping or toolranks is adding too many lines (see attached). Perhaps take just the first line? Also, how would worn tools be handled?
Odd, I haven't seen that even for very long descriptions. I take it your tools have a hard-coded line break in their description strings? I can have the table-making code replace line breaks with spaces, that might work. I already have code in there to truncate the description if it gets way too long.
FreeGamers wrote: Without creating any buy/sell orders yet, I only see default items listed in the "Market Orders" tab. Hopefully this populates with orders added. (Edit: It certainly does populate new items as they are added)
Yeah, I couldn't come up with a reliable programmatic way to identify all the nodes registered in the game that the player might end up with in their inventory while excluding stuff that they would never have, so I decided to just hard-code a starting list of default items and add the rest dynamically as the player tries sticking those things into their market inventories.
FreeGamers wrote: Maybe it could simplify things even more to add a separate tabs for buy orders and sell orders.
I'd actually rather not do that. The way the buy and sell orders are arranged now lets the player know at a glance where the current "market value" of the item currently stands - it's somewhere between the last sell order's price and the first buy order's price. It also lets them easily see total market depth at any given price. Eg, "I need to buy 3000 of this particular node, what price do I need to offer to ensure that I get that many from the current market?"
FreeGamers wrote: Not really an issue but what if I really dislike one player and don't want to do business with them? There is no list of sellers. (I'm nitpicking here) But this is otherwise a very free and utilitarian market that sticks to the point..
I had originally considered not putting the player name in there at all, anonymizing all of the buy and sell orders. But I needed to distinguish the player's own orders because he can double-click on those to cancel them, and just generally the player should know which ones are theirs.

If you like I could tweak it so that you don't see the names for other players, putting anonymity back in. Or I can set that as a configurable thing (it makes sense that some marketplaces would have know-your-customer regulations, like the King's Market, and others might be anonymous, like the Night Market.

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

Your tools have a hard-coded line break in their description strings?
Almost certainly, I used ToolRanks which encourages players to keep their tools from breaking and they get a slight durability and efficiency bonus per level they earn with it. It also tracks how many times its been used. Its quite good and I've seen it on quite a few servers. viewtopic.php?t=18056
so I decided to just hard-code a starting list of default items and add the rest dynamically as the player tries sticking those things into their market inventories.
OK, that sounds reasonable.
I'd actually rather not do that. The way the buy and sell orders are arranged now lets the player know at a glance where the current "market value" of the item currently stands
OK, I figured you'd had put some thought into the layout and things were in this design for some reason. Seeing both demand and supply at once definitely would lend itself to help determining a fair market value. I tend to think about how things are presented to players a lot and I probably have a bit of a bias to simplify things where possible and approaching stuff from that perspective often.
just generally the player should know which ones are theirs.
Right, OK, and that seems to be aided by the filter to your own option in the UI. That sounds like it could help players cancel orders of their own.
If you like I could tweak it so that you don't see the names for other players, putting anonymity back in. Or I can set that as a configurable thing (it makes sense that some marketplaces would have know-your-customer regulations, like the King's Market, and others might be anonymous, like the Night Market.
I'm not sure how to proceed on this front. If you want the market to be more free, you could keep it anonymous, if you want it to be more personal and variable, maybe player names could be helpful. I honestly haven't seen other player names yet. So I need to try the interface out more.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [MOD] Commodities markets [commoditymarket] 0.1

by FreeGamers » Post

Do you think the trader's caravan will make the other shops not commonly used? Its open 24/7 and accessible anywhere. What is the benefit of using the King's or Night shop instead? I know they are configurable and just simply meant to be templates to have other options, but could you share some thoughts on how these are intended to differentiate?

I walked two players through the process of buying and selling. I've also setup a introductory shop near our server spawn to familiarize newcomers to the idea of buying and selling with gold. If anyone would like to try it to see the interface, connect to Sara's Simple Survival Server. There is a trader's caravan setup right outside the main spawn point (pictured). Its to your left when you leave the noobcube. If it's night time, you may want to wait as mobs spawn at night.
Attachments
Screenshot from 2019-07-29 11-52-31.png
Screenshot from 2019-07-29 11-52-31.png (278.02 KiB) Viewed 2209 times
Last edited by FreeGamers on Mon Jul 29, 2019 17:40, edited 2 times in total.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests