NativeMultiplayer: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
 
Line 16: Line 16:


== When should I use it? ==
== When should I use it? ==
If you're hosting a server that allows [[Resources/GTAIV/GameModes|built-in IV gamemodes]]
* If you're hosting a server that uses [[Resources/GTAIV/GameModes|built-in IV gamemodes]], you should use native multiplayer mode.
 
* If you're making a script that's similar to other MP mods like RAGEMP, MTA:SA, SA-MP, FiveM, etc, you should '''NOT''' use native multiplayer mode.
Or, uses a custom scripted gamemode, as long as it meets the following conditions:
* If your scripts need to keep track of elements or attach data to them, like a vehicle's owner for example, you should '''NOT''' use native multiplayer mode.
* Does not need to keep track of elements or attach data to them, like a vehicle's owner for example.
* If your scripts need to control which [[element.dimension|world players are in]], you should '''NOT''' use native multiplayer mode.
* Does not need to manage sessions or needs to keep everybody in the same "world".


== Some notes and technical info ==
== Some notes and technical info ==
* Using native multiplayer mode presents a challenge when trying to script a gamemode that needs to track elements. For example, a roleplay server might provide vehicle ownership but if the server doesn't know the vehicle exists, tying that data to the vehicle would be an issue. You could tell a client to spawn it, then report back with the newly spawned vehicle's ID, but as soon as the session is destroyed and/or another one is created, those ID's are useless. The ID's also change if the element is streamed out for everybody and no client has it in memory anymore. If you need to attach persistent data to an element, you should disable native multiplayer on your server
* Using native multiplayer mode presents a challenge when trying to script a gamemode that needs to track elements. For example, a roleplay server might provide vehicle ownership but if the server doesn't know the vehicle exists, tying that data to the vehicle would be an issue. You could tell a client to spawn it, then report back with the newly spawned vehicle's ID, but as soon as the session is destroyed and/or another one is created, those ID's are useless. The ID's also change if the element is streamed out for everybody and no client has it in memory anymore. If you need to attach persistent data to an element, you should disable native multiplayer on your server


* When using native multiplayer mode, you can't force players to create or join specific sessions (also called lobbies) with scripting. Each session has a player hosting it. Even if you have the phone disabled, the game might still place some players in different sessions with different hosts, and they won't be able to see players from another session. If you're trying to script a gamemode that needs everybody in the same "world" then you should disable native multiplayer on your server.
* When using native multiplayer mode, you can't force players to create or join specific sessions (also called lobbies) with scripting. Each session has a player hosting it. Even if you have the phone disabled, the game might still place some players in different sessions with different hosts, and they won't be able to see players from another session. If you're trying to script a gamemode that needs everybody in the same "world" or needs to control which world they're in then you should disable native multiplayer on your server.


* If you want to use elements in the same way as other GTA multiplayer mods, or the older games here on GTA Connected, you'll need to turn off native MP mode in server config. This will force GTAC to use it's own custom sync. Servers will be aware of elements and all can be handled using either GTAC functions or natives, although natives will only exist client-side.  
* If you want to use elements in the same way as other GTA multiplayer mods, or the older games here on GTA Connected, you'll need to turn off native MP mode in server config. This will force GTAC to use it's own custom sync. When using GTAC's custom sync, servers will be aware of elements and all can be handled using either GTAC functions or natives, although natives will only exist client-side.  


* When native multiplayer mode is ''disabled'', some internal "events" that IV uses are not currently handled or synced. This means things like when a player shoots another player, the damage itself won't be synced. A fix for this is currently in development.  
* When native multiplayer mode is ''disabled'', some internal "events" that IV uses are not currently handled or synced. This means things like when a player shoots another player, the damage itself won't be synced. A small snippet of code added to a resource is needed to sync these events.


* The [[element.id|element.id]] function is part of GTAC's own element handling and does not work on native multiplayer mode. If you're using native multiplayer mode, you will need to use natives to get the ID of an element.
* The [[element.id|element.id]] function is part of GTAC's own element handling and does not work on native multiplayer mode. If you're using native multiplayer mode, you will need to use natives to get the ID of an element.


* When using native multiplayer mode, the server doesn't know how to read the sync packets, and only passes them along '''as-is'''. Any references to elements in this mode is handled by the games themselves.
* When using native multiplayer mode, the server doesn't know how to read the sync packets, and only passes them along '''as-is'''. Any references to elements in this mode is handled by the games themselves.
2,771

edits

Navigation menu