Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, alibaba), 1,184 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
entity cannot move after joining session #413504
12/14/12 19:18
12/14/12 19:18
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
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!


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);
		}
	}
}



new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: entity cannot move after joining session [Re: MPQ] #413509
12/14/12 20:33
12/14/12 20:33
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I don't know if you have seen this already but I suggest you take a look at the following wiki article:
http://opserver.de/wiki/index.php?title=Multiplayer


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: entity cannot move after joining session [Re: Superku] #413532
12/15/12 02:06
12/15/12 02:06
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
thanks superku, I started to read through the article and it really seems to help me out, theres one question left:

is the "server_connect"-funktion for Pro Version only or does it run on com too?


new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: entity cannot move after joining session [Re: MPQ] #413533
12/15/12 02:28
12/15/12 02:28
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
AFAIK there is no server_connect command.

If you mean session_connect, it's available in the commercial edition and above.

http://www.conitec.net/beta/asend-session_connect.htm


Always learn from history, to be sure you make the same mistakes again...
Re: entity cannot move after joining session [Re: Uhrwerk] #413560
12/15/12 12:20
12/15/12 12:20
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
ye meant session_connect, thank ya


new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: entity cannot move after joining session [Re: MPQ] #413571
12/15/12 13:56
12/15/12 13:56
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Originally Posted By: MPQ
ye meant session_connect, thank ya


You should use ANet it has much more tutorials, and unl players laugh
Com only has 8...

Re: entity cannot move after joining session [Re: Ch40zzC0d3r] #413574
12/15/12 14:34
12/15/12 14:34
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
Yop I've already taken a look at anet, maybe I'm gonna switch in near future.

@Superku, I tried your multiplayer code, it works quite well so far, and btw really understandable written! Thank you for that! But the connection problem keeps annoying me. I cannot join the server session with an onther pc. Using the same pc for client and server works fine.


new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: entity cannot move after joining session [Re: MPQ] #413575
12/15/12 14:36
12/15/12 14:36
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Originally Posted By: MPQ
I cannot join the server session with an onther pc.

This is a common problem with networking (not only gaming).
Just take a look at your firewall settings and if the computer connects with your computer over internet (not lan)
you need to setup your router correctly to use port forwarding to your computer.


Visit my site: www.masterq32.de
Re: entity cannot move after joining session [Re: MasterQ32] #413577
12/15/12 14:46
12/15/12 14:46
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
hmm makes sense that it is a router problem. As I already said my firewalls are turned off.

what do you mean by "connects with your computer over internet"? How can I adjust that? The server uses my internet connection with a specific local ip-address (192.168.2.116) automaticly assigned by my router. Then I execute the session_connect-function on my client pc (session_connect ("test", "192.168.2.116)"). But the client cannot find a server using this ip-adress.


new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: entity cannot move after joining session [Re: MPQ] #413590
12/15/12 16:40
12/15/12 16:40
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Can you reach the server machine with a ping when the problem occurs?


Always learn from history, to be sure you make the same mistakes again...
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1