One thing that made me interest to develop a FiveM server is it supports C# language. Thus, I can catch up quickly. I took about less than a month to develop a script for fivem, using C#, and my first script was an automated grab/taxi for player to call whenever they need it. If you have joined BBRP before, I believe U’ve heard about Melati Grab. She helps a lot when the players lost their car or they just to lazy to drive around the town. A lot of BBRP players like that script and it’s kinda motivates me. Because of that, I’d developed a few more scripts in C#. Everything went well until FiveM team decided to display a warning on high resource usage on the client’s (>5ms), and my players always received the alert.

BBRP stands for Bandar Baru Roleplay



Upon investigation, most of resource-hunger scripts in my server(BBRP) is coming from my custom resources and I found out that a script developed in C# having a little overhead caused by appdomain , it consume 0.04ms – 0.08ms sits idle. that means, if you have like 10 C# scripts, it uses 0.4ms doing nothing. Some developers said that this overhead usage is negligible, it doesn’t really affecting server’s performance but I don’t like it when the players keep comparing my server to others based on the resource usage.

Sometimes, It is hard to educate people about the reality

The workarounds for this issue are either to combine all the C# scripts into one resource, or convert the resources to Lua. for BBRP, I chose the former. I’d combined all my C# resources into one big resource. 10 resources to 1 resource, sounds good right? but wait, another issue arose, whenever I restart the big resource after made some changes, it will restart all 10 resources. Thus, it is affecting the players inside the game – some crashes, others stuttering, I know it isn’t the best practice to restart any scripts/resources in the live server, but shit happened though. And remember, I am the only developer for my server.

Other than that, C# is a compiled language , It makes the bug-fixing process slower, U have to compile the source code every time U fixed the bug. I’m not sure if there is any other way for C# in FiveM, but that’s what I did, and whenever U need to add something into the code, U need to compile it again. The process is quite tedious for FiveM server development. Because of those reasons, I decided to move from C# to Lua.

LUA

At first glance, lua looks like a python language, It is an interpreted language where you can just save the script as .lua and deploy it in the server. Thus, no overhead needed for lua. U can also modify the script directly from the server. I am also shocked with the learning curve, for me, it is easy to learn Lua than Javascript. On the side note, Lua still lacks features provided by other language such as classes, exception handling etc. But it is really great language for a framework like FiveM. U can easily track the errors via in-game console and best thing is, fix it directly in the server, needn’t any compilation.

For The Royal RP, I am no longer developing any custom scripts using C# to date. I am using Lua for every custom scripts that I made, and I believe that switching to Lua is the best decision.