Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Any universal tips on how to make code in game more systematic?

Asked by 6 years ago

I noticed that the bigger my RPG game gets the harder it is to maintain the code, to find the code, and to fix it. What are some tips you can give in order to make codes(in general) more efficient and systematic?

2 answers

Log in to vote
0
Answered by
Aorda 43
6 years ago

Be sure to always name your stuff well, from local scripts to remote events so you know what does what for what.

Also, always use filtering enabled and make good use of its benefits and do not use just one remote event for all actions, make a new remote event for each action. (This was proved to be better than just using one remote event in the performance side in RDC 2018)

Always indent your codes, which means do not ignore or remove the spacing created by Roblox or create them yourself using "TAB" if you removed them. That way, it will be a lot easier to read your codes.

Always use pcalls while doing stuff which may error and break the entire code. Be sure to use them especially in in-game purchases.

Ad
Log in to vote
0
Answered by
ozzyDrive 670 Moderation Voter
6 years ago

Writing good, clean, organized code is a skill that develops over time. It requires multiple iterations of projects. If you're happy with what you're writing now, you most likely will hate it after a couple months but that just means you're learning.

For designing your project -- especially on Roblox -- you want to look up modular programming. Another useful skill to master is object oriented programming, which helps managing different kinds of structures. My current project for example is really heavy on classes but it lacks the modularity. Generally you only want to have one script for the server and one for the client. These then manage initializing each end, whereas the modules handle the actual functionality.

Here's a paper regarding modular programming. You could also look through Roblox's Core-Script repo on GitHub and take some example from there. You don't need to straight up copy anyone, rather try and develop your own style yet one others can easily understand.

Answer this question