• gEconomy - Stock market simulator in Gmod
    9 replies, posted
[B]Read updates below original post, as stuff has changed.[/B] Hello guys, it's quite late, and I've been working on this for a couple of days now. Right now it's at a playable state so I thought I get some of you to help me test it out. The server IP is [B]66.176.28.191:27015 [/B]Server is currently [B]Offline[/B] Here are some screenies. [t]http://cloud-4.steampowered.com/ugc/3296947906172266337/A408A2E05A893123AC4CCED21FE25A4FF97369EF/[/t] [t]http://cloud-4.steampowered.com/ugc/3296947906172265224/D3A710A8DFABD6A6AEC378235A0B10A7B9FA6964/[/t] [B]Update 1:[/B] [t]http://cloud-3.steampowered.com/ugc/3296947906174079245/23560931865EE14171E44C353422440BF593B556/[/t] No more chat spam with the notifications ( Not going to bother to format text any further as of now ) Removed the cheesy names, aiming for something more serious. [B]Update 2:[/B] Removed notifications from non-owned stocks, as these got quite annoying and I believe served no purpose. Instead of sending the whole stock table to the client, I send the ones that changed and client handles the replacement of the client sided version. This obviously reduced lag by a ton. Stocks are cycled through every 1/10 of a second, the prices will randomly change on their own, limited to a 5% maximum, loss or win. Stock prices are now affected more by the purchases of company stocks, rather than just waiting to get a higher profit, just stock price speculation is now possible. I'll probably have some sort of variable taking care of the upcoming price change, being limited, for example, each cycle it may either go -1, 0, or 1, that way you cannot get an abnormal -5% profit then a sudden 5% profit [B]Update 3:[/B] I have decided that I am going to simulate stock price changes, because all online APIs I found were useless, and it was a choochoofuck to deal with. I've redesigned the menu and created a buy button which opens up a frame similar to the one that the sell button opens. The "workplace" as I called it will now contain all stock updates such as price, high, low, percentage change, etc. It will also contain log notifications which were previously displayed in the chat. These will be colored differently to distinguish them from stock changes. I'm still having trouble deciding on what to do with the stock updates, here are my options: Make a refresh button on the frame header which will update the list, or make a custom list with a custom paint option which will display the stock data based on index. TL;DR Going to simulate stock changes. New menu. Notification area. [t]http://cloud-2.steampowered.com/ugc/3296947906283751262/F0E5BB724E8BE63DC0B5A4E72CCEF92A5C3971EF/[/t] [B]Update 4: [/B]Finished what I said in the previous update except the stock simulation. I think it's coming along quite nicely, the notifications update smoothly by using a global panel which can be inserted to from anywhere in client, in this case, when client receives a notification from the server. I just don't know what to do with that much empty space. I was planning on parsing the notification and splitting it into a table-ish kind of thing, to occupy more space. [t]http://cloud-2.steampowered.com/ugc/3296947906298949937/063FB19DFE9D7A83372CCA7F836AB306E4B01C0C/[/t] [B]Update 5:[/B] Created a simple map with computers. To open the menu you must press E on the computer monitor. [t]http://cloud-4.steampowered.com/ugc/3296947906307030300/9A20CECD4CB5B66D9D53C5DFF1738B0E02F549F1/[/t]
Please name the companies by gmod community names.
Oh wow, hadn't thought of that, at the moment it just generates a random name from mature words. Thanks. P.S. this is not intended to be anything serious, just an idea I got after playing some drug selling game, it was a very 5 minute gameplay thing, but still worth the 5 minutes.
I lost it when I saw "WIDEPOOP" and "ANALBOOK"
I can't join.
I probs won't work on it anymore today. I realized that randomizing the stock values wasn't as fun... I found an online api from finance yahoo, they supply you with info about stock, so I was planning on using that data, but I think the string is so large that it doesn't load it completely, JSONToTable doesn't error, and the table is nil. If I can't or won't bother to do it, instead of randomizing a value from like ( -20, 20 ) * 0.1 Instead I'll have to keep a counter that can only increment -1, remain, or 1 every refresh, that way it creates a smoother percentage change.
[QUOTE=McDunkable;45179343]I probs won't work on it anymore today. I realized that randomizing the stock values wasn't as fun... I found an online api from finance yahoo, they supply you with info about stock, so I was planning on using that data, but I think the string is so large that it doesn't load it completely, JSONToTable doesn't error, and the table is nil. If I can't or won't bother to do it, instead of randomizing a value from like ( -20, 20 ) * 0.1 Instead I'll have to keep a counter that can only increment -1, remain, or 1 every refresh, that way it creates a smoother percentage change.[/QUOTE] Using Yahoo finance won't be fun. It's real world finance data, where stock prices change by 0.01% with occasional 1% "crash". People will get bored.
I looked everywhere and couldn't find a free online API, I need the data preferably in JSON, but I'm sure there are plenty of XML libraries for Lua out there.
Server is online for those who want to try it out, I'll edit this post as soon as it goes offline once again. [editline]Offline[/editline] [B]Offline[/B]
[QUOTE=McDunkable;45185282]I looked everywhere and couldn't find a free online API, I need the data preferably in JSON, but I'm sure there are plenty of XML libraries for Lua out there.[/QUOTE] Parse the XML using a webserver and then create your own API :v:
Sorry, you need to Log In to post a reply to this thread.