What is the best way to handle a large number of tycoon droppers? Currently i add money at a certain rate on the server. Each dropper has its own “Money per second”, i add up each droppers “Money per second” and then apply that to the players stats every second. For example, 2 droppers that have a “Money per second” of 50 gold would apply 100 gold to their stats every second. Now for handling the effects on the client, what would be the best practice here? Currently i render one tycoon’s droppers at a time depending on how close you are. Then when the client is asked to load a tycoon it first disconnects any other loaded tycoon, then it loops through all the droppers and loads a function for that particular dropper. Alternatively a player can disable tycoon droppers and other animations locally in their settings.
So my questions are,
I recommend having the droppers client side, and they should all be running on one loop. The reason why you should chose client is so its more instant, and you wont be wasting server memory, so others wont experience lag. For the block reaching the end, to give the user money, you could do many things, what I am about to suggest can most likely be exploited. What I recommend to do , when the client’s part makes contact with the end part, it will fire the server with just the hit statement (function(hit) – you would fire the server with that. The server would then give the user the money and more, and the part would be destroyed client, what you could do is have values inside of the block indicating how much it’ll give, or you could have a module, and it would be set up like this;
["Part Name"] = MoneyToGive,
So you would name all parts to what you would have them set in the module. Now there are way more efficient ways to do this, and this isn’t the most efficient either, this is just an example to help you form an idea of how this would work.
Hope I helped!
How would firing the server when a part makes it to the end be better than what I’m currently doing (in the first part of my post.) ?
If you read my post, I did say that firing the server wasn’t the most efficient. What you are currently doing is killing the server memory, and it’ll cause a crazy ton of server lag, imagine 4-6 people just having droppers, the server would crash at one point.
Are you misunderstanding what i stated I’m doing in the first post? I don’t see how that kills server memory, if anything what you recommended does more on the server than what I’m currently doing. All my system does is update a players stats on the server every second. The server currently knows how much money a tycoon is making every second by going off of what droppers and upgrades the player currently has. All the server is doing every second is simply adding how much a tycoon should be making each second to the players existing money. If a tycoon should be making 500 gold each second (based on what they currently have purchased) then all the server is doing is adding 500 gold to their existing gold. How is updating one value every second killing server memory? Am i doing something wrong or was something misunderstood?
I am talking about the dropper system, your current system for what you just listed should be fine. I was talking about how your droppers, and the block cloning should be done client side, instead of server side. Because if done server side, there would be a lot of players with droppers, and it would kill the server memory.
Your post says;
I am unsure if you where talking about the droppers part cloning, or what you just stated, you didn’t really make it clear.
That’s referring to how the client renders the objects dropped from each dropper. Simply it would instance any object i want the dropper to drop with any added effects on the client and was just curious if that was good practice or not, mainly regarding the “One loop for all” idea or the “separate loop/thread” idea.
I think if you did one loop for all the blocks, like I previously mentioned, it would be a lot better than separate loops.