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

Legacy GM Clients behave differently

L

Linnek

Guest
Game Maker Professional Edition (v1.4.1772)

I am creating a smash-bros-like game for friends with the help of SlasherXGAMES' networking tutorial:
and succesfully made my game work at part 11 (i stopped following the tutorial after that point) at that point i already had something like 10 or eleven selectable characters that worked with the character selection from the tutorial and basically everything worked well, the attacks, the countdown etcetera.

but, once i added a few more things (from my memory a ready up system that required all clients to press a ready button and a few more characters) things started to go a bit wrong, some characters displayed the wrong sprites ingame, resulting in menu buttons running around; the program would freeze (fixed), And the problem that i have the most issues with that makes the game unplayable:

The Problem:
on one client's screen the other client was visible and if that client attacked client number 1, client number 1 would be attacked, only client 2 doesn't see client 1 at all. client 1 simply does not even exist on client 2, even though both clients have the same code, how?

I think it has to do with some code not triggering when a client has a certain ID but i tried to solve the problem for a few weeks now and i just couldn't get it to work.

Media:
The main problem in action



The weird sprite problem in action (non-gamebreaking but still not so good)


i can provide code if necessary, i am not sure if problems like this happen often but i just cannot find out what's wrong.
 

TheBroman90

Member
Are you sure the server creates the client for everyone?
What's your networking code for creating client characters?
 
L

Linnek

Guest
from the client you can connect to the server by typing the ip (in my case localhost 127.0.0.1) and it displays the latency so the clients are connected to the server.

in the room creation event it does an instance_create for the localplayer and the remoteplayer gets created in a way that probably holds the problem

Code:
in the client

case 6://room change response
        var pId = buffer_read(buffer, buffer_u32);
        var pType = buffer_read(buffer, buffer_u8);
        var pName = buffer_read(buffer, buffer_string);
       
        var instance = noone;
       
        with (obj_remoteplayer)
        {
            if (remotePlayerId == pId)
            {
                instance = id;
            }
        }
       
        if (instance == noone) //if this player doesn't exist yet
        {
            //only if we're in the gameworld
            if (instance_exists(obj_localplayer))
            {
                //create a remote player
                var remotePlayer = instance_create(room_width/2, room_height/2, obj_remoteplayer);
                remotePlayer.remotePlayerId = pId;
                remotePlayer.remotePlayerType = pType;
                remotePlayer.remotePlayerName = pName;
            }
        }
        else//else destroy this player
        {
            with (instance)
            {
                instance_destroy();
            }
        }
    break;

it takes the variables from the server's room change request code
quite some of my code is from the networking tutorial and i added some code of myself too that probably messed up the tutorial's code in a way
i am not sure wich code is relevant because i looked trough the code i thought was relevant and couldn't find out what the problem was
 
L

Linnek

Guest
Welp, since there haven't been any replies since wednesday and i expected much more replies,

i decided to leave the project alone and start over from scratch with the tutorial and the sprites and write new code that will work with the tutorial videos, that way it will maybe already work or then i will know what piece of code breaks the game.
altough i still appreciate help on the original problem.
 
Top