0 registered members (),
18,561
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
fog in multiplayer game
#315454
03/15/10 17:06
03/15/10 17:06
|
Joined: Sep 2009
Posts: 496
Progger
OP
Senior Member
|
OP
Senior Member
Joined: Sep 2009
Posts: 496
|
Hi i need to know how i can make fog on the client because this action only works on the server to make it run i created an object with behaviour Nebel but it do not work on the client ): pls help function Nebel() { while (1) { if (player.z<0) { camera.fog_start=100; fog_color=2; camera.fog_end=1000; } else { fog_color=0; } wait(1); } } MFG Progger 
|
|
|
Re: fog in multiplayer game
[Re: Progger]
#315530
03/16/10 13:16
03/16/10 13:16
|
Joined: Sep 2009
Posts: 496
Progger
OP
Senior Member
|
OP
Senior Member
Joined: Sep 2009
Posts: 496
|
|
|
|
Re: fog in multiplayer game
[Re: Progger]
#315533
03/16/10 13:58
03/16/10 13:58
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
I'm not familar with the built in multiplayer of gamestudio but I guess that actions are only executed on the server. So why don't you start Nebel() from main()?
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: fog in multiplayer game
[Re: Progger]
#315538
03/16/10 14:53
03/16/10 14:53
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
With my clairvoyant skills I see that you put Nebel(); before the level_load() function ^^ Why do I know this? Because I guess that the engine crashes because the player pointer is invalid (this means that the player is not created yet). So improve your function a bit:
function Nebel()
{
while (1)
{
if(player != NULL)
{
if (player.z<0)
{
camera.fog_start=100;
fog_color=2;
camera.fog_end=1000;
}
else
{
fog_color=0;
}
}
wait(1);
}
}
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: fog in multiplayer game
[Re: Razoron]
#315543
03/16/10 15:09
03/16/10 15:09
|
Joined: Sep 2009
Posts: 496
Progger
OP
Senior Member
|
OP
Senior Member
Joined: Sep 2009
Posts: 496
|
@Dark_samurai No i didnt do it before level_load i did it after it but it still do not work here is the player code
function move_Pengu()
{
var walk_percentage;
var winken_percentage;
var sli;
var winks;
player=my;
while(1)
{
c_move(my, vector(my.skill1, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);
c_move(my,vector(0,0,my.skill5),nullvector,IGNORE_PASSABLE | GLIDE);
c_move(my,vector(0,0,-20),nullvector,IGNORE_PASSABLE | GLIDE);
my.pan += my.skill2;
if (my.skill1)
{
walk_percentage += 1.5 * my.skill1 * sign(my.skill1);
ent_animate(my,"walk",walk_percentage, ANM_CYCLE);
}
if(my.skill5)
{
my.tilt=-90;
sli += 1.5 * my.skill5 * sign(my.skill5);
ent_animate(my,"slide",sli, ANM_CYCLE); // "walk" animation loop
}
else
{
my.tilt=0;
sli=0;
}
if(my.skill4)
{
winks += 1.5 * my.skill4 * sign(my.skill4);
ent_animate(my,"winken",winks, ANM_CYCLE);
}
ent_sendnow(my);
wait(1);
}
}
@Razoron no i tried this but thanks for trying to help me and here is function main()
function main()
{
fps_max=60;
ent_createlayer("cubemap+6.tga", SKY | CUBE | SHOW , 1); // create the sky cube
media_loop("flies.mp3",0,100);
mouse_map =mouse_pcx;
mouse_mode = 4;
video_screen=1;
video_mode=10;
level_load("penguinland.WMB");
on_ctrl = input_text;
on_server = server_event;
if (!connection) // no server could be found?
sys_exit(NULL); // then shut down the engine
if(connection==2)
{
Scholle=ent_create ("eis2.mdl", vector (100, 50, 6000),Nebel);
my= ent_create ("pos.mdl", vector (100, 50, 60), move_Pengu);
wait(-5);
client_ent = handle(my);
send_var (client_ent);
while(1)
{
my.skill1 = 5 * (key_w - key_s) * time_step;
my.skill2 = 4 * (key_a - key_d) * time_step;
my.skill3 = 3*(key_a - key_d)* time_step;
my.skill4 = 1*(key_h)*time_step;
my.skill5 = (key_space) * speed*time_step;
send_skill (my.skill1, SEND_VEC); // send skill1...3 to the server
send_skill(my.skill2,SEND_VEC);
send_skill(my.skill3,SEND_VEC);
send_skill(my.skill5,SEND_VEC);
// send client_fired to the server; even client's bullets are created on the server
simple_camera(); // call the simple camera function
wait (1);
}
}
if(connection==3)
{
my=ent_create ("pos.mdl", vector (-100, -50, 40), move_Pengu); // create the blue soldier
while(1)
{
my.skill1 = 5 * (key_w - key_s) * time_step;
my.skill2 = 4 * (key_a - key_d) * time_step;
my.skill3 = 3*(key_a - key_d)* time_step;
my.skill4 = 1*(key_h)*time_step;
my.skill5 = 5*(key_space) * speed*time_step;
simple_camera();
wait(1);
}
}
}
Last edited by Progger; 03/16/10 15:11.
|
|
|
|