• 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!

Windows Multiplayer - Other player sprite is flashing

Xer0botXer0

Senpai
Hi fellow game devs,

So I've run into a problem, I'm not sure why my other player instance is flashing.


(anything in that objects draw event flickers)

Basically when my clients player enters a new room, it unloads all instance information and then loads instance information from the server again, if there's another player there then it creates an instance for that player.

Once the other player instance is created it then receives that players' coordinates via networking async..

Code:
///receive this other player information
var type_event = ds_map_find_value( async_load , "type" );
switch( type_event )
{
    case network_type_data:
    var buffer = ds_map_find_value( async_load , "buffer" );
    buffer_seek( buffer , buffer_seek_start , 0 );
    var msgid = buffer_read( buffer , buffer_u8 );

    switch( msgid )
    {
        case 16: //recieve this other player information
        {
            my_xpos = buffer_read(buffer,buffer_u16)
            my_ypos = buffer_read(buffer,buffer_u16)
            my_roomx = buffer_read(buffer,buffer_u8)
            my_roomy = buffer_read(buffer,buffer_u8)
        
        }
    }
Then in the step event it updates that instance position


Code:
///update position

if my_xpos != -1
{


    x = my_xpos
}

if my_ypos != -1
{
    y = my_ypos
}
 


//update x/y pos
        for (i = 0; i < array_height_2d(global.arr_other_player_information); i ++)
        {
            if my_username == global.arr_other_player_information[i,0]
            {
                global.arr_other_player_information[i,4] = x //x pos
                global.arr_other_player_information[i,5] = y //y pos
            }
        }


Im not sure how to solve this, it has something to do with updating the position..
 
Last edited:
Q

Quackertree

Guest
I'd like to actually see your Draw event code. Without that, I can't do a whole lot here... :/

The only thing I can think of on the fly is that the server receives incorrect data or sends it incorrectly to the client. This causes the position to update incorrectly and therefor it might jump to, for example, some large negative value, causing it to "flicker". Have you tried debugging the inputs from the package into the console? Might be useful information here.
 

NightFrost

Member
To test for incorrect position data, you could simply draw the coords to the corner of the screen. If they flicker to some crazy numbers, you've found the problem.
 

Xer0botXer0

Senpai
There is no code in the draw event, the other player object just has a sprite.

Also when I added code to draw event to draw the name even the text flashed, I ran the program in debug and it appears the coordinates dont change.

But while debugging I found that something's going wrong with the array that holds the other player information, I've a feeling that the other player is constantly being deleted and created again..
 
Top