LDinos
Member
Hello! I have been making a 3-match game and I recently added online functionality. After I read the documentation about making servers, I finally managed to make a LAN gamemode, and I saw that it worked perfectly! So it was time to port forward my ip and give it to somewhere else to try it with me. And it was a disaster. When the objects spawned, buffers went crazy, some random info was given instead of the intented (for example, when sent the info for the points, the info for what gems to spawn were given instead). I mostly want to know WHY this is happening rather HOW to fix it. I believe if I find out why this happens, I will be able to do some research to my code
Here is some info for my obj_server and obj_client
(obj_server)
(obj_client)
In the Async networking event I use whatever the tutorial says, and in the network_type_data I run a script that gets the info and it looks like this:
etc, where PLAYER_POS is a macro.
And when I send buffer info it looks like this:
If you need to know anything else for my project go ahead and ask me and I will answer
Video of how my project looks :
Here is some info for my obj_server and obj_client
(obj_server)
Code:
//Create Event//
ip = "0.0.0.0"
client_socket = noone
server_socket = network_create_server(network_socket_tcp, 6969, 2);
client_connected = false
buffer = buffer_create(1,buffer_grow,1)
Code:
//Create Event//
ping = 0
network_set_config(network_config_connect_timeout,3000)
textmsg = ""
client_socket = network_create_socket(network_socket_tcp);
server = network_connect(client_socket , string(global.ip), 6969);
buffer = buffer_create(1,buffer_grow,1)
In the Async networking event I use whatever the tutorial says, and in the network_type_data I run a script that gets the info and it looks like this:
Code:
var buffer = argument0
var msg = buffer_read(buffer,buffer_u8)
switch msg
{
case PLAYER_POS:
player2.x = buffer_read(buffer,buffer_u16)
player2.y = buffer_read(buffer,buffer_u16)
player2.xlim = buffer_read(buffer,buffer_u8)
player2.ylim = buffer_read(buffer,buffer_u8)
.
.
.
.....}
And when I send buffer info it looks like this:
Code:
buffer_resize(buffer,1) buffer_seek(buffer,buffer_seek_start,0)
buffer_write(buffer,buffer_u8,CONSTANT) //2
buffer_write(buffer,buffer_u16,whateverinfo)
network_send_packet(client_socket,buffer,buffer_tell(buffer))
Video of how my project looks :
Last edited: