Sage J. Föx Administrator

 Number of posts: 280 Age: 18 Location: The Digital World Motto: And so the fire dies out... Reputation: 4 Registration date: 2008-04-05
 | Subject: Data Streaming in GM7 Sat Jul 26, 2008 2:23 am | |
| Hm... I'm having some data streaming problems. It'll keep creating ghost shots. I know the problem (somewhere it's sending messages 4 and/or 6 repeatedly), but i don't know where for sure. I think it's somewhere in the control object. The player's shooting code: | Code: | { if(bomb<=0) { i=instance_create(x,y,obj_bomb); i.speed=20; i.direction=my_direction; mplay_message_send_guaranteed(0,6,string(x)+"|"+string(y)+"|"+string(my_direction)+"|"+string(20)+"|"+string(my_id)+"|"); bomb=300; } } |
The Control object begin step:
| Code: | { if(!global.host) { if(mplay_message_receive(0)) { if(mplay_message_id()==1) { make_players(mplay_message_value()); mplay_message_send_guaranteed(0,3,player.my_id); } if(mplay_message_id()==2) { v=mplay_message_value(); with(other_player) if(my_id=other.v)instance_destroy(); } if(mplay_message_id()==3) { i=instance_create(10,10,other_player); i.my_id=mplay_message_value(); } if(mplay_message_id()==4) { explode_script(mplay_message_value(),"|"); i=instance_create(x,y,ghost_bullet); i.x=real(explode[0]); i.y=real(explode[1]); i.direction=real(explode[2]); i.speed=real(explode[3]); i.my_id=real(explode[4]); } if(mplay_message_id()==5) { show_message("Host has left the game. Goodbye."); game_end(); exit; } if(mplay_message_id()==6) { explode_script(mplay_message_value(),"|"); i=instance_create(x,y,obj_bomb_ghost); i.x=real(explode[0]); i.y=real(explode[1]); i.direction=real(explode[2]); i.speed=real(explode[3]); i.my_id=real(explode[4]); } } } } |
And the ghost player step event:
| Code: | { data=mplay_data_read(my_id); explode_script(data,"|"); x=real(explode[0]); y=real(explode[1]); image_angle=real(explode[2]); } |
Anybody who knows Game Maker's online functions see why? |
|
santa22 Popular Member


Number of posts: 137 Motto: Resources of play world united will last forever. Reputation: 0 Registration date: 2008-04-10
 | Subject: Re: Data Streaming in GM7 Thu Feb 19, 2009 2:21 pm | |
| Not sure if this will help but give this a try. The Control object begin step: | Code: | z = mplay_message_count(0); e = 0; while e < z {if (mplay_message_receive(0)) and (!global.host) { if(mplay_message_id()==1) { make_players(mplay_message_value()); mplay_message_send_guaranteed(0,3,player.my_id); } if(mplay_message_id()==2) { v=mplay_message_value(); with(other_player) if(my_id=other.v)instance_destroy(); } if(mplay_message_id()==3) { i=instance_create(10,10,other_player); i.my_id=mplay_message_value(); } if(mplay_message_id()==4) { explode_script(mplay_message_value(),"|"); i=instance_create(x,y,ghost_bullet); i.x=real(explode[0]); i.y=real(explode[1]); i.direction=real(explode[2]); i.speed=real(explode[3]); i.my_id=real(explode[4]); } if(mplay_message_id()==5) { show_message("Host has left the game. Goodbye."); game_end(); exit; } if(mplay_message_id()==6) { //explode_script(mplay_message_value(),"|"); i=instance_create(x,y,obj_bomb_ghost); i.x=real(explode[0]); i.y=real(explode[1]); i.direction=real(explode[2]); i.speed=real(explode[3]); i.my_id=real(explode[4]); } } e = e + 1; }
|
|
|
Sage J. Föx Administrator

 Number of posts: 280 Age: 18 Location: The Digital World Motto: And so the fire dies out... Reputation: 4 Registration date: 2008-04-05
 | Subject: Re: Data Streaming in GM7 Thu Feb 19, 2009 4:25 pm | |
| Oh God, I haven't looked at that file in months! I'll have to try that code, though. I'll edit with how it goes.
Edit: Hm... no such luck.
Last edited by Sage J. Fox on Thu Feb 19, 2009 4:44 pm; edited 1 time in total |
|
santa22 Popular Member


Number of posts: 137 Motto: Resources of play world united will last forever. Reputation: 0 Registration date: 2008-04-10
 | Subject: Re: Data Streaming in GM7 Thu Feb 19, 2009 4:29 pm | |
| Hope it works for you.
[edit] Aww, i'm not sure whats going on their... |
|