Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Server Setters; RPC are broken #2787

Open
spacevx opened this issue Sep 12, 2024 · 41 comments
Open

Implement Server Setters; RPC are broken #2787

spacevx opened this issue Sep 12, 2024 · 41 comments
Labels
enhancement Feature or other request that adds functionality or improved usability onesync status:discussing Request is currently being discussed before being (re)triaged status:needs info Requires more info before this issue/PR can move on status:needs planning Hard issues that take time as there's no 'one' obvious way.

Comments

@spacevx
Copy link
Contributor

spacevx commented Sep 12, 2024

Feature Request: Server Setters for Authority and Stability

Background

For a considerable time, many developers have been requesting Server Setters as an alternative to RPC natives. It's widely acknowledged in the FiveM community that RPC natives are often unstable or broken.

@prikolium-cfx mentioned the reliability issues of RPC natives in this pull request.

Current Issues

  1. Unreliability of RPC Natives:

    • Blip natives work approximately 20% of the time.
    • SetPedConfigFlag and vehicle RPC natives frequently require workarounds. (when they work)
    • Developers often need to implement delays to ensure entity existence before manipulation.
  2. Lack of Server Authority:

    • Current methods heavily rely on client-side operations, reducing server control.
  3. Code Cleanliness:

    • Reliance on RPC natives often leads to complex, less maintainable code.

Proposed Solution

Implement a comprehensive set of Server Setters to complement existing server-side functions.

Current Server-Side Functions

  • CreateVehicleServerSetter
  • CreatePed
  • CreateObjectNoOffset

While these are beneficial, they are insufficient for a robust server API.

Requested Server Setters

Please note that this list is not exhaustive and is intended to provide examples of the types of setters that would be useful:

Entity Setters

  • SetEntityHeading
  • SetEntityCoords
  • SetEntityRotation
  • SetEntityVelocity

Vehicle Setters

  • SetVehicleNumberPlateText
  • SetVehicleDoorsLocked

Vehicle Modification Setters

  • GetVehicleMod
  • GetVehicleModKit
  • GetVehicleModKitType
  • GetVehicleModVariation
  • SetVehicleMod
  • SetVehicleModKit

Benefits

  1. Server Authority:

    • Direct server control over entity properties and behaviors.
  2. Improved Stability:

    • Reduction in reliance on unstable RPC natives.
  3. Cleaner Code:

    • Simplified server-side logic without complex client-side workarounds.
  4. Better Synchronization:

    • Potential for improved entity sync across clients.

Use Cases

  1. Vehicle Management:

    • Server can directly modify vehicle properties (e.g., locking doors, changing plates) without client intervention.
  2. NPC Behavior Control:

    • Precise control over NPC movements and actions from the server.
  3. Anti-Cheat Measures:

    • Server can validate and correct entities properties to prevent client-side manipulation.
  4. Manipulating multiple entities :

    • Server can orchestrate complex scenarios by manipulating multiple entities simultaneously.

Expected result

Server setters

Reproduction steps

  1. Use RPC natives
  2. See rpc natives are broken
  3. Use weird workaround to use them or directly use client side code

Importancy

There's a workaround

Area(s)

FiveM, FXServer, OneSync, Natives

Specific version(s)

Every version

Additional information

No response

@spacevx spacevx added bug triage Needs a preliminary assessment to determine the urgency and required action labels Sep 12, 2024
@DaniGP17
Copy link
Contributor

I think it is a very good idea, I have had experience when creating scripts that needed to modify the modifications of a vehicle from the server side, I have always had to assign to a client the need to assign these modifications, with this proposal I think it can solve many problems of this style and not depend so much on the clients.

@Wilfred4
Copy link

I currently have a race server, and that would be a game changer for us, we have so much tricky code and have to do callback from the client, server functions would be awesome

@Banes-dev
Copy link

Like a lot of developper, i had do a customisation script for vehicle, and the dream of all developper are do this is possibility to put this in server side

@s1nyx
Copy link

s1nyx commented Sep 12, 2024

Hi,

Couldn't agree more. It's clearly a must-have, not a nice to have.

@Tygaugh
Copy link

Tygaugh commented Sep 12, 2024

Yes it's a good idea, we need this since a long time ago, like also for the blips ( SetColourBlip, Scale etc...)

@DevSekai
Copy link

We need this !!

@pablo-1610
Copy link

Excellent idea, we need more control over clients 👏

@Mathu-lmn
Copy link
Contributor

👍🏻 Needed those many times for years !

@Sayzx
Copy link

Sayzx commented Sep 12, 2024

👍🏻 Good idea we need this !!!!

@ekaliclua
Copy link

I completely agree with this, and it’s essential that we implement it to maintain control over the players. 👏

@matthias18771
Copy link
Contributor

matthias18771 commented Sep 12, 2024

This would be very sick! It would be very helpful to be able to set various stuff server-sided, including the ability to completely manage entities on the server. It's currently very annoying, in my case I'm spawning vehicles serversided and to apply vehicle properties, I need to have a client to do that, which is kind of annoying.

@yveltdev
Copy link

Nice idea ! <3

@SertinoxVS
Copy link

It's a realy good idea can had lot of control !

we need this !

@BuddiesTV
Copy link

This is definitely needed! It would give serverside more control, which is great for a lot of reasons - especially when it comes to dealing with cheaters.

@ShadowCodding
Copy link

This is a great idea

@spoty123
Copy link
Contributor

spoty123 commented Sep 12, 2024

This feature is one of the most needed and requested features that FiveM can offer.
The current situation is that servers must use client callbacks or statebags (which have their issues), forcing servers to rely on the client to perform simple utilities, such as changing a vehicle's license plate upon spawn.
Having the ability to perform these kinds of tasks via the server, would simplify the logic of scripts drastically, and would also certainly prevent sync and entity ownership issues many developers run into when trying to set features on an entity.

@OffSey
Copy link

OffSey commented Sep 12, 2024

I approve of this wonderful idea! 👍

@DeVerino-DVR
Copy link

Yes, an excellent idea and nothing but the Simplification of the code I approve

@MelissssaEL
Copy link

Oh yes, that would be amazing!

@Rubylium
Copy link

It would be very useful to fully handle entity creation on the server side. Hoping for the proper implementation. 👍

@Dolyyyy
Copy link

Dolyyyy commented Sep 12, 2024

This possibility would be incredible. Relying on the client for basic tasks complicates development. Server-side control would simplify scripts (no need to navigate client -> server several times for nothing) and eliminate unnecessary callbacks, for example.

@Korioz
Copy link
Contributor

Korioz commented Sep 12, 2024

This is needed for years and was issued by blattersturm through #960, i don't know why so many reactions here but that's nice to see we are not a minority requesting it, we don't want a lot but mainly natives that are top priority like SET_ENTITY_HEADING, SET_ENTITY_COORDS and such.

I believe that scripting should be really easy and that means that scripters should not have to think about how to handle entity syncing too much, adding server-setters natives will help this.

While i'm at it please take a look at #962 and #836 because these are also must haves for a more server authoritative networking design.

@BrownyProd
Copy link

Great idea! Implementing Server Setters across all entity types, not just vehicles and NPCs, would significantly improve server stability and control. This would reduce reliance on unstable RPC natives, clean up code, and enhance synchronization across clients. Expanding the setter options would also improve server authority over objects, blips, and player properties, making things more reliable and efficient. Looking forward to this!

@ook3D
Copy link
Contributor

ook3D commented Sep 12, 2024

Looking forward to this!

you realize this is just an issue right not a pull request?

@BrownyProd
Copy link

you realize this is just an issue right not a pull request?

And so I can't look forward to something actually useful being (hope so) implemented?

@ook3D
Copy link
Contributor

ook3D commented Sep 12, 2024

you realize this is just an issue right not a pull request?

And so I can't look forward to something actually useful being (hope so) implemented?

I mean sure go for it, but you're going to be waiting months

@spacevx
Copy link
Contributor Author

spacevx commented Sep 12, 2024

Then we will be waiting for months

@Skyness60
Copy link

Good idea ☑️👍🏼

@myrm1003
Copy link

My server currently uses client-side vehicles, since server vehicles are broken at the moment. The development of a reliable server API for vehicles is needed, along with server setters. I'm looking forward to this.

@yiruzu
Copy link

yiruzu commented Sep 13, 2024

This is definitely needed! I hope these get implemented soon!

@mrdop51
Copy link

mrdop51 commented Sep 13, 2024

Excellent idea, it improves control and security. I take this example mentioned by @Dolyyyy : "(no need to navigate client -> server several times for nothing) and eliminate unnecessary callbacks, for example."

@epyidev
Copy link

epyidev commented Sep 13, 2024

Nice idea 👍

@nihonium-cfx nihonium-cfx added enhancement Feature or other request that adds functionality or improved usability status:needs info Requires more info before this issue/PR can move on status:needs planning Hard issues that take time as there's no 'one' obvious way. onesync status:discussing Request is currently being discussed before being (re)triaged and removed bug triage Needs a preliminary assessment to determine the urgency and required action labels Sep 13, 2024
@KillStr3aK
Copy link

Excellent idea, it improves control and security. I take this example mentioned by @Dolyyyy : "(no need to navigate client -> server several times for nothing) and eliminate unnecessary callbacks, for example."

currently it is implemented like that because entities does not exists on the server side in the way they exists on the clients

this all sounds good but it wasn't implemented yet for its own reason and not because they just didn't wanted to make peoples life and scripting easier, this will require a lot of planning

@razakmhd
Copy link

I'm creating mission scripts just like in gta online and i'm waiting for this, on SAMP things were easier :)

@Shino-World
Copy link

Nice idea bro👍

@thelindat
Copy link
Contributor

thelindat commented Sep 15, 2024

👍🏻 Good idea we need this !!!!

Well thank god you and the 30 other muppets posted "good idea!!!". Really contributing to the discussion there champ.

@Pedro-Lucas14
Copy link

Nice idea 👍

@ook3D
Copy link
Contributor

ook3D commented Sep 17, 2024

Nice idea 👍

Thanks for the valuable input, we didn't see the first 30 replies from mindless drones flocking here

@ook3D

This comment was marked as outdated.

@Firou91
Copy link

Firou91 commented Sep 20, 2024

Server Setters for Authority and Stability (Response to Feature Request)

I find this request very relevant, as it addresses key issues that developers often encounter due to over-reliance on native RPC. Here are some thoughts and additions on the subject:

Current problems

Instability of native RPC

It's true that RPC natives present reliability problems, especially when it comes to server-side entity manipulation. This leads not only to random bugs, but also to inconsistencies in entity synchronization between clients. Many developers circumvent these limitations by using delays and other less-than-optimal methods. It would indeed be beneficial to have reliable server setters to get around these difficulties.

Lack of Server Authority

Server-side entity management is limited by the current implementation, which leaves a great deal of responsibility to the client. Introducing server-setters would not only improve stability, but also enhance entity security and integrity. This would prevent unwanted client-side manipulation and offer better management of persistent entity states.

Suggestions for additional features

To complement your list of server setters, it might be interesting to add :

Setters for Dynamic Entities

  • SetPedComponentVariationServerSide**: To manage NPC clothing directly on the server side, which would improve scenarios involving uniforms, for example.
  • SetEntityVisibleServerSide**: To manage entity visibility without the need for a client call.

Improved synchronization

One of the major benefits of server-side setters is improved entity synchronization, particularly in environments with a large number of simultaneous interactions (e.g. RP servers). If the server can handle more entity-related aspects, this would avoid frequent desynchronization, especially on OneSync servers with lots of players.

Performance optimization

Reducing RPC calls could not only improve stability, but also lighten the load on the client side. By delegating more to the server, this would enable a better distribution of tasks, particularly beneficial for clients with more modest configurations.

Conclusion

This proposal to add server-side setters would be a major step forward in improving the stability, security and maintainability of FiveM servers. I strongly encourage this initiative and am curious to see how it could be integrated with the framework's current features.
Thank you for your suggestion, which I hope will be taken on board by the CFX team.

Can you not post these meaningless chatGPT replies, they do nothing helpful and only block any actual discussion.

I'm not going to bother arguing with you... I didn't know Deepl's translation made it sound so “CHATGPT” 🤷‍♂️. Honestly, stop making fabrications based on nonsense...

I've simply repeated what I understood and added my own words. If you don't like it, I can make a shorter reply.

@n3xuuu
Copy link

n3xuuu commented Nov 1, 2024

would love to see this happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature or other request that adds functionality or improved usability onesync status:discussing Request is currently being discussed before being (re)triaged status:needs info Requires more info before this issue/PR can move on status:needs planning Hard issues that take time as there's no 'one' obvious way.
Projects
None yet
Development

No branches or pull requests