2 registered members (AndrewAMD, SBGuy),
987
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: [DE/EN]client connecting problem
[Re: virtualmarctek]
#213948
07/01/08 15:37
07/01/08 15:37
|
Joined: Mar 2008
Posts: 68 Germany, Essen
virtualmarctek
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2008
Posts: 68
Germany, Essen
|
ok it works! Thanks for an example. I will write some new things to that, like camera and so on!
mfg, Marc V.
|
|
|
Re: [DE/EN]client connecting problem
[Re: virtualmarctek]
#213949
07/01/08 15:40
07/01/08 15:40
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
no problem, glad i've been helpful...
Ubi bene, ibi Patria.
|
|
|
Re: [DE/EN]client connecting problem
[Re: virtualmarctek]
#214055
07/02/08 09:47
07/02/08 09:47
|
Joined: May 2008
Posts: 33 Russia/Netherlands
Hand_Of_Law
Newbie
|
Newbie
Joined: May 2008
Posts: 33
Russia/Netherlands
|
I posted this elsewhere, but as it got no reaction perhaps here is a better place. The code above seems to have the same problem as mine. While the entities are created, I can not get them to move. Probably something simple I am missing, but its kind of frustrating. #include <acknex.h> #include <default.c>
#define PRAGMA_PATH ".\\levels"; #define PRAGMA_PATH ".\\models";
#define MAX_CONNECTIONS 100; #define force_x skill1 #define force_y skill2 #define force_z skill3 #define player_number skill4 #define role skill5 STRING* messages_str = "#100"; STRING* roller_str = "roller.wmb"; STRING* woman_str = "cbabe.mdl"; STRING* worker_str = "inmate.mdl";
var number_of_players; var force[3];
FONT* Arial_font = "Arial#14";
TEXT* messages_txt = { pos_x = 300; pos_y = 1; layer = 10; font(Arial_font); string (messages_str); flags = visible; }
function spawn_player(); function move_player(); function move_camera(); function input_scan(); function move_someone();
function main() { video_mode = 6; fps_max = 100; // limit the number of data packets that are sent each second to 60 level_load(roller_str); spawn_player(); while(1) { input_scan(); move_camera(); wait(1); } }
function spawn_player() { wait(-1); if (connection == 3) { player = ent_create("inmate.mdl",vector(-250,200,1),move_someone); } else { player = ent_create("cbabe.mdl",vector(-275,250,1),move_someone); } wait (-1); }
function move_player() { while(!player) { wait(1); } number_of_players += 1; // now that new player's entity has been & // increment number_of_players send_var(number_of_players); // send new number_of_players to all clients my.player_number = number_of_players; // set the player_number skill send_skill(my.player_number, SEND_ALL); // send player_number skill to all clients // this code is to solve high latency creation problem ent_sendnow(my); force[0] = my.force_x * time_step *15; force[1] = my.force_y * time_step *15; force[2] = 0; move_mode = GLIDE|IGNORE_PASSABLE|IGNORE_PASSENTS|IGNORE_YOU; c_move(my, force, nullvector,move_mode); }
function move_camera() { while (!player) { wait(1); } camera.x = player.x + 100; camera.y = player.y; camera.z = 10; camera.tilt = 0; camera.pan = 180; }
function input_scan() { // only send changed skill values, so we need variable to store old values var force_x_old; var force_y_old; while (1) { // if player has been created get inputs for him if (player) { force_x_old = player.force_x; //store old force values force_y_old = player.force_y; player.force_x = 0; // set force to 0 until we get key input player.force_y = 0; player.force_x = (key_cuu - key_cud) * time_step ; player.force_y = (key_cul - key_cur) * time_step ; // if any forces have changed, send new forces to server if(player.force_x != force_x_old || player.force_y != force_y_old) { // if client, send forces to server, if we are single/host/server values need not // be sent if(connection == 2) { send_skill(player.force_x,SEND_VEC); // send force vec to server } } } wait(1); } }
action move_someone(); { move_player(); }
|
|
|
Re: [DE/EN]client connecting problem
[Re: Hand_Of_Law]
#214058
07/02/08 09:56
07/02/08 09:56
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
well...i'm not sure what's wrong, but try to remove that while loop from main ::: while(1) { input_scan(); move_camera(); wait(1); } }
and in both of those function add loop inside of them...
Ubi bene, ibi Patria.
|
|
|
Re: [DE/EN]client connecting problem
[Re: Hand_Of_Law]
#214110
07/02/08 15:02
07/02/08 15:02
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
take the code i posted on first page of this topic. it's very similar and it's working. you can start building your game from my code or you can take it to compare with your code and find where your problem is.
Ubi bene, ibi Patria.
|
|
|
Re: [DE/EN]client connecting problem
[Re: Hand_Of_Law]
#214121
07/02/08 15:59
07/02/08 15:59
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
hm...they must move, it works to me, to virtualmarctek and some other people too. controls are wasd and mouse. if it still doesn't work then you maybe did something wrong...
Ubi bene, ibi Patria.
|
|
|
Re: [DE/EN]client connecting problem
[Re: Hand_Of_Law]
#214125
07/02/08 16:23
07/02/08 16:23
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
put in sed -sv -cl run it and it should work. i'm using 7.07, maybe that's what causes errors. on my friends 7.04 i believe he experienced error where server moves normally and client couldn't move at all...
Ubi bene, ibi Patria.
|
|
|
|