Networking4GM
A downloadable asset pack
Networking4GM is an asset for Game Maker Studio 2 aiming to make the net code easier.
This library provides multiple services : a based Remote Procedure Call (RPC) protocol API that ensures the communication between the peers, port mapping , latency computing, host migration, available port checking and a TURN server.
In this package, you will find:
- Networking4GM.yymps - the library
- rpc_example.yyz - an example of library implementation
- a turn folder with turn server for Linux or Windows
RPC API
Using this API, you should create servers, clients and make them communicate with the RPC protocol. In that manner, any peer calls a function previously created which will be executed in all other peers.
Let's take an example, the asset one. We want to create peers, one server, some clients and synchronize them.
First, you must initialize the library and set some configuration.
//"manager" object create event
players = ds_map_create();//list of players
networking4gm_init();
proto = rpc_protocol.TCP;
port = 10500;
rpc_set_config(proto,port,32,false);
A server can be created with this line of code :
server = rpc_create_server(manager.port);
Creating a client and connect it to the server :
client = rpc_create_client();
client.connect("ip_server",manager.port);
For synchronization, we made our own function in a script :
function sync_pos(peer_id,peer_x,peer_y){
manager.players[? peer_id].x = peer_x;
manager.players[? peer_id].y = peer_y;
}
This is when the magic happens. To send its position a peer asks the other peers to execute the "sync_pos" function with its x and y coordinates into parameters.
//step event of a player object
rpc_call(sync_pos,[peer_id,x,y]);
And that's it !
AVAILABLE PORT CHECKING
while(!PortMapping.is_port_available(manager.port)){manager.port++};
PORT MAPPING
PortMapping.add_port_mapping(manager.port,0);
GET PEER LATENCY
peer.latency;
HOST MIGRATION
server.server_migration();
Happy net-coding !
| Published | 23 hours ago |
| Status | Released |
| Category | Assets |
| Author | Lexomillenium |
| Tags | GameMaker, library, netcode |
| Content | No generative AI was used |
Purchase
In order to download this asset pack you must purchase it at or above the minimum price of $5.25 USD. You will get access to the following files:

Leave a comment
Log in with itch.io to leave a comment.