Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (AndrewAMD), 1,089 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
First Multiplayer attempt - ent_create #158798
10/05/07 15:07
10/05/07 15:07
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
Hi!

I have decided to create a multiplayer shooter with A7.

I have found Locoweeds tutorial and a forum thread written by ulf.

I have also found the Pong-Multiplayer example.

My first target was to create an entity that simply moves in a random direction.

But the action of the entity created on the client is not executed.
(Otherwise there would be a new text-file in my work folder)


I have some general questions, too.
1.) Are there any tutorials about multiplayer with lite-c/A7?
2.) I test the script on one pc instead of two....are there any restrictions?

Code:
#include <acknex.h>
#include <default.c>

var Test = 0;

STRING* Temp_Str = "#100";

ENTITY* Player;

action Dummy_Local_Act()
{

wait(-1);

str_for_num(Temp_Str,10);
Test = file_open_write(Temp_Str);

wait(1);

file_close(Test);

}

action Dummy_Act()
{

wait(-1);

proc_local(my, Dummy_Local_Act); // function for client

wait(-0.5);
ent_sendnow(my);
wait(-0.5);

str_for_num(Temp_Str,connection);
Test = file_open_write(Temp_Str);

wait(1);

file_close(Test);

}

function Create()
{

Player = ent_create("earth.mdl",vector(0,random(400)+200,30),Dummy_Act);
while(!Player) wait(1);

}

function main()
{

video_mode = 7; // 800x600
fps_max = 60; // limit the number of packets

randomize(); // create different random seed

while(connection == 0) {wait(1);}

wait(-1);
level_load("Testlevel.wmb");
wait(-1);

camera.z = 300;
camera.tilt = -50;
camera.pan = 90;

on_g = Create;

}



After execution of this script I find one new file in my work folder which has the name "3". This is obviously created by the server. (-sv -cl). But there is no file with the name "2" (-cl).

Re: First Multiplayer attempt - ent_create [Re: dennis] #158799
10/05/07 20:53
10/05/07 20:53
Joined: Sep 2007
Posts: 761
Hrvatska (Croatia ), Slavonski...
cro_games Offline
User
cro_games  Offline
User

Joined: Sep 2007
Posts: 761
Hrvatska (Croatia ), Slavonski...
Where can i download thet Pong-Multiplayer example???


Hello everyone my name is Ivan Mandic from "Frozen pixel studio". wink
-----------------------------------
Homepage: www.fpx-studio.com
e-mail: emu_hunter_1990@hotmail.com
(working on a game engine)
Re: First Multiplayer attempt - ent_create [Re: cro_games] #158800
10/05/07 21:48
10/05/07 21:48
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...

I have got it with the newest version of A7, I think.......

Re: First Multiplayer attempt - ent_create [Re: dennis] #158801
10/05/07 21:49
10/05/07 21:49
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...

Perhaps you can download it with the A7 demo or with the lite-c free version.

Re: First Multiplayer attempt - ent_create [Re: dennis] #158802
10/06/07 02:39
10/06/07 02:39
Joined: Jan 2003
Posts: 517
Illinois
G
giorgi3 Offline
User
giorgi3  Offline
User
G

Joined: Jan 2003
Posts: 517
Illinois
The client's action (Dummy_Act) runs on the server, not the client. Therefore the value of variable "connection" is based on how the server was started (-sv -cl = 3) not how the clients engine was started (-cl = 2). If you were to change Dummy_Local_Act to open a file based on connection, then you would find a file named 2 on the client itself.

Last edited by giorgi3; 10/06/07 02:45.

Giorgi3

10,000 parts flying in a close formation does not constitute an airplane. Some assembly is required.
Re: First Multiplayer attempt - ent_create [Re: dennis] #158803
10/06/07 08:39
10/06/07 08:39
Joined: Sep 2007
Posts: 761
Hrvatska (Croatia ), Slavonski...
cro_games Offline
User
cro_games  Offline
User

Joined: Sep 2007
Posts: 761
Hrvatska (Croatia ), Slavonski...
Can you ".zip-it" and send it to my e-mail?
info@cro-games.com


Hello everyone my name is Ivan Mandic from "Frozen pixel studio". wink
-----------------------------------
Homepage: www.fpx-studio.com
e-mail: emu_hunter_1990@hotmail.com
(working on a game engine)
Re: First Multiplayer attempt - ent_create [Re: giorgi3] #158804
10/07/07 17:32
10/07/07 17:32
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
Hi giorgi3,

i see that was my mistake....but it is not working either....

The code above should then do this...

I press <g> on server:
-> Dummy_Act creates a file "3"
-> Dummy_Act_Local creates the file "10"
error ---> there's only one file created ("3")

I press <g> on client:
-> Dummy_Act creates a file "3"
-> Dummy_Act_Local creates the file "10"
error ---> there's no file created......

Any suggestions?


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