1 registered members (Dico),
16,767
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
New to Multiplayer - Simple question
#91541
09/26/06 03:08
09/26/06 03:08
|
Joined: Jan 2003
Posts: 798 New Zealand
Bright
OP
User
|
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,440 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,440
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: broozar]
#91544
09/26/06 21:31
09/26/06 21:31
|
Joined: Aug 2003
Posts: 7,440 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,440
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
|
|
|
|