Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 622 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: player creation [Re: sheefo] #90516
09/20/06 14:10
09/20/06 14:10
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 a lot, but how I can display the players points on a score board when a player presses TAB. It shall only display locally, like on Age of Empires when you click the button and all players scores are displayed in the corner.

Also, how can my units be formatted? After I initialize every skill do I have to send_skill it? These question are really, how and when do I use send_skill and send_var?




you could store the score on the server and/or let it even calculate there:

Code:
 define skill99,done_something_great;
define skill98,score;

function completed_objective
{
my.done_something_great=1;
send_skill(my.done_something_great,0);
}

function calculate_score
{
while(1)
{
if(my.done_something_great)
{
my.score+=1; // Add score
my.done_something_great=0; // reset bool
send_skill(my.score,send_vec+send_all); // save bandwith by sending skill 98,99 and 100. and send to ALL clients
wait(1); //wait one frame to not add another score as the data needs time to be transferred.
}
wait(1);
}
}

action server_shell
{
//etc...

calculate_score();
}



to you question about when to send:

when you have changed a value you have to send it immediatley after you changed it like:

you.hp-=1;
send_skill(you.hp,0); // use send_all instead of 0 when executed on server

or when you change a var:

var bGodMode;
//...
bGodMode=1;
send_var(bGodMode);

its all that simple.

About skills you can remember that you should try to send the less as possible. send_vec sends a vector(e.g. the two consecutive skills->
send_skill(my.skill1,send_vec); sends my.skill1, 2 and 3)
so place the order of your skills wiseley the way you can send 3 important skills in one flush.

for vars there is to remember that its better to send a array than sending individual vars.
Every var you initialze(var somename;) has 3 (!) values, use them!

REMEMBER:
var somename; = var somename[3];

every time you send a var not using that 2 left parameters, you are wasting two bytes(2 zeros) of data!


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: player creation -handles and pointers [Re: Michael_Schwarz] #90517
09/20/06 16:41
09/20/06 16:41
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Quick correction; maybe it's relevant, maybe not:

Pointers are unique to the local computer... after all they refer to a local memory address. Pointers are what the 3DGS engines uses to manipulate entities.

Handles however are global to the network... they refer to a global ID that the 3DGS server assigns to all global entities. Handles are never used to manipulate entities.

Thus if you want unique identification across a network without skills:

1) you would get the pointer to the global entity you want,
2) use the handle() command to get it's handle; you now have a unique, global identifier for that entity.
3) You can send this handle over the network as a var to another client or the server (using a skill or a network var),
4) and use a ptr_for_handle() to resolve that global handle to a local point; now you have the pointer to the SAME ENTITY but on a different computer.

In this case the following snippet:
Code:
if(your.id==2)
{
target_hp=your.hp;
target_shield=your.shield;
}
etc...



Gets replaced with something like this:
Code:

player=ptr_for_handle(sent_handle);
target_hp=player.hp;
target_shield=player.shield;
etc...



Re: player creation [Re: Michael_Schwarz] #90518
09/20/06 16:58
09/20/06 16:58
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Quote:


send_skill(you.hp,0); // use send_all instead of 0 when executed on server




So everytime I send a var I have to do this?
Code:

ifdef server;
send_skill(you.hp, SEND_ALL);
ifelse;
send_skill(you.hp, 0);
endif;



With SEND_VEC I can send three skills at a time instead of each one individual even and they wont conflict because the skills are not meant as vectors?

BTW, I already have a handle array for each charater, I might use that if it remains the same on each client.

Page 2 of 2 1 2

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