Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

Steamworks.gml example

Sample project for Steam-based networking for GameMaker. · By YellowAfterlife

Error in Code ?

A topic by MeLikePixels created Aug 28, 2017 Views: 257 Replies: 2
Viewing posts 1 to 3

Hello, I am using your steamworks.gml example file to create a game. I wonder if you made a mistake in your code which occurs where 3 or more players play together :

Let us say that a local cursor (which is not lobby) moves, then it uses the script packet_send_all() to tell to the server that it has moved. Then, the server reveives this packet, update the position of this cursor and has to tell others that this cursor has moved. Therefore, in the packet_handle_server, case packet_t.cursor, you first write the steam user id in the buffer with the command :

p = packet_start(packt_t.cursor)
buffer_write_int64(p, from)

I agree with all of this. The point is that u never take into account this information in the script packet_handle_client, at the packet_t.cursor case.

I thinkthat you should have something like instead :

case packet_t.cursor:
var steam_id = buffer_read_int64(b);
var _x = buffer_read(b,buffer_f32);
var _y = buffer_read(b,buffer_f32);
with obj_cursor if user == steam_id {

etc....

}


What do you think ? I hope  I am helping. Cheers.

Developer

That seems correct - this was originally going to be a P2P example (rather than with a server-player), and I guess I overlooked that when migrating the code. I'll fix that for the next update.

Great. Thank you again for your work. It is tremendous for novice developpers who want to make multiplayers game with gamemaker and steam.