Game Testers Needed | Supply & Demand concept

I’ve made this game at first for experimenting supply and demand markets, but now that I’ve put more effort into it, I’m really considering making an own game about it.

In this game, you can queue to buy or sell a vertial item, creatively named ‘stocks’. Every cycle (10 seconds) queues for buying and selling are proccessed.

When you buy/sell stocks, the prices are inflated. Starting price for each stock is 25, every 5 stocks bought inflates the price by 1% between 25 and 500. (approx 27.625)

Market is also effected by multiple layers of perlin noise.

Here’s the game: Supply & Demand | Game Test - Roblox

4 Likes

Sounds fun, ill give it a try!

I really like this concept, it’s pretty fun and interesting to play! One thing though, I gave it a quick try, and somehow I got negative stocks or negative money if I spam clicked on the button. Apart from that, it’s great so far!

1 Like

Yeah, I’m working on filtering so that negative stocks wouldn’t naturally happen.

Negative balance although I’ll keep, but for example buying loads of stocks and having a massive debt would be patched.

I’m also working on adding borrowing mechanics so that a player can borrow a number of stocks from another player and they will need to give it back in a certain amount of cycles.

If the player does not have the stock, they’d automatically buy the stock, no matter the price of it.
If the stock is on a downwards trojectory, borrowings can be made and the stock sold and then the stock rebought at a lower price to return to the stock leaser, making money from the difference.

My knowledge of these systems aren’t entirely complete and if I’ve got any gaps feel free to correct me.

1 Like

I’ve also added randomness to the company value (total stocks*stock price), which would add another, random layer that would also effect the market, although it does not seem to work yet. And yes, I will be fixing the number issues that lead to massive deciminal numbers (i.e: 199.99999999994 instead of 200)

Here’s the main script that queues and processes buys/sells/donations.

local Availablestocks = game.ReplicatedStorage.Stocks.availablestocks
local stockPrice = game.ReplicatedStorage.Stocks.price

local stockbought = game.ReplicatedStorage.Stocks.buy
local stocksold = game.ReplicatedStorage.Stocks.sell

local tempprice = 25
local tempstocks = 500

local clock = game.ReplicatedStorage.clock

type queue = 
	{
		[Players]: number
	}

local queuedsells : queue = {}
local queuedbuys : queue = {}

local savedplrdat : queue = {}



local function stockBuy(plr,val)
	print(val)
	if plr.leaderstats.balance.Value > 0 and tempstocks >= val then
		queuedbuys[plr] = val +( queuedbuys[plr] or 0)
		tempstocks-=val
	end
end

local function stockSell(plr,val)
	print(val)
	if plr.leaderstats.stocks.Value > 0 then
		if savedplrdat[plr] < plr.leaderstats.stocks.Value then
			savedplrdat[plr]+=val
			queuedsells[plr] = val + (queuedsells[plr] or 0)
			tempstocks+=val
			if queuedsells[plr] > plr.leaderstats.stocks.Value then
				queuedsells[plr]-=1
				tempstocks-=1
			end
		end
	end
end

local function returnDeadstock(plr)
	if plr.leaderstats then
		tempstocks+=plr.leaderstats.stocks.Value
	end
end

local function RunClock()Availablestocks.Value = tempstocks
	if Availablestocks.Value == 0 then Availablestocks.Value = 1 end
	tempprice = (500/Availablestocks.Value)*25
	stockPrice.Value = tempprice
	for plr, stocks in queuedbuys do
		plr.leaderstats.stocks.Value += stocks
		plr.leaderstats.balance.Value -= stocks * tempprice
	end
	for plr, stocks in queuedsells do
		plr.leaderstats.stocks.Value -= stocks
		plr.leaderstats.balance.Value += stocks * tempprice
	end
	queuedsells = {}
	queuedbuys = {}
end

local function donate(plr,otherplr,amount)
	if plr.leaderstats.balance.Value >= amount then
		otherplr.leaderstats.balance.Value += amount
		plr.leaderstats.balance.Value -= amount
	end
end

stockbought.OnServerEvent:Connect(stockBuy)
stocksold.OnServerEvent:Connect(stockSell)
game.Players.PlayerRemoving:Connect(returnDeadstock)
clock.Event:Connect(RunClock)
game.ReplicatedStorage.donate.OnServerEvent:Connect(donate)

The script also makes sure when a player leaves, the stocks are returned to the system, or else with each player leave the stocks are lost forever

1 Like

MAJOR UPDATE!

Here are some of the things I’ve added!

  • Stock values randomly effected with 2 layers of noise and 1 layer of randomness
  • Patched negative stocks
  • Limited negative balance to -50
  • Changed some UI designs
  • Most glitched numbers i.e 0.99999999994 have been patched with rounding.
  • Stock prices can now be in the 1st decimal place, previosly they were only integers
  • Balance also now accounted in only 1st decimal place
2 Likes

Love the idea. I’ll be sure to check it out.

Yep that makes sense!

The new mechanics that you’ve added sound cool, I’ll give them a try at some point and let you know if I have any other feedback or found any bugs.

With some more work, I could see this being a mildly popular game! I mean that in a nice way, lol :tongue:

Sneak Peek!

Still working on UI right now but once I’m done with that I should be able to release Delicate Stocks.

A gamepass for smartbuy will also be added, automatically buying/selling stocks with 95%+ accuracy.
I’ve also already implemented bots. Bots start with 10 cash and have this smartbuy system installed on them. There are a bout 5 bots. Since bots are very accurate with investing, they tend to buy up much of the market quickly and cause it to be an unstable mess. To solve this once all of the bots combined own over 14% of all the stocks, they are forced to sell all their stocks and lose 85% of their balances.

Datastores will also be added. Only the balance would be stored as stock prices will vary between servers. Once a player leaves they automatically sell all their stocks and the new balance then gets saved.

Any more ideas for the release? I’d love to hear them!

1 Like

BETA 0.1 HAS RELEASED, MORE INFOHERE