Stupid Shit I Do: Making a Stock Market for Garrys Mod

By request of @MFZuul I'm making a post about this.

The other day I threw a link around about a short project that I did over a few days. Here it is.

http://steamcommunity.com/app/4000/discussions/5/135508833661808206/

In short I had been learning about Bernie Madoff on RadioLab and decided I wanted to know how a stock market worked. I wanted to come up with a set of equations that would give me a number of shares based on a set of specific variables. When I got to thinking about it I wanted to apply those variables and have something referential to have variables be attached to something. So, Garrys Mod DarkRP servers was the most practical thing to try and easiest thing to test in to see if I could make the math work in my favor.

It did.

So if you didn't click on the link or for some reason it becomes invalid, heres all the math I did.

===================================================
To cacalculate shares for a singular business

S=((D+F)*(B/1.35)) * T+15(cash put in)
Where S=Shares D=Doors owned F=Floors (multifloor building) B=Buildings T=Time on server (2 if fresh spawn, 5 if 1-3 hours (avg play time), 10 if on all day).

Example: So S=((2+1)*(1/1.35)) * 2+15(1000) is 33337 shares for a fresh spawn gun dealer.

To calculate for a multiperson business (drug gang, mob, many gun dealers working together)

S=(D*(B/1.5))*(P + Cash)

Where S = Shares D = Doors Owned B = buildings owned P = people in the organization and Cash = Cash paid to the company to open stocks.

Example = (4*(1/1.5))*(3+21000) = 56008 shares.

If the total number of shares has a large decimal, round up and ignore it.

====================================================

Prices for shares can vary as well. If your organization only has 56008 shares but is relatively large, price them high. If a hobo is opening a stock exchange price them low. High for a stock would be 250 bucks per share, low would be like 20 bucks per share.

If a company later wants to add more shares:

AS=TS*CC/2 OR /0.35

Where AS=Added Shares, TS=Total Server Time (can be approximate IE 2 and a half hours becomes 2.5), CC=Current Cash Added. If they want to add shares not long after they enter your stocks and have no money whatsoever relatively speaking, change the /2 to /0.35.

A player who opens stocks for their business automatically gets 50% of their stocks on the market. If a player has bought shares on top of the original 50% (say the have half of their 40 shares for sale and bought 2 more so the had 62% or whatever) and they want to cash out, they can recieve 50% of their original investment (say it cost tho person 20 bucks to open 40 shares, they recieve 10 of that back) plus the amount of their added shares.

If a player who owns shares from companies wants to sell their shares or cash them out:

Cash = (P*S) - 18%

Where Cash is Cash to the player, P is price of the shares to the current company (company can change the price if they want), and S is the number of shares. You can change the percentage but 18% of the cash out is the broker's.

======================================================================

Then I had to come up with some rules that would work in the investment holder's favor.

======================================================================

Abandoning the server or changing jobs without cashing out / closing your shares of your company will result in loss of that money made and will be kept by the broker. If a player (non-business owner) changes jobs, they can cash out whenever they want to. Business owners will need to cash out before changing jobs or leaving the server if they expect money back from their investments in.

Investment rankings are listed by how many thousands of dollars are invested into the company. If a company has 386,000 dollars total investment from the server, they have 386 points on the market.

====================================================================

Since I'm shit at making mods I had to create a way for the stocks to be displayed once calculated, so I did.

====================================================================

A basic board will look like this, optimally done on a textscreen:

.......................STOCKS
B1: Gundealer Associates (2) - 40001 Shares - $280 - 60 p

The business has 2 people, they own 2 doors and one building and invested 60000 into their opening shares. Because its a multiperson business / corporation the math done was

(2*(1/1.5))*(2+60000) = 800002

If I were the broker I would write down the name of the player and the amount of cash he/she put in and the number of shares they got, if I were the player I would do the same.

=======================================================================

And thats about it really.The math can be looked at and called odd but inside of a DarkRP server it all makes sense in the context of the game. Doors => buildings shows how much you are making. If you have a building with 18 doors and are still a single person company, your stock prices will be low but you'll have a fuck load of shares from your initial investment. Etc etc. It really was just an exercise to see if I could, like everything I do.

I don't know if it was fascinating for anyone, but for the record I went on a server, set up an office, and in 2 hours I went from the starting 15000 bucks to somewhere in the 3 million area going by the rules I wrote down. So, if you want a clusterfuck and like doing math like I do, give this a try!

If anyone wants to make a mod for this and use my equations / make one with me, I'm thinking about doing so. I am just awful at writing anything with a user interface. Let me know?

3 Likes