Posted By: MPQ
entity cannot move after joining session - 12/14/12 19:18
Hi everybody,
I am totally new to multiplayer but I'm trying to get into it and got the following problem:
after creating a server on my main pc I've tried to join the server session via my notebook. Its a local network. The client's found the session but I couldn't move my entity via w,s,a,d on my client.
- My command line input is: -cl -ip [ip adress],
-cl -ip localhost didn't run (no server found)
- firewalls are turned off
- my code:
- when I start server an client on the same pc, the code works fine!
I am totally new to multiplayer but I'm trying to get into it and got the following problem:
after creating a server on my main pc I've tried to join the server session via my notebook. Its a local network. The client's found the session but I couldn't move my entity via w,s,a,d on my client.
- My command line input is: -cl -ip [ip adress],
-cl -ip localhost didn't run (no server found)
- firewalls are turned off
- my code:
- when I start server an client on the same pc, the code works fine!
Code:
#include <acknex.h> #include <default.c> /////////////////////////////////////////////////////////////////////////////////// STRING *messages_str = "#50"; FONT *arial_font = "Arial#14"; TEXT *messages_txt = // displays the messages on the screen { pos_x = 10; pos_y = 10; layer = 10; font (arial_font); string (messages_str); flags = SHOW; } /////////////////////////////////////////////////////////////////////////////////// //player movement function move_players() { while (1) { my.x += my.skill1; my.y += my.skill2; ent_sendnow(my); wait (1); } } //main funktion void main() { fps_max = 60; level_load ("level1.wmb"); camera.z = 1000; camera.tilt = -90; wait(3); //no server or client --> exit game if (!connection) { str_cpy(messages_str, "Can't find any server. Please try again later."); wait (-4); sys_exit(NULL); } //connected as a client if (connection == 2) { //client information str_cpy(messages_str, "Running as a client"); str_cat(messages_str, "\nServer IP address: "); str_cat(messages_str, server_ip); str_cat(messages_str, "\nServer name: "); str_cat(messages_str, server_name); //init level //create player my = ent_create ("player.mdl", vector (100, 50, 40), move_players); while (1) { my.skill1 = 8 * (key_w - key_s) * time_step; my.skill2 = 6 * (key_a - key_d) * time_step; send_skill (my.skill1, SEND_VEC); wait (1); } } //connected as a srever if (connection == 3) { //server information str_cpy(messages_str, "Running as a server"); str_cat(messages_str, "\nServer IP address: "); str_cat(messages_str, server_ip); str_cat(messages_str, "\nServer name: "); str_cat(messages_str, server_name); //init player my = ent_create ("player.mdl", vector (-100, -50, 40), move_players); while (1) { my.skill1 = 8 * (key_w - key_s) * time_step; my.skill2 = 6 * (key_a - key_d) * time_step; wait (1); } } }