• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Networking that only works in debug mode?

I've got a situation where the async_load buffer is not read from correctly in normal mode, but is read from correctly in debug mode. Has anyone encountered a problem like that before?

GMS1.4.1772, windows target platform.

I'll show code if it becomes necessary, but I don't think it will shed light on the problem.

EDIT: It appears buffer_tell is returning the wrong buffer seek position. Further input on this problem is welcome.
 
Last edited:

FrostyCat

Redemption Seeker
I've only encountered problems like this in HTML5 before, where the obfuscator lays its hands on things it shouldn't.

Show that code or a demo for others to try, perhaps on an earlier version. If it turns out to be a problem with the normal VM runner, you would need to show that same proof to YoYo anyways when you report it.
 

FrostyCat

Redemption Seeker
I am also on 1.4.1772, but the error is consistent on both normal and debug runs. If you try to debug this with the following line in Networking:
Code:
show_debug_message("size: " + string(buffer_get_size(_buff)));
You see size: 1, which indicates that the broadcast has been truncated.
 
interesting, I wonder why I don't get an error in debug then.

On a hunch I changed the size argument in network_send_broadcast from

network_send_broadcast(broadcast_socket, 25565, send_buff, buffer_tell( send_buff ) );

to

network_send_broadcast(broadcast_socket, 25565, send_buff, 2 );

and the problem disappears.

It seems that buffer_tell is getting the wrong value for the buffer seek position.

buffer_seek( send_buff, buffer_seek_start, 0 );
buffer_write( send_buff, 1, buffer_u8 );
buffer_write( send_buff, net_messages.get_internal_ip, buffer_u8 );

buffer_tell( send_buff) ought to return 2 at this point, right?
 
Last edited:

FrostyCat

Redemption Seeker
Sorry, I should have seen this coming --- you reversed the type and value arguments in buffer_write().
The Manual entry for buffer_write() said:
Syntax:
buffer_write(buffer, type, value)
After flipping the arguments in your code, it is running without errors again:
Code:
buffer_write( send_buff, buffer_u8, 1 );
buffer_write( send_buff, buffer_u8, net_messages.get_internal_ip );
 
After flipping the arguments in your code, it is running without errors again:
Aw hell, you're right, of course.

The crappy thing about that is I actually did think of this, but apparently I only checked the code in the alarm event, and not in the create event. That was stupid of me. But glad I posted about it here before sending off a bug report.

Although it's still a mystery why the code worked without error in debug mode (on my computer anyway).
 
Top