Gamestudio Links
Zorro Links
Newest Posts
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
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Akow), 1,361 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Simple moving example #95237
10/21/06 14:11
10/21/06 14:11
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Hi guys,
I tried more than 5 times to write a code where each PC can move around with one Player, but I wasn't able to write such a code. Please post an example code, so that I can learn from it.
Thanks!

Dark_samurai


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: Simple moving example [Re: Dark_samurai] #95238
10/26/06 04:34
10/26/06 04:34
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Here you go dude.

Multiplayer Barebones

That should work for you over LAN. That is as simple as it gets man, enjoy. Welcome to the joys of multiplayer, the fun has only begun. Don't be fooled by the 175 lines of code, you will have a monster in your closet. But the code is simple and small enough to help figure out how to get started.

The first thing you will have to figure out is what functions/actions are being ran on the host/server and what is being ran on the client. From there life gets easier.

Use Cursor keys to move.

When you run from WED for Host this should be Command Line:
simple.wdl -nx 50 -d hires -diag -cl -sv

For Clients on LAN:
simple.wdl -nx 50 -d hires -diag -cl

Loco


Professional A8.30
Spoils of War - East Coast Games
Re: Simple moving example [Re: Locoweed] #95239
10/26/06 10:49
10/26/06 10:49
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/698114/an/0/page/0#Post698114

I answered to that threat a while ago, and maybe some of that answer will help you... hope it does, and I too welcome u to the fun world of MP games!

Micha


~"I never let school interfere with my education"~
-Mark Twain
Re: Simple moving example [Re: Germanunkol] #95240
10/26/06 14:10
10/26/06 14:10
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
I think it's not that difficult to program a multiplayer program (at the moment) cause I wrote a very cool chat program with features like kick someone, make Votings, write at someone specific,... I only had problems with c_move, cause I didn't know where I have to run it. But I will take a look at this.
Thank you!

PS: I think 175 lines is "nothing" and please excuse my bad english.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: Simple moving example [Re: Dark_samurai] #95241
10/27/06 00:14
10/27/06 00:14
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
The monster is still in the closet. But that is what makes it fun.

It's not getting it to run, it's getting it to run well over the internet that is a nightmare.

Trial and error. Test and tweak. Study. Test and tweak. The main thing is having someone you can constantly test with over the net.

And your welcome,
Loco


Professional A8.30
Spoils of War - East Coast Games
Re: Simple moving example [Re: Locoweed] #95242
10/27/06 18:33
10/27/06 18:33
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Quote:


It's not getting it to run, it's getting it to run well over the internet that is a nightmare.





If there would be no problems and nightmares, live would be boring!

So I've got it run now, but there is still one problem:
I have "overshootings" because of the Dead Rekoning. If I write that:

Code:

action player_move
{
my.polygon = on;
while(1)
{
player_dist.x = my.skill30 * time;
player_dist.y = my.skill31 * time;
player_dist.z = my.skill32 * time;
player_rote.pan = my.skill33;
player_rote.tilt = my.skill34;
player_rote.roll = my.skill35;
c_rotate(me,player_rote,ignore_passable + glide + use_polygon);
c_move(me,player_dist,nullvector,ignore_passable + glide + use_polygon);
ent_sendnow(me);
wait (1);
}
}


it works.

But if I only refresh the Entity, when it movement parameters are changed, it won't.

Code:

function Steuerung_Player()
{
var player_distold[3];
var player_roteold[3];
while(1)
{
if(Player)
{
player_distold[0] = player.skill30;
player_roteold[0] = player.skill33;
player.skill30 = 15 * (key_w - key_s);
player.skill33 = 2 * (key_a - key_d);

if(Player_distold[0] != player.skill30 || Player_roteold[0] != player.skill33)
{
send_skill(player.skill30,SEND_VEC);
send_skill(player.skill33,SEND_VEC);
ent_sendnow(Player);
}

camera.pan = player.pan;
camera.x = player.x;
camera.y = player.y;
camera.z = player.z + 30;
}
wait(1);
}
}




ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: Simple moving example [Re: Locoweed] #95243
10/28/06 17:24
10/28/06 17:24
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Quote:

The first thing you will have to figure out is what functions/actions are being ran on the host/server and what is being ran on the client. From there life gets easier.




I could have started a new thread, but since you mention this, I've got some questions about it. I've looked at the code, but how exactly do you make sure a function only get's run on the client? I'm making a game on which there are only 2 player, the server and the client.

Basically it's a strategy game, so the only thing I'm doing is spawn two camera's. However the mouse code I'm using for selecting entities for both players, only works on the server for some reason.

How can I make sure it runs both on the server ánd the client? Should I use 'proc_client(my,mouse_function);'?

How to best set stuff like this up? Should I only start those functions upon a join event? Do these function then still run on the server?

(I'm probably asking before having looked into it good enough, sorry for that )

Cheers

Last edited by PHeMoX; 10/28/06 17:26.

PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Simple moving example [Re: PHeMoX] #95244
10/29/06 08:27
10/29/06 08:27
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Write it like that:

Code:

function main()
{
level_load(Strategy_wmb);
while(connection == 0) {wait(1);}
wait(1);
Mouse_movement(); //Start the function, which controls the camera movement
}


function Mouse_movement()
{
.
.
.
}




Each PC which enters the session starts the function Mouse_movement().


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: Simple moving example [Re: Dark_samurai] #95245
10/29/06 09:20
10/29/06 09:20
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Okey, so starting a function in the main function, won't start it on the server?? I thought those functions run on the server

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Simple moving example [Re: PHeMoX] #95246
10/29/06 09:33
10/29/06 09:33
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Quote:


Okey, so starting a function in the main function, won't start it on the server??





Yep!

Dark_samurai


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Page 1 of 3 1 2 3

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