0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
sorry one more multiply player question
#349809
12/11/10 10:19
12/11/10 10:19
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=349605#Post349605hey jcl sorry for annoying you with yet another multiplayer related question. i cant get sendskillto/id to work. thought might have had a problem else where in my code so i made a stand alone simple app but just can find the problem plz help.
Last edited by PrenceOfDarkness; 12/11/10 13:34.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
Re: sorry one more multiply player question
[Re: PrenceOfDarkness]
#350010
12/13/10 09:18
12/13/10 09:18
|
Joined: Jul 2000
Posts: 27,986 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,986
Frankfurt
|
Your idea is basically correct: When your script does not work as it should, strip it down to simplicity and then try to find the problem. However the script you posted is not simple, it has many waits, complicated skill conditions or lines that apparently make no sense. Lite-C is robust and runs also bad scripts, but too many bug possibilities make such a script useless for testing.
send_skill_to works when I try it, although of course it's possible that it has a bug that appears only under certain conditions. But for the next steps I suggest the following:
- First work through some lessons of the lite-C tutorial for learning better scripting - especially the debugging lessons and the two last lessons. You're an old timer on the forum, but I see from your code that you're not yet 100% settled in script writing. Multiplayer requires the ability to write clean code, and to know what to do when something does not work.
- Next, use the multiplayer tutorial for your test script. Run it with 2 clients. First just send a skill from the server to one of the clients, but not to the other. Use send_skill_to for this, giving the entity pointer. Check if this works.
- Then, send back a skill from one of the clients to the server, and use a receive event on the server to send it to the other client. Check also if this works.
If you encounter a problem, please post again and we'll help.
|
|
|
Re: sorry one more multiply player question
[Re: jcl]
#350056
12/13/10 15:00
12/13/10 15:00
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
Hey JCL! I followed your advice, and I must agree the sloppy code I posted made me look like an ammature. So I followed all of your advice to a T. I used the multiplayer tutorial as a guide and you were 100% correct send_skill_to DID work. I expected this because in my game I have used send_skill_to before and it has worked. However what I'm trying to do now needs to be done with send_skill_id. I've updated my post and made everything crystal clear. I am suspecting that send_skill_id is bugged. The code I included this time is very clear and commented very well. Please let me know if anything is unclear. (btw I did some further testing. send_skill_id is returning 1 which means it is sending the information out. However the entity's receive flag is never triggered on the client, and yes I did set the flag.) Also I did learn a bit in the debug tutorial. But I still can't get debug to work with multiplayer games. I run the current script with -sv -cl set and the I debug run only with -cl and the client hangs forever. I'm less concerned with this because I've been getting by pretty well debugging it with panels so I'd rather focus more on the send_skill_id. Maybe you could try it yourself but I can't imagine how you would write the code any different the what I did in my new post. I've honestly searched every where for a working example of send_skill_id but I couldn't find a single one. I've searched over the last two years in the search and just some annoying prenceofdarkness guy keeps showing up with the same stupid problem.
Last edited by PrenceOfDarkness; 12/13/10 15:15.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
Re: sorry one more multiply player question
[Re: jcl]
#350062
12/13/10 15:19
12/13/10 15:19
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
This bug is in A7 as well and I believe it has been for months or years. Can you please release just this one change to the A7 user community? Originally I bought A7 pro just for these functions.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
Re: sorry one more multiply player question
[Re: jcl]
#350071
12/13/10 15:38
12/13/10 15:38
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
Thank you for the alternative (you just saved me hours trying to come up with a work around). However I will be honest, send_skill_id was a feature in A7 and not really a new feature (I wish the bug would have been found sooner so it would of been fixed) I just want what I payed for nothing more or less. An A7 user indeed found the bug (an old bug that should of been fixed). I'm just asking if it's not to much trouble that when you guys do fix it if it can be released to everyone. In the end your the boss and I don't have any real say of course. Regardless of your final decision JCL, I do want to thank you for your time and I hope you continue to accept questions via "Ask the Developers"... no matter how annoying we might get . On a bit off topic note.. If A8 ever has any advantages over A7 multiplayer you can be sure I'll be the first to upgrade to pro A8.
Last edited by PrenceOfDarkness; 12/13/10 15:42.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
Re: sorry one more multiply player question
[Re: PrenceOfDarkness]
#350076
12/13/10 15:52
12/13/10 15:52
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
btw I change my code to include the function you wrote and it didn't work.
ENTITY* item; //a pointer not called player to eliminate confusion
var itemSkill1;//a global variable for the item's skill1 so that the engine doesnt return a "IDK what item.skill1 is" error
var itemClient_id;//this is the items's client_id of the item's maker. This should be zero because the SERVER made this entity
var vClientid; //a variable to indicate the client_id of a client that has just joined
PANEL* testPNL = {
flags = SHOW;
digits(0,0,"item.skill1: %.3f",*,1,itemSkill1);
digits(0,10,"dplay_id: %.3f",*,1,dplay_id);
digits(0,20,"item.client_id: %.3f",*,1,itemClient_id);
digits(0,30,"vClientid: %.3f",*,1,vClientid);
}
function send_skill_id2(var id, var* skill, var mode)
{
for (you = ent_next(NULL); you; you = ent_next(you)) {
if(you.client_id == id) {
send_skill_to(you,skill,mode);
break;
}
}
}
function on_server_event(void* str,var id) // automatically assigned to on_server
{
if(event_type == EVENT_JOIN) //if a client joined
{
vClientid = id; //store the ID of the client that just joined into a global variable
}
}
void fItem()
{
while(my.client_id < 0) wait(1); //this item is created on the server there for client_id will be zero but I'll include it anyway
item = my; //this is an item
if(connection & CONNECT_SERVER) //in my game the server would assign the item an ID number so i'll do the same here for skill1
{
my.skill1 = 1000;
}
else //if we're not a server we're a client
{
while(my.skill1 != 1000) //wait until our skill1 because the value we know it should be. In this case 1000
{
itemSkill1 = my.skill1; //since we're locked in this loop forever because send_skill_id isn't working I want
itemClient_id = my.client_id;//to update our client_id and skill1 values.
wait(1);
}
}
while(1)
{
wait(1);
itemSkill1 = my.skill1; //this only works on the server because the client never makes it to this point
itemClient_id = my.client_id; //because it's skill1 never changes from zero
if(connection & CONNECT_SERVER)
{
send_skill_id2(vClientid,my.skill1,0); //the server sends the vClientid FOREVER but the client never seems to receive it
} //regardless of the fact that the client's dplay_id is equal to vClient_id which
else //is the where the server is sending information to.
{
if(my.skill1 != 0) //if the client would ever make it to this point the problem is solved and we break out of the while loop
{
break;
}
}
}
beep(); //two beeps indicate success!!
beep();
}
on_server = on_server_event; //if a client joins two parameters are passed: the player's name and the client identification number
//this is all in the manual if you look up on_server.
void main()
{
if (!connection) { // not started with -cl / -sv -cl?
if (!session_connect(app_name,"")) // no client found on the localhost?
session_open(app_name); // start as server
}
do{wait(1);}
while(dplay_status < 2); // wait until the session is opened or joined
dplay_localfunction = 2; //run actions on both server and client
level_load("valiance.wmb"); // load the level
if(connection & CONNECT_SERVER) //are we a server?
{
ent_create("testing.mdl",vector(100,0,0),fItem); //OMG a monster was killed!!! Drop an item ont he server!
}
}
Last edited by PrenceOfDarkness; 12/13/10 15:53.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
Re: sorry one more multiply player question
[Re: 3run]
#350079
12/13/10 15:59
12/13/10 15:59
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
I think JCL will fix this. I mean how hard could it be. The work is already going to be done. And we're not asking for new features. I think A6 was pretty complete. Now that they're aware of the issues I can't imagine why not fix them.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
|