Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,250 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with server variable in network code #145219
08/02/07 10:29
08/02/07 10:29
Joined: Jul 2005
Posts: 14
R
redgecko Offline OP
Newbie
redgecko  Offline OP
Newbie
R

Joined: Jul 2005
Posts: 14
I'm going through the process of converting Locoweeds Multiplayer tutorial to lite-c but I'm having problems with using the server and client variables that are set from command line options when starting in server or client mode.
In particular code such as

#ifdef server
while(connection== 0) {wait(1);} // wait until level loaded & connection set
#endif

is not executed when started in server mode.
Are the server and client variables not used with lite-c and if not how can I modify this code.
Also, is there a way of accessing command line arguments such as with argv[].

Thanks,
Paul

Re: Problem with server variable in network code [Re: redgecko] #145220
08/02/07 10:37
08/02/07 10:37
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Haven't messed with lite-c multiplayer yet, so I don't know about the server command line. But maybe you can try SERVER and SV or sv, since names are now case sensitive.

The commandline can be read from the command_str STRING*.

Re: Problem with server variable in network code [Re: redgecko] #145221
08/02/07 11:23
08/02/07 11:23
Joined: Jun 2001
Posts: 1,004
Dossenbach
N
nfs42 Offline
Serious User
nfs42  Offline
Serious User
N

Joined: Jun 2001
Posts: 1,004
Dossenbach
manual says server only(?) in c-script !

you can always use connection to detect client/server or both connection

also i think server causes troubles in your mp code, because conitecs engine needs every var, string, .. in the right order on server && client to work properly.


Andreas
GSTools - Home of
GSTScript 0.9.8: lua scripting for A6/7/8
GSTNet 0.7.9.20: network plugin for A6/7/8
GSTsqlite 1.3.7: sql database plugin for A6/7/8
3DGS Codebase: 57 snippets || 3DGS Downloads: 248 files
Re: Problem with server variable in network code [Re: nfs42] #145222
08/02/07 11:51
08/02/07 11:51
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
That's good to know. Not that I'm planning to use 3DGS MP for my own projects, though..

Quote:

also i think server causes troubles in your mp code, because conitecs engine needs every var, string, .. in the right order on server && client to work properly.



Not as long as you don't wrap your variable and function definitions inside #ifdefs. The actual definition doesn't matter, as long as they are defined in the same order.

// Bad idea:
#ifdef server
void myfunc(){}
var myvar;
#endif

// No problem:
void myfunc()
{
#ifdef server
...
#endif
}

Re: Problem with server variable in network code [Re: Excessus] #145223
08/09/07 06:26
08/09/07 06:26
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
In fact, neither of the two version would work. The correct solution is:

Code:

void myfunc()
{
if (connection & CONNECT_SERVER) {
...
}
}



Re: Problem with server variable in network code [Re: jcl] #145224
08/09/07 10:28
08/09/07 10:28
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Oh yes, ofcourse.. I was still thinking in C-script

Re: Problem with server variable in network code [Re: jcl] #145225
08/22/07 11:38
08/22/07 11:38
Joined: Jul 2005
Posts: 14
R
redgecko Offline OP
Newbie
redgecko  Offline OP
Newbie
R

Joined: Jul 2005
Posts: 14
Thanks jcl, that fixed my problem. However I've now got another problem. When I use ent_create to create a player, the action is applied on the server but not on the Clients. ie. The model is created in the level and can be seen on the server and all clients but the action (move_player) is only applied to the server. Here's some code:

action move_player()
{

my.pan = random(360); // face random direction

// increment number_of_players
number_of_players += 1;
send_var_to(NULL, number_of_players); //send 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

while(1)
{
my.pan += 5;
wait(1);
}

}


//--------------------------------------------------------------------
// CREATE PLAYER - create player at random location
//--------------------------------------------------------------------
function create_player()
{

// get random start vector around center of level
vecFrom[0] =-400 + random(800);
vecFrom[1] =-400 + random(800);
vecFrom[2] = 200;

// create player's entity
player = ent_create(str_board,vecFrom,move_player);

}

So the model created when running as the server rotates but the models on the clients do not and number_of_players is not being incremented.

Any suggestions?

Thanks,
Paul


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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