A
Andrea N
Guest
Hello,
i'm trying to make a multiplayer online game with server and client.
I wached some youtube tutorial and it's all ok, all works fine, the data that i send from the client to the server is correct.
I added some changes, i added some variables to sent from the client to the server using buffer, but when i received the informations from the server, the variables have wrong values.
I copy here my example code, the "Variable" are obviously all differents (this from the client):
//update coordinates
buffer_seek(global.buffer, buffer_seek_start, 0);
buffer_write(global.buffer, buffer_f64, 7);
buffer_write(global.buffer, buffer_string, playerUsername);
buffer_write(global.buffer, buffer_u32, Variable);
buffer_write(global.buffer, buffer_f32, Variable);
buffer_write(global.buffer, buffer_f32, Variable);
...
....
....
many lines later
network_send_packet(obj_controller.socket, global.buffer, scr_getBufferSize());
And this form the server:
case 7:
var playerUsername= buffer_read(buffer, buffer_string);
var Variable= buffer_read(buffer, buffer_u32);
var Variable= buffer_read(buffer, buffer_f32);
var Variable= buffer_read(buffer,buffer_f32);
var Variable= buffer_read(buffer, buffer_f32);
var Variable= buffer_read(buffer, buffer_f32);
....
....
.....
many lines later
if (file_exists(playerUsername + ".ini"))
{
// Update player data
ini_open(playerUsername + ".ini");
ini_write_real("a", "aa", Varible);
ini_write_real("a", "ab", Varible);
...
....
....
many lines later
}
ini_close();
break;
The server so receives the varibles from the client. I save them to a .ini file! But i have a problem, i have about 26 variables to send and for the last 9 i receive wrong information!
What's the problem?
Have i to use different buffers?
Am I sending too much information at the same time?
Can someone explain to me why i receive wrong informations?
For wrong informations i mean that i send (for example), playerlife=50, and i receive a casual number.
I hope I explained myself.
Thanks all for the answers.
i'm trying to make a multiplayer online game with server and client.
I wached some youtube tutorial and it's all ok, all works fine, the data that i send from the client to the server is correct.
I added some changes, i added some variables to sent from the client to the server using buffer, but when i received the informations from the server, the variables have wrong values.
I copy here my example code, the "Variable" are obviously all differents (this from the client):
//update coordinates
buffer_seek(global.buffer, buffer_seek_start, 0);
buffer_write(global.buffer, buffer_f64, 7);
buffer_write(global.buffer, buffer_string, playerUsername);
buffer_write(global.buffer, buffer_u32, Variable);
buffer_write(global.buffer, buffer_f32, Variable);
buffer_write(global.buffer, buffer_f32, Variable);
...
....
....
many lines later
network_send_packet(obj_controller.socket, global.buffer, scr_getBufferSize());
And this form the server:
case 7:
var playerUsername= buffer_read(buffer, buffer_string);
var Variable= buffer_read(buffer, buffer_u32);
var Variable= buffer_read(buffer, buffer_f32);
var Variable= buffer_read(buffer,buffer_f32);
var Variable= buffer_read(buffer, buffer_f32);
var Variable= buffer_read(buffer, buffer_f32);
....
....
.....
many lines later
if (file_exists(playerUsername + ".ini"))
{
// Update player data
ini_open(playerUsername + ".ini");
ini_write_real("a", "aa", Varible);
ini_write_real("a", "ab", Varible);
...
....
....
many lines later
}
ini_close();
break;
The server so receives the varibles from the client. I save them to a .ini file! But i have a problem, i have about 26 variables to send and for the last 9 i receive wrong information!
What's the problem?
Have i to use different buffers?
Am I sending too much information at the same time?
Can someone explain to me why i receive wrong informations?
For wrong informations i mean that i send (for example), playerlife=50, and i receive a casual number.
I hope I explained myself.
Thanks all for the answers.