[DE/EN]client connecting problem

Posted By: virtualmarctek

[DE/EN]client connecting problem - 06/02/08 16:54

[DE] ich war dabei ein kleines MP spiel zu basteln, es geht auch außer diesen einen Punkt:

[BILD SIEHE UNTEN]

Wisst ihr woran er liegen kann?

[EN] I started to create a Multiplayer GAme, it works but theres an error. Do you know how ti fix it?

Fehler/Error

Posted By: virtualmarctek

Re: [DE/EN]client connecting problem - 06/02/08 16:58

[DE] OK den fehler hab ich behoben in dem ich ein -sn gesetzt habe.
Aber jetzt läd der das Spiel nicht, ich bleibe immer beim Schwarzem Bildschirm stecken.
Hat denn keiner eine Antwort?

[EN] OK I fixed it with adding an -sn but now it doesn't load, it stops with an black screen.
Has nobody an Answer?
Posted By: Hand_Of_Law

Re: [DE/EN]client connecting problem - 06/27/08 12:20

If you are working in Vista, add a port number.
As far as the 'why', there is not enough information
Posted By: virtualmarctek

Re: [DE/EN]client connecting problem - 07/01/08 12:27

I dont use Vista I work unter XP, the problem is, that after connecting to the server there is a black screen
Posted By: croman

Re: [DE/EN]client connecting problem - 07/01/08 12:43

you get a blank screen because there's no connection (your client is not connected to a server) and you have inside your code some line that is preventing level load until client is connected.

I had same problem and the following worked for me:

#for server mine cmd line looked like this: >> -sv -cl -port 2300 << and i forwarded that port. if you don't know what forwarding ports is then be free to ask, i'll explain it to you.
#for client mine cmd line looked like this: >> -cl -ip localhost << for testing on one pc and >> -cl -ip somenumber << for online testing


hope this has been hellpfull to you.
Posted By: virtualmarctek

Re: [DE/EN]client connecting problem - 07/01/08 13:33

i have a connection the server sais that the client is connected, i tried the same in Lite-C (Its Locoweeds MP Tutorial with removed weapons). So please try to look at this: http://www.coniserver.net/ubb7/ubbthreads.php?ubb=showflat&Number=210274#Post210274
Posted By: croman

Re: [DE/EN]client connecting problem - 07/01/08 13:37

well...i'll tell you what...are you a new to mp programming? if you are then you should start with smaller steps. i tried to make my first mp game by removing some code from loco's mp tut but i figuered that it's the wrong approach. so i started from the very beginning and i made it. i created connection, player and moving and it all worked perfectly.

so if you are a noob in mp programming tell and i can send you that basic mp code of mine.
Posted By: virtualmarctek

Re: [DE/EN]client connecting problem - 07/01/08 13:38

Here is my Code in C-Script:

Server:
Code:
// BMAPS
bmap pcxArrow = <arrow.pcx>;
bmap bmpMAN = <man.bmp>;
bmap bmpWOMAN = <woman.bmp>; 
bmap pcxTitle = <title.pcx>;
bmap pcxSelect = <select.pcx>;

// Defines
define FALSE, 0;
define TRUE, 1;
define PROF_MAN, 1;
define PROF_WOMAN, 2;
define PLAYER_NUMBER, skill1;
define SCORE, skill2;
define PROFESSION, skill3;
define SPEED, skill4;
define HEALTH, skill5;
define MAX_HEALTH, skill6;
define ARMOR_CLASS, skill7;

// Fonts
font arial_schrift="Arial",0,12;

// Panels

panel pnlMan
{
	bmap bmpMAN;
	layer = 21;
	pos_x = 0;
	pos_y = 0;
	on_click = set_prof_man;
	flags = overlay,transparent,refresh;
}

panel pnlWoman
{
	bmap bmpWOMAN;
	layer = 21;
	pos_x = 0;
	pos_y = 0;
	on_click = set_prof_woman;
	flags = overlay,transparent,refresh;
}

panel pnlTitle
{
	bmap = pcxTitle;
	layer = 18;
	pos_x = 0;
	pos_y = 0;
	flags = overlay,transparent,refresh;
}

panel pnlSelect
{
	bmap = pcxSelect;
	layer = 18;
	pos_x = 0;
	pos_y = 0;
	flags = overlay,transparent,refresh;
}

// Strings
string clientstring = "Dies ist keine Clientversion, sodern ein Server! Bitte holen Sie sich die Clientversion um dieses Spiel spielen zu können";
string world_str = <level.wmb>;
string MAN = <man.mdl>;
string WOMAN = <woman.mdl>;
string str_people_connected;
string str_temp;

// Vars
var fps_max = 60;
var fps_lock = ON;
var video_mode = 7;
var video_screen = 2;
var mouse_mode = 2;
var MAX_CONNECTIONS = 8;
var people_connected = 0;
var number_of_players = 0;
var server_says_start = FALSE;
var profession_ID;
var temp_loc[3];
var vecFrom[3];
var vecTo[3];
var profession_not_Set = TRUE;

// Texts
text client_text
{
font=arial_schrift;
pos_x=20;
pos_y=200; 
string=clientstring;
}

text txt_people_connected
{
	pos_x = 0;
	pos_y = 65;
	layer = 15;
	font arial_schrift;
	string str_people_connected;
}

// Display Info
function display_info()
{
	while(1)
	{
		str_cpy(str_people_connected, "People Connected: ");
		str_for_num(str_temp, people_connected);
		str_cat(str_people_connected, str_temp);
		wait(1);
	}
}

//Move MAN
action move_man
{
	my.profession = PROF_MAN;
	move_player();
}

//Move WOMAN
action move_woman
{
	my.profession = PROF_WOMAN;
	move_player();
}

// Move Player
function move_player()
{
	my.pan = random(360);
	while(1)
	{
		wait(1);
	}
}

// Set Prof Man
function set_prof_man()
{
	profession_ID = PROF_MAN;
	profession_not_Set = FALSE;
}

// Set Prof Woman
function set_prof_woman()
{
	profession_ID = PROF_WOMAN;
	profession_not_set = FALSE;
}

// init display
function init_display()
{
	pnlTitle.pos_y = screen_size.y/2 + 100;
	pnlTitle.pos_x = screen_size.x/2 -150;
	pnlTitle.alpha = 75;
	pnlSelect.pos_y = screen_size.y/2 -100;
	pnlSelect.pos_x = screen_size.x/2 -150;
	pnlSelect.alpha = 75;
	pnlMan.pos_y = screen_size.y/2;
	pnlMan.pos_x = screen_size.x/2 - 300;
	pnlMan.alpha = 75;
	pnlWoman.pos_y = screen_size.y/2;
	pnlWoman.pos_x = screen_size.x/2 +150;
	pnlWoman.alpha = 75;
	txt_people_connected.pos_x = screen_size.x - 350;
}

// Server Called
function server_called()
{
	if((event_type == event_join) && (people_connected < MAX_CONNECTIONS))
	{
		ifdef server;
			people_connected += 1;
			send_var(people_connected);
		endif;
	}
	if (event_type == event_leave)
	{
		ifdef server;
			people_connected -= 1;
			send_var(people_connected);
			server_says_start = TRUE;
			send_var(server_says_start);
		endif;
	}
}


// On Event
on_server = server_called;

// Create Player
function create_player()
{
	var position_found = FALSE;
	while(position_found == FALSE)
	{
		vecFrom.x = -400 + random(800);
		vecFrom.y = -400 + random(800);
		vecFrom.z = 200;
		vec_set(vecTo,vecFrom);
		vecTo.z = -200;
		trace_mode = IGNORE_SPRITES+IGNORE_PASSENTS+IGNORE_PASSABLE+IGNORE_MODELS+USE_BOX+SCAN_TEXTURE;
		TRACE(vecFrom,vecTo);
		if((str_stri(tex_name,"earthtile") != FALSE)||(str_stri(tex_name,"crator") != FALSE))
		{
			vec_set(temp_loc,vecTo);
			temp_loc.z = target.z + 35;
			if (profession_ID == PROF_MAN)
			{
				player = ent_create(man,temp_loc,move_man);
			}
			if (profession_ID == PROF_WOMAN)
			{
				player = ent_create(woman,temp_loc,move_woman);
			}
			position_found = TRUE;
		}
	}
}

// Main
function main()
{
	//rondomize();
	if (connection == 2)
	{
		while(server_says_start == FALSE)
		{
			wait(1);
		}
	}
	if (connection != 1)
	{
		init_display();
		display_info();
		mouse_mode = 2;
		mouse_on();
		pnlMan.visible = ON;
		pnlWoman.visible = ON;
		pnlTitle.visible = ON;
		pnlSelect.visible = ON;
		if(connection)
		{
			txt_people_connected.visible = ON;
		}
		while(profession_not_set)
		{
			wait(1);
		}
		mouse_off();
		pnlMan.visible = OFF;
		pnlWoman.visible = OFF;
		pnlTitle.visible = OFF;
		pnlSelect.visible = OFF;
		create_player();
	}
ifdef client; 
	client_text.visible=on;
endif;
ifdef server;
diag("\nWillkommen");
diag("\n2nd World Server gestartet");
diag("\n2nd World Server by virtualmarctek");
diag("\nSponsored by ploppGroup");

	while(connection==0)
	{
		wait(1);
	}

endif;
level_load(world_str);
}

// Mouse ON
function mouse_on()
{
	MOUSE_MAP = pcxArrow;
	while(MOUSE_MODE > 0)
	{
		MOUSE_POS.X = POINTER.X;
		MOUSE_POS.Y = POINTER.Y;
		wait(1);
	}
}

// Mouse OFF
function mouse_off()
{
	MOUSE_MODE = 0;
}


Client:
Code:
// BMAPS
bmap pcxArrow = <arrow.pcx>;
bmap bmpMAN = <man.bmp>;
bmap bmpWOMAN = <woman.bmp>; 
bmap pcxTitle = <title.pcx>;
bmap pcxSelect = <select.pcx>;

// Defines
define FALSE, 0;
define TRUE, 1;
define PROF_MAN, 1;
define PROF_WOMAN, 2;
define PLAYER_NUMBER, skill1;
define SCORE, skill2;
define PROFESSION, skill3;
define SPEED, skill4;
define HEALTH, skill5;
define MAX_HEALTH, skill6;
define ARMOR_CLASS, skill7;

// Fonts
font arial_schrift="Arial",0,12;

// Strings
string serverstring = "Dies ist keine Serverversion, sodern ein Client!\n Nur virtualmarctek und welche die von virtualmarctek eine Erlaubnis haben, \n dürfen einen Server erstellen.";
string world_str = <level.wmb>;
string MAN = <man.mdl>;
string WOMAN = <woman.mdl>;
string str_people_connected;
string str_temp;

// Vars
var fps_max = 60;
var fps_lock = ON;
var video_mode = 7;
var video_screen = 2;
var mouse_mode = 2;
var people_connected = 0;
var number_of_players = 0;
var server_says_start = FALSE;
var profession_ID;
var temp_loc[3];
var vecFrom[3];
var vecTo[3];
var profession_not_Set = TRUE;

// Texts
text server_text
{
font=arial_schrift;
pos_x=20;
pos_y=200; 
string=serverstring;
}

text txt_people_connected
{
	pos_x = 0;
	pos_y = 65;
	layer = 15;
	font arial_schrift;
	string str_people_connected;
}

// Panels

panel pnlMan
{
	bmap bmpMAN;
	layer = 21;
	pos_x = 0;
	pos_y = 0;
	on_click = set_prof_man;
	flags = overlay,transparent,refresh;
}

panel pnlWoman
{
	bmap bmpWOMAN;
	layer = 21;
	pos_x = 0;
	pos_y = 0;
	on_click = set_prof_woman;
	flags = overlay,transparent,refresh;
}

panel pnlTitle
{
	bmap = pcxTitle;
	layer = 18;
	pos_x = 0;
	pos_y = 0;
	flags = overlay,transparent,refresh;
}

panel pnlSelect
{
	bmap = pcxSelect;
	layer = 18;
	pos_x = 0;
	pos_y = 0;
	flags = overlay,transparent,refresh;
}

// Display Info
function display_info()
{
	while(1)
	{
		str_cpy(str_people_connected, "People Connected: ");
		str_for_num(str_temp, people_connected);
		str_cat(str_people_connected, str_temp);
		wait(1);
	}
}

//Move MAN
action move_man
{
	my.profession = PROF_MAN;
	move_player();
}

//Move WOMAN
action move_woman
{
	my.profession = PROF_WOMAN;
	move_player();
}

// Move Player
function move_player()
{
	my.pan = random(360);
	while(1)
	{
		wait(1);
	}
}

// Create Player
function create_player()
{
	var position_found = FALSE;
	while(position_found == FALSE)
	{
		vecFrom.x = -400 + random(800);
		vecFrom.y = -400 + random(800);
		vecFrom.z = 200;
		vec_set(vecTo,vecFrom);
		vecTo.z = -200;
		trace_mode = IGNORE_SPRITES+IGNORE_PASSENTS+IGNORE_PASSABLE+IGNORE_MODELS+USE_BOX+SCAN_TEXTURE;
		TRACE(vecFrom,vecTo);
		if((str_stri(tex_name,"earthtile") != FALSE)||(str_stri(tex_name,"crator") != FALSE))
		{
			vec_set(temp_loc,vecTo);
			temp_loc.z = target.z + 35;
			if (profession_ID == PROF_MAN)
			{
				player = ent_create(man,temp_loc,move_man);
			}
			if (profession_ID == PROF_WOMAN)
			{
				player = ent_create(man,temp_loc,move_woman);
			}
			position_found = TRUE;
		}
	}
}

// Set Prof Man
function set_prof_man()
{
	profession_ID = PROF_MAN;
	profession_not_Set = FALSE;
}

// Set Prof Woman
function set_prof_woman()
{
	profession_ID = PROF_WOMAN;
	profession_not_set = FALSE;
}

// init display
function init_display()
{
	pnlTitle.pos_y = screen_size.y/2 + 100;
	pnlTitle.pos_x = screen_size.x/2 -150;
	pnlTitle.alpha = 75;
	pnlSelect.pos_y = screen_size.y/2 -100;
	pnlSelect.pos_x = screen_size.x/2 -150;
	pnlSelect.alpha = 75;
	pnlMan.pos_y = screen_size.y/2;
	pnlMan.pos_x = screen_size.x/2 - 300;
	pnlMan.alpha = 75;
	pnlWoman.pos_y = screen_size.y/2;
	pnlWoman.pos_x = screen_size.x/2 +150;
	pnlWoman.alpha = 75;
	txt_people_connected.pos_x = screen_size.x - 350;
}

// Main
function main()
{
	//rondomize();
	if (connection == 2)
	{
		while(server_says_start == FALSE)
		{
			wait(1);
		}
	}
	if (connection != 1)
	{
		init_display();
		display_info();
		mouse_mode = 2;
		mouse_on();
		pnlMan.visible = ON;
		pnlWoman.visible = ON;
		pnlTitle.visible = ON;
		pnlSelect.visible = ON;
		if(connection)
		{
			txt_people_connected.visible = ON;
		}
		while(profession_not_set)
		{
			wait(1);
		}
		mouse_off();
		pnlMan.visible = OFF;
		pnlWoman.visible = OFF;
		pnlTitle.visible = OFF;
		pnlSelect.visible = OFF;
		create_player();
	}
ifdef client; 
	while(connection==0)
	{
		wait(1);
	}
endif;
ifdef server;
	server_text.visible=on;
	diag("Dies ist keine Serverversion, sodern ein Client!\n Nur virtualmarctek und welche die von virtualmarctek eine Erlaubnis haben, \n dürfen einen Server erstellen.");
endif;
level_load(world_str);
}

// Mouse ON
function mouse_on()
{
	MOUSE_MAP = pcxArrow;
	while(MOUSE_MODE > 0)
	{
		MOUSE_POS.X = POINTER.X;
		MOUSE_POS.Y = POINTER.Y;
		wait(1);
	}
}

// Mouse OFF
function mouse_off()
{
	MOUSE_MODE = 0;
}

Posted By: croman

Re: [DE/EN]client connecting problem - 07/01/08 14:45

i don't know if you saw my previous post...but anyway i'll post my code here:


game.c
Code:
#include <acknex.h>
#include <default.c>
#include "status.c"
#include "windows.h"
#include "d3d9.h"


//---------------------------------------------------------------------------------------------||
// some global vars, defines...
//---------------------------------------------------------------------------------------------||
#define force_x skill1
#define force_y skill2
#define force_z skill3
#define force_pan skill4
#define MAX_CONNECTIONS 8

VECTOR camVel;
var force[3];
var vecFrom[3];
var vecTo[3];


//---------------------------------------------------------------------------------------------||
// function prototypes
//---------------------------------------------------------------------------------------------||
void playerAct();
void inputs();
void server_called();
void client_called();
void donothing(){wait(1);}


//---------------------------------------------------------------------------------------------||
// main function
//---------------------------------------------------------------------------------------------||
int main()
{
	video_mode = 8;
	video_depth = 32;
	video_screen = 2;
	fps_max = 60; // lock fps at 60 for all players
	fps_lock = ON;
	dplay_smooth = 0; // dplay_smooth is causing too much overshoot and jerks
	
	on_server = server_called; // on server event, call server_called()
   on_esc = donothing;
   
   wait(-.3);
   if(connection == 3){
   	people_connected = 1;
   	str_cpy(messages_str, "Connecting as a HOST...");
   	wait(-3);
   	reset(messages_txt, VISIBLE);
   	set(connected, VISIBLE);
   	set(status, VISIBLE);
   	video_window(NULL,NULL,16,"HOST...");
   }
   if(connection == 2){
   	str_cpy(messages_str, "Connecting as a CLIENT...");
   	wait(-3);
   	reset(messages_txt, VISIBLE);
   	set(connected, VISIBLE);
   	set(status, VISIBLE);
   	video_window(NULL,NULL,16,"CLIENT...");
	}

   level_load("test.wmb");
   wait(-.3);
   player = ent_create("aim.mdl", vector(0,0,100), playerAct);
   wait(-.3);
   
   inputs();
   
    
   while(1)
	{
		again:
		// constantly checks if server is still online
		if(dplay_bps == 0 && dplay_latency == 0 && connection == 2)	{
			if (MessageBox(NULL, "Server is offline and the game will shutdown.", "Error", MB_OK | MB_ICONSTOP) == IDOK){
				sys_exit(NULL);
			}
		}
		if(key_esc){
			while(key_esc){wait(1);}
			if(MessageBox(NULL, "Do you really want to quit?", "Quit?", MB_YESNO | MB_ICONQUESTION) == IDYES){sys_exit(NULL);}
				else{wait(1);goto again;}
		}
		wait(1);
	}
}


//---------------------------------------------------------------------------------------------||
// function for handling inputs
//---------------------------------------------------------------------------------------------||
void inputs()
{
	while(1){
		player.force_x = (key_w - key_s) * time_step * 15;
		player.force_y = (key_a - key_d) * time_step * 15;
		player.force_pan -= mouse_force.x * 15 * time_step;
		
		if(connection == 2){
			send_skill(player.force_x, SEND_VEC);
			send_skill(player.force_pan, 0);
		}
		
		wait(1);
	}
}


//---------------------------------------------------------------------------------------------||
// move player function
//---------------------------------------------------------------------------------------------||
void movePl()
{
	while(1){
		my.pan = my.force_pan;
	
		force[0] = my.force_x * 15 * time_step;
		force[1] = my.force_y * 10 * time_step;
		force[2] = 0;
		
		move_mode = GLIDE|IGNORE_PASSABLE|IGNORE_PASSENTS|IGNORE_YOU;
		c_move(my, force, nullvector,move_mode);
	
		if (my.force_x || my.force_y || my.force_z)
		{
			trace_mode = IGNORE_SPRITES|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_MODELS|USE_BOX;
			vec_set(vecFrom,my.x);
			vec_set(vecTo,my.x);
			vecTo[2] -= 400;
			result = c_trace(vecFrom,vecTo,trace_mode);
			my.z = target.z + ((my.max_z - my.min_z)/2);//Set to the floor
		}
		wait(1);
	}
}


//---------------------------------------------------------------------------------------------||
// player action
//---------------------------------------------------------------------------------------------||
action playerAct()
{
	my.emask |= ENABLE_DISCONNECT;
	my.smask |= NOSEND_FRAME;
	
	c_setminmax(my);
	
	wait(-.3);
	ent_sendnow(my);
	wait(-.3);

	set(me, SHADOW);
	movePl();
}


//---------------------------------------------------------------------------------------------||
// function Server_Called(): server was called
//---------------------------------------------------------------------------------------------||
void server_called()
{
	if ((event_type == EVENT_JOIN) && (people_connected < MAX_CONNECTIONS))
	{
		people_connected += 1; // another person connected
		send_var(people_connected); // send number of people connected
	}
	if (event_type == EVENT_LEAVE)
	{
		people_connected -= 1; // one less person connected to server
		send_var(people_connected); // send number of people connected
	}
}


//--------------------------------------------------------------------
// player events
//--------------------------------------------------------------------
void player_events()
{
	if (event_type == EVENT_DISCONNECT)
	{
		ent_remove(me); // remove ent of player that quit
	}
}



status.c
Code:
STRING* messages_str = "#50";
var people_connected;
#define player_number skill20
var number_of_players;

FONT* arial_font = "Arial#20";

TEXT* messages_txt =
{
	pos_x = 400;
	pos_y = 300;
   layer = 10;
   font(arial_font);
   string (messages_str);
   flags = visible;
}

PANEL* connected =
{
	pos_x = 10; pos_y = 10;
	digits(0,0,"People connected:  %.f",arial_font,1,people_connected); 
	digits(0,20,"Player name:  %s",arial_font,1,player_name);
}

PANEL* status =
{
	pos_x = 10; pos_y = 10;
	digits(800,0,"x: %.1f",arial_font,1,player.x); 
	digits(800,20,"y: %.1f",arial_font,1,player.y); 
	digits(800,40,"z: %.1f",arial_font,1,player.z); 
	digits(800,60,"pan: %.1f",arial_font,1,player.pan); 
}



you'll need d3d9.h and windows.h header files in that projet folder

one more time, try what i told you in my post two posts before this one smile , try forwarding 2300 port...
Posted By: virtualmarctek

Re: [DE/EN]client connecting problem - 07/01/08 15:15

thanks i will try it! I started with a small chat with multiplayer programming!
Posted By: virtualmarctek

Re: [DE/EN]client connecting problem - 07/01/08 15:37

ok it works! Thanks for an example. I will write some new things to that, like camera and so on!
Posted By: croman

Re: [DE/EN]client connecting problem - 07/01/08 15:40

no problem, glad i've been helpful...
Posted By: Hand_Of_Law

Re: [DE/EN]client connecting problem - 07/02/08 09:47

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. crazy
Quote:
#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();
}

Posted By: croman

Re: [DE/EN]client connecting problem - 07/02/08 09:56

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...
Posted By: Hand_Of_Law

Re: [DE/EN]client connecting problem - 07/02/08 14:59

No change...still no player movement.
But thanks for the idea wink
Posted By: croman

Re: [DE/EN]client connecting problem - 07/02/08 15:02

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.
Posted By: Hand_Of_Law

Re: [DE/EN]client connecting problem - 07/02/08 15:52

Actually the code you posted does not work for me either.
While the entities spawn, they do not move.
Posted By: croman

Re: [DE/EN]client connecting problem - 07/02/08 15:59

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...
Posted By: Hand_Of_Law

Re: [DE/EN]client connecting problem - 07/02/08 16:17

Originally Posted By: cerberi_croman
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...
Well Copy/Paste usually does not generate a lot of errors laugh
Posted By: croman

Re: [DE/EN]client connecting problem - 07/02/08 16:23

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...
Posted By: Hand_Of_Law

Re: [DE/EN]client connecting problem - 07/02/08 16:41

I got your code to work.
It needed adding a camera as in the test level I used it spawned inside an object. wink
Thanks for the assistance, and now I am off to create my next problem.
Posted By: croman

Re: [DE/EN]client connecting problem - 07/02/08 16:44

laugh good luck with that
© 2024 lite-C Forums