Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 05:41
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 (AbrahamR, AndrewAMD), 1,278 guests, and 2 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
Locoweeds MPTut #120115
03/29/07 19:46
03/29/07 19:46
Joined: Oct 2000
Posts: 113
L
Lawrence Offline OP
Member
Lawrence  Offline OP
Member
L

Joined: Oct 2000
Posts: 113
I have been working on this tutorial. Typing in all the commands(I find I learn and understand more if I type them in myself) to the point of the first test of a connection. I have built the small world and then tried it. It is the part where it places on the screen "people connected". My problem is the server shows '2' people connected and the client machine shows '0'. Does this matter or is it correct. I would have thought at worst case the client would say '1'.

I thought maybe I had typed something in wrong, so cut pasted it to make sure and still have the same problem.

Is this going to cause me a problem further on in the tutorial?

Lawrence

Re: Locoweeds MPTut [Re: Lawrence] #120116
03/29/07 20:30
03/29/07 20:30
Joined: Mar 2007
Posts: 27
P
PeterM Offline
Newbie
PeterM  Offline
Newbie
P

Joined: Mar 2007
Posts: 27
Did you go throu whole tutorial? just go ahead with the tutorial... if you did and it still doesnt work then i dont know:)
I think i was wondering the same when i went throu tutorial but I think its solved later on...

Re: Locoweeds MPTut [Re: PeterM] #120117
05/09/07 04:12
05/09/07 04:12
Joined: Feb 2002
Posts: 357
Florida
Zelek Offline
Senior Member
Zelek  Offline
Senior Member

Joined: Feb 2002
Posts: 357
Florida
If there was only one response to this in over a month, I guess I'm probably out of luck, but I am having this exact same issue.

I spent the last couple of days re-reading the tutorial and reviewing my code to make sure I hadn't missed something, but it looks like this is an actual bug with the code. I just ran the included source code (after fixing a typo in it) and it has the same problem: the client doesn't receive information, but the host does. No variables sent via 'send_var' are ever received by the client.

The thing is, when I run the Biosphere .exe included with the tutorial, it works perfectly! Does anyone know what's going on? I'll keep looking through the tutorial to see if anything's mentioned, but if the source code itself contains this problem, I'm not terribly hopeful. If anyone can point me to another simple/current/working example of multiplayer code, that would be awesome too. Thanks.

Re: Locoweeds MPTut [Re: Zelek] #120118
05/09/07 16:15
05/09/07 16:15
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
just add to this varaible +1 at your main function then it should work

Re: Locoweeds MPTut [Re: Scorpion] #120119
05/10/07 02:34
05/10/07 02:34
Joined: Feb 2002
Posts: 357
Florida
Zelek Offline
Senior Member
Zelek  Offline
Senior Member

Joined: Feb 2002
Posts: 357
Florida
I found the answer in an old post:
add "sleep(.5);" after the level load. It looks like you'll also want to sleep(.5) after you create an entity before you send it.

Maybe the engine changed since he wrote the tutorial, because it's been really thorough and great about not skipping steps up to this point.

I never thought I could be so happy to see the same variable on two different clients. It's like magic.

Re: Locoweeds MPTut [Re: Zelek] #120120
05/10/07 17:21
05/10/07 17:21
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Don't use sleep(.5); use wait(-.5).

Sleep is likely to get dropped from the syntax and then your back to square one

Also, here is the quote from the manual:
Quote:

One frame cycle after this instruction the level is loaded, two frame cycles after the instruction the local entities in the new map are created and their actions are started.





So 1/2 second is probably overkill (unless you are running at 2 FPS), but a good precaution.

PS: also note that if you ever intend to use Session_Connect(), it used to be we had to put a pause after that instruction as well but JCL hardcoded that instruction into the function. Why this isn't the same with level_load, I don't know.

Re: Locoweeds MPTut [Re: fastlane69] #120121
06/02/07 11:45
06/02/07 11:45
Joined: Jan 2006
Posts: 29
O
oriongu Offline
Newbie
oriongu  Offline
Newbie
O

Joined: Jan 2006
Posts: 29
I have the same problem, the wait(0.5); doesnt seem to change anything...

The vars just doesnt seem to get to the client.

This code should just show the number of people connected... but only the server shows anything.

//////////////// my code /////////////

path "Wads";
path "Sounds";
path "Models";
path "Entities";
path "Bitmaps";
path "Scripts";

font standard_font = "ackfont.pcx", 6, 9; // small text font

// --------------------------------------- Engine STRINGS

string world_str = <meetrikk.wmb>; // level string
string str_cbabe = <cube.mdl>; // CBabe Model

string str_people_connected; // number of people connected to server

string str_temp; // temp string

// --------------------------------------- Engine DEFINES

define MAX_CONNECTIONS, 64; // maximum number of people who can be connected to server

define FALSE, 0;
define TRUE, 1;

define player_number, skill1; // player number this entity owned by
define health, skill5; // health
define max_health, skill6; // max health of entity

// --------------------------------------- Engine VARIABLES

var fps_max = 60; // lock fps at 60 for all players
var fps_lock = ON;
var video_mode = 6; // screen size 800x600
var video_screen = 2; // start settings for Fullscreen
var mouse_mode = 2; // does not effect forces

// --------------------------------------- GAMES VARIABLES

var people_connected = 0; // number of people connected to server
var number_of_players = 0; // # of players in game
var server_says_start = FALSE; // client holds creating entity until server says go

var temp_loc[3]; // temp vector
var vecFrom[3]; // temp vectors
var vecTo[3];

//------------------------------------------PANELS------------------

text txt_people_connected
{
pos_x = 15;
pos_y = 15;
layer = 1;
font standard_font;
string str_people_connected;
}

// --------------------------------------- Engine MAIN

function main()

{
// if not a single player game, wait for connection

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

ifdef client;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;

level_load(world_str); // load level

wait(1); // make sure level is loaded

if(connection == 2) // client?
{
while (server_says_start == FALSE) // wait for server to signal ok to continue
{
wait(1);
}

}

if(connection == 3){people_connected = 1;} // Compte le serveur comme un joueur

if(connection != 1) // if dedicated server skip these
{
display_info(); // continually display any information we want to show

// if not single player mode, display multiplayer information
if(connection)
{
txt_people_connected.visible = ON;
}
}
}

function server_called()
{
// if new player connected, increment people connected
// and tell him it's ok to continue

if ((event_type == event_join) && (people_connected < MAX_CONNECTIONS))
{
ifdef server;
people_connected += 1; // another person connected
send_var(people_connected); // send number of people connected
server_says_start = TRUE; // send it's ok to go to newest client
send_var(server_says_start); // send start message
endif; // ifdef server
}

// some one disconnected
if (event_type == event_leave)
{
ifdef server;
people_connected -= 1; // one less person connected to server
send_var(people_connected); // send number of people connected
endif;
}
}


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

on_server = server_called; // on server event, call server_called()

Last edited by oriongu; 06/02/07 11:46.
Re: Locoweeds MPTut [Re: oriongu] #120122
06/02/07 23:00
06/02/07 23:00
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
a) event_join and event_leave are server only... no need to IFDEF then.
b) Have you tried 1's and 0's for TRUE and FALSE. These are vars after all, not strings.
c) Once you get everything done, you do realize that that message is being sent to all clients currently logged in. This may be fine since if you are already in for a long time it's ok to start but if you get two poeple coming into your game at the same time, as soon as one is ready, the other will also get the go-ahead whether it's ready or not. Something for you to think about in your network object flow design.

Re: Locoweeds MPTut [Re: fastlane69] #120123
06/04/07 18:17
06/04/07 18:17
Joined: Jan 2006
Posts: 29
O
oriongu Offline
Newbie
oriongu  Offline
Newbie
O

Joined: Jan 2006
Posts: 29
First , i thought i did modify my post , seems like i forgot.

i solved my problem by putting a wait(1);

Quote:

if ((event_type == event_join) && (people_connected < MAX_CONNECTIONS))
{
wait(1);
ifdef server;
people_connected += 1; // another person connected
send_var(people_connected); // send number of people connected
server_says_start = TRUE; // send it's ok to go to newest client
send_var(server_says_start); // send start message
endif; // ifdef server
}




Thanks for your reply fastlane....

For the true and false , its just me who prefer true's and false's than 1's and 0's.

I never done multiplayer coding , so im finding it quite hard but i love it.

Im not intending to have dozens of people on this game lol , so i dosnt really matter , but you are right im gonna have to change my code to allow people to come in one by one.

Just a la last question : Where'nt you doing a mmorpg? some sort of mmorpg kit?




Re: Locoweeds MPTut [Re: oriongu] #120124
06/04/07 19:07
06/04/07 19:07
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Dropped the kit idea. Too risky and unprofitable.
Now fleshing out my Educational MMOG and then I'll maybe license the engine source but not as a "kit" persay. Though in truth, since my MMOG platform is built with 3DGS, WED, SED, MED, and the ongoing script development are pretty much a "kit" if you have my source.

That wait() troubles me. It is VERY bad to have a wait within an event. An event should be processed as quickly and independently as possible, often serving as no more than process to store the event for further use later on.

Do me a favor. Take out the wait AND the IFDEF's. See if it still works. Like I said before, those IFDEF SERVERS are redundent inside that event and there is no logical reason why putting a wait() where you did should make it work.

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