3. Actually make Games after your setup


What to do after setup?

Put the oBrain Object in a room

  1. The oBrain object under Objects/Rocket Networking is persistent, so you only have to put it in your first Gamemaker room. Or the room you want to start anything related to multiplayer with.
  2. This is the brain of our service and does most of the internal stuff.

Connect to Server

Use the ConnectToServer() function to establish a connection to your server. ConnectToServer()

How other players and their data load?

  1. Firstly make sure you are in the same room as the other guy. You can do this by the ChangeRoom( new_room_name ) function.
  2. For simplicity, do ChangeRoom(”public”). Sounds simple and easy. Once there are 2 or more actual players in the Rocket Networking “public” Room we’ll move ahead. So say you have loaded your project on 2 different computers, execute this code on them to join the “public” room.

oOtherPlayer created for every other player in the “public” room

This is where the magic happens. Our service detects that there are 2 or more real clients on real computers in the same room “public” and creates the other player. So if you are in “public” with another client/player, the other client/player is created in an instance of oOtherPlayer

The default layer is set to “Instances” but you can change this to anything in Scripts/Rocket Networking/Options.gml

Data is shared between those clients/players in “public”

What data you(your client) want to share with others(other clients)?

Put that in global.sharedProperties … just update that struct with anything you want to share with others

//lets say you are making a platformer
//from any object in your game (other than those under rocket networking), 
//run this line to just update that global.sharedProperties struct
global.sharedProperties = {
	//Add stuff here and update this struct always
	_x : oMyAwesomePlayer.x ,
	_y : oMyAwesomePlayer.y ,
	_name : "Charlie"

How to get what data others(other clients) have shared with you?

The logic is that for every unique player in “public” or whatever room name you set, an instance of oOtherPlayer is created.

For example, there’s 3 guys with your game on 3 computers. Charlie, Alan and Jake.

So on Charlie’s computer, there are 2 instances of oOtherPlayer created, one representing Alan, one representing Jake.

On Alan’s computer, there are 2 instances of oOtherPlayer created, one representing Charlie, one representing Jake.

On Jakes’s computer, there are 2 instances of oOtherPlayer created, one representing Charlie, one representing Alan.

Now, Charlie can access Jake’s or Alan’s shared data like this


Now depending on what you want to do with instances of other players, you can add code here. The above code changes the realtime x and y coordinates of this instance, (and the name too). So on Charlie’s computer the 2 oOtherPlayer instances for Alan and Jake change coordinates according to what data Jake and Alan have shared.

This way we have a neat system that resembles a platformer or top down. Add a sprite to oOtherPlayer and see them move around on the screen!

Did you know? When I was Making my first project gatdamn.io, I made this whole infrastructure by myself and it took like 4 months of 3~4 hours of coding per day on average. I’m not saying I was the best game developer but Rocket Networking allows anyone to cut to the chase and do things a hell of a lot faster, and I really hope you can make your game faster with our system! PS: I had repressed anxiety and depression while developing gatdamn.io so its not exactly a fair comparison I guess?🥲