This is the second dev blog. I can't promise a blog as riveting and easy to understand as @Noble's Last Dev Blog, though I'll try. Optimisation, it's a tricky topic.

What are we doing and where are we going?

Optimisation is a complaint we get a lot of complaints about, from the community, from staff and from me; yet fixing it isn't as simple as flicking a switch.

We've put a lot of planning into ensuring that the optimisation we do is actually worth it, and improves things for you, rather than just chucking code into the window, and praying for an improvement.

The optimisation overview plan.

This is the initial planning overview document, and we're still only on stage 2!

Collected data on current network and game performance.

Stage 1 - Data Collection

We've done a lot of data collection on the baseline, as you can see. We can move on from that, thankfully. There'll be more to do in time, but for now we can leave it.

Stage 2 - Networking

At higher populations, FPS can be bad, but normally it's not the worst. At higher populations, pings start shooting through the roof. We've already done some work with network optimisation in Revision 5368 but we still have more work to do. However, we've got pings down to an acceptable level, so we can focus more on client-side issues.

Stage 3 - Server-side Processing

Not a huge problem, but still can be an issue at higher populations, especially for things like driving. This is just slimming down the amount of stuff constantly running.

Stage 4 - Client-side Processing

Yeah, it's bad. Some systems can have frame-rates half on CityRP compared to other game-modes.

How to Optimise?

In general, resolving the issues we have is two-fold.

Firstly, we can reduce what we do. For example, instead of using heavy functions, we can use lighter approximations (these things don't need to be perfect, only good enough). This reduces the amount of work either you or the server have to do.

Secondly, we can reduce the number of times we do things. A light function becomes heavy if you use it 50,000,000 times a second. I can't really go into more detail, because it's always dependent on the individual bit of code being worked on. However, most of the times we can try and cut out useless or redundant loops, try not looping etc.

Why was this never done before?

It's difficult to say, because there's so many reasons.

Firstly, the history of CityRP has a lot to do with it.

The History of CityRP.

We're so old, there's a lot of older bits of code which need to be removed, but haven't been yet.

Secondly, we've had some poorer development practices in the past. Most of our developers haven't come from software development backgrounds. For example, @Faustie is self-taught. This has led to things sometimes being suboptimal. However, we are working to bring everyone up to speed, to ensure that future code is optimised, and as I said before, we're going over and rectifying the past now.

That's optimisation, that's what we've done and what's happening.