Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (vicknick), 776 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
New to Multiplayer - Simple question #91541
09/26/06 03:08
09/26/06 03:08
Joined: Jan 2003
Posts: 798
New Zealand
Bright Offline OP
User
Bright  Offline OP
User

Joined: Jan 2003
Posts: 798
New Zealand
Hey guys,
I've been making single player games for as long as I can remember and I have always been wanting to get into the Multiplayer side of GameStudio.
However, I am the kind of guy that likes to script stuff from scratch. I don't like following template scripts (sorry guys ). The tutorials I have looked at require the templates so I havent really worked with them much.
I was wondering, how would I make a simple player join and walk around script.
For example:
Code:
 
function main()
{
load_level <arena.wmb>;
}

action player
{
var myspeed;
while(1)
{
myspeed.x = (key_w-key_s) * 10 * time;
c_move (me, myspeed, nullvector, glide);

my.pan += (key_a-key_d) * 10 * time;

wait(1);
}
}



Im a newbie to all of this. I know the basic -sv and -cl stuff. Im willing to teach myself how to work the rest of the multiplayer code. I was just wanting a little kick start

Thanks heaps guys
-Bright


KAIN - Coming soon...
Re: New to Multiplayer - Simple question [Re: Bright] #91542
09/26/06 05:03
09/26/06 05:03
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
a simple and ugly code would be:

Code:
 

var shell;

function main
{
load_level <arena.wmb>;
shell=ent_create("player.mdl",nullvector,null);
player=ent_createlocal("player.mdl",nullvector,player_action);
}

action player_action
{
while(1){
c_move(player,vector((((key_w-key_s)*15)*time),(((key_a-key_d)*10)*time),0),nullvector,ignore_passable|glide);
vec_set(shell.x,my,x);
vec_set(shell.roll,my.roll);
send_skill(shell.x,send_vec); // send position
send_skill(shell.roll,send_vec); // send roll pan and tilt
wait(1);
}
}



Last edited by Michael_Schwarz; 09/26/06 05:04.

"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: New to Multiplayer - Simple question [Re: Michael_Schwarz] #91543
09/26/06 20:52
09/26/06 20:52
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
um, is it really necessary to send position and orientation? i know there's a nosend-event/flag for this, so i assumed it will be updated automatically. wrong?

Re: New to Multiplayer - Simple question [Re: broozar] #91544
09/26/06 21:31
09/26/06 21:31
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
if you move th entitty on the server its updated yes, but you might want to move it als client, then the server values would be overwrite the local position, it would make you get stuck. Thats why we send pos/orient to the server.


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: New to Multiplayer - Simple question [Re: Michael_Schwarz] #91545
09/27/06 20:01
09/27/06 20:01
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
thanks, though i didn't get it completely. if i didn't create the player via ent_createlocal, i wouldn't have to send th vars, or is that not possible at all?

Re: New to Multiplayer - Simple question [Re: broozar] #91546
09/27/06 21:41
09/27/06 21:41
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
Quote:

thanks, though i didn't get it completely. if i didn't create the player via ent_createlocal, i wouldn't have to send th vars, or is that not possible at all?




yes, but you would experience heavy lag on client side and the so called "rubber band" effect -> You get your position set back if your data doesnt arrive the server before it sends the new updated position to all clients.


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku

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