Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, OptimusPrime, AndrewAMD), 14,882 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Walking #179894
01/25/08 11:13
01/25/08 11:13
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Hi there im trying to learn how multiplayer is working i'm reading 3 diffrent tutorials about it but im still stuck at the movement code

I got the connection established the spawn work's the camera works the only thing that doesn't work is the movement :S

Can someone help me a bit with this part ?
And explain me what the code does if you write a code ^^

Thnx allready

Here is my current code.

Code:
 

// test.wdl


////////////////////////////////////////////////////////////////////////////
// function prototypes
string cbabe_mdl = <Grass.mdl>;
string level_str = <test.WMB>;

////////////SKILLS////////////
define WSpeed, skill2; //Walk Speed
define TSpeed, skill3; //Turn Speed
var move_vec[3]; //Move Speed

//////////////////////////////

// Desc: user controlled player
FUNCTION player_client
{
player = my;
camera.genius = player;
wait(1);
player.skill2 = 5;
player.skill3 = 5;

vec_set(temp, my.x);
temp.z -= 100; // trace downwards 500 quants below

c_trace (my.x,temp,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS|IGNORE_SPRITES|SCAN_TEXTURE);


vec_set(camera.x,vector(player.x,player.y,player.z+50));
vec_set(camera.pan,player.pan);
wait(1);


player_walk();
}





FUNCTION player_walk()
{
move_vec[0] = (key_w - key_s)*MY.WSpeed *time;
if(key_a)
{
my.pan += my.TSpeed*time_step;
}
if(key_d)
{
my.pan -= my.TSpeed*time_step;
}


}



function main()
{
// Create the Cbabe entity on for each Client Session Joining our game world
level_load(level_str);
wait(1);
if (connection & CONNECT_CLIENT)
{
// wait until the level is loaded, and the connection is established
while (connection == 0) { wait(1); }

// create the babe entity at a random place somewhere near the start
temp.X = -6;
temp.Y = -22;
temp.Z = 10;
player = ent_create(cbabe_mdl,temp,player_client);

}


}





-The Dragon's Eye is alway's watching you!-
Re: Walking [Re: SurudoiRyu] #179895
01/26/08 05:03
01/26/08 05:03
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline
Serious User
PrenceOfDarkness  Offline
Serious User

Joined: Aug 2004
Posts: 1,305
New York
you player_walk function is only happening once, so if the keys aren't being pressed when it run nothing will happen. You need that instruction to continue to happen for the rest of the game or until the player is no longer there. Any ideas what will help?

The answer is simple! A while loop

just make this simple adjustment:
Code:

function player_client
{
...//everything above this stays the same

while(1){wait(1);player_walk();}
}



That "should" fix it for you. GL!

If my prediction is right, your next problem will be the twitching

Last edited by PrenceOfDarkness; 01/26/08 05:04.

"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: Walking [Re: PrenceOfDarkness] #179896
01/26/08 07:43
01/26/08 07:43
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
hehehe what is twitching ? never heard of that word can you explain me (dutch so doesn't know all the words )

and it works btw i can now rotate xD but forward and backwards doesn't work :s why doesn't that work?

Last edited by SurudoiRyu; 01/26/08 07:46.

-The Dragon's Eye is alway's watching you!-
Re: Walking [Re: SurudoiRyu] #179897
01/26/08 10:34
01/26/08 10:34
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline
Serious User
PrenceOfDarkness  Offline
Serious User

Joined: Aug 2004
Posts: 1,305
New York
another word for twitch i guess is shake.

move_vec[0] = (key_w - key_s)*MY.WSpeed *time; <--- all this is doing is setting the move_vec[0] array to the value of (key_w - key_s)*MY.WSpeed *time...
it's the same as if you would set a value to a variable..

For example:
var x;
x = 5;

All I did was set the variable x to the value of 5... now I need to do something with this variable. Try using c_move... incase you have no idea what's going on here it is:

c_move(my,vector(move_vec[0],0,0),nullvector,GLIDE|IGNORE_PASSABLE);

put the above code anywhere inside the player_walk() function and it should work... do this:

Code:

FUNCTION player_walk()
{
move_vec[0] = (key_w - key_s)*MY.WSpeed *time;
c_move(my,vector(move_vec[0],0,0),nullvector,GLIDE|IGNORE_PASSABLE);
...




It sounds to me like you have little to know clue of what is really going on here. Do you know lite C or WDL? If not then wet your feet with the basics first, or else I promise you, you will never get multiplayer.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: Walking [Re: PrenceOfDarkness] #179898
01/26/08 11:06
01/26/08 11:06
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
hehe i have some expierence but absolute not with multiplayer im trying to get it working right now

I allready have made a login true a DB on the internet get out value's spawn walk after this im going to do a chat which i allready wrote earlier ^^

bit by bit i will come there

But thanks for the help i think i missed that part of c_move >.<


-The Dragon's Eye is alway's watching you!-

Moderated by  HeelX, Spirit 

Gamestudio download | 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