2 registered members (AndrewAMD, ozgur),
1,421
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Server > Unique Client - [Help]
[Re: indiGLOW]
#222746
08/20/08 20:27
08/20/08 20:27
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
The server sets client id in the player function that was given on the client when he ent_created the entity on the server... After the server sets this client id , he sends it to all clients just before he sets my.nosend on. Later , you go thru the list of clients , check if this ID is the same as the current entity on the list...If it is , send_var_to I never used send string instructions btw :P What I didnt mention was , on the client , when a client receives a var , event_var is activated in the client event function (or was it another event name? I forgot already ) If event var has been received , and the updating arrays first var is empty , calls a function that manages the updating array and distributes it to the entitys skills. After that it sets the updating array to 0. This will enshure , that , if you send another var , the updating vars Client ID is 0 , so , no updating will occur. You've got it right , I just wanned to explain it better to avoid confusion fastlane , I tought you used a plugin :P ?
|
|
|
Re: Server > Unique Client - [Help]
[Re: EpsiloN]
#222756
08/20/08 21:32
08/20/08 21:32
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Ok so during the server join event, I find an available player slot and broadcast a message to every client. The string has a command code, and clients without an assigned ID get this number and assign it their client entity they created on the server. the server should then be able to scan through all entities until it finds one with a matching ID and then send a message to that client through this entity. Here's the final snippet, maybe there is something wrong here?
// Find new Client entity
you = ent_next(null);
while(you!=null){
if(you._client)&&(you.player == tempID){me=you;}
you = ent_next(you);
}
SEND_STRING_TO(me, "Registered");
Currently the string "Registered" does not show up on the client. Any pointers? Also I have noticed that some of my broadcast strings are not showing up complete on the clients. I send "Registered" but the clients display "Reg" any suggestions? Thanks guys
The Art of Conversation is dead : Discuss
|
|
|
Re: Server > Unique Client - [Help]
[Re: indiGLOW]
#222781
08/20/08 23:58
08/20/08 23:58
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
i'm reading this thinking that the ways i did it in A6 was really cr&p, now it seems everyone does it this way... what i did was to create a login screen, then the client would click login after inputing his name and password and session_connect... this then sent a message to the server including the player_name (clients username), and password and then checked with the details the server held, if all was ok at this point, the server would send back a message to all clients, but specifying it was for this certain client, so all other clients would ignore it... the recipient would update it's player_name with this requested username and giving it a unique ID, any forthcoming messages would then reference this player_name so there is no chance of duplicaiton of username, and all updates would be done like this... unfortunately using this method all clients have to receive the string to realise if it's intended for them or not, and then act accordingly this did have it's advantages however... if i was sending a string to a guild_name everyone in that guild would receive the string and act accordingly, and similarly to a team, raid or a private message. as long as i put enough information in that string for the client to determine what to do with it hopefully this isn't the way everyone is thinking of doing things, but atm the way i'm reading it, it seems to be the only possible answer...
|
|
|
Re: Server > Unique Client - [Help]
[Re: indiGLOW]
#222832
08/21/08 03:42
08/21/08 03:42
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
When an event join is trigerred , you still dont have an entity for that client...maby thats the problem You should set that ID number in the player function , so that you know for shure it is attached to a skill of your player entity. As for the strings , you need a pointer , I think.
str_cpy(send_str,"Registered");
send_string_to(me,send_str);
|
|
|
Re: Server > Unique Client - [Help]
[Re: EpsiloN]
#223239
08/22/08 20:19
08/22/08 20:19
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
I was pretty sure the server would not have a pointer assigned to the new client during the join event. I think this is exactly why the SEND_STRING_TO required an entity created by the client.
I also believe my script allows the client to join, get assigned a unique ID, create an entity on the server and set it's skill to the ID given out by the server.
I think there is a possibility I am going wrong here; maybe my entity skills are out of synch because I am getting the server to search for this new client during the join event itself? regardless of sleep(2)?
I have created a 2 second delay during the join_event, to allow the client to get the ID, spawn the entity and assign the skill. After the 2 seconds the server searches for an entity matching the ID and then sends a string to it directly.
Could it be the client created entity is not updated it's skill on the server?
I will look into this over the weekend. It would be fantastic if someone could give me a code snippet that demonstrates this. I keep thinking its the SEND_STRING_TO function itself, or maybe my A6.6 pro is acting up
As for the string issue, I have checked my code and I am passing the string through a function with a (_string) handler, and while I did have a few direct "" strings, it seems to be missing characters for all ways of sending.
I am going to have a crack at your example code.
The Art of Conversation is dead : Discuss
|
|
|
Re: Server > Unique Client - [Help]
[Re: indiGLOW]
#223833
08/26/08 21:16
08/26/08 21:16
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Time for an update: Let me first tell you / show you where I am at: In the above image you can see I have managed to get a client/host running, (larger image right)and 2 seperate clients (2 smaller images left), with each client and the server creating their own unique eyeball. Each eyeball is following the server or clients own dev-cam, so gives a realtime representation of where they are in the world, and where they are looking. All this is pretty cool. I've even got it running over the internet and performance is good. However. It's all achieved on a wing and a prayer. - When clients disconnect the server has no clue who it was and so the clients entity stays resident.
- when running over internet, server crashes when more than 1 client joins
- I am still getting my head around where and when these functions are running
- loads of un-needed stuff is being sent all the time
- I am still not convinced I am getting unique pointers to clients, or am able to send exclusive strings
The quest into MP continues. - I've already been dealt a bombshell about encryption and A6, so I had to find something positive Any help on the above listed items is welcome - TIA
The Art of Conversation is dead : Discuss
|
|
|
Re: Server > Unique Client - [Help]
[Re: indiGLOW]
#223889
08/27/08 03:42
08/27/08 03:42
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
Theres an event for disconnection , I'm not shure it was event_disconnect exactly look the manual. With the event , you dont need to know wich client disconnected. About the other problems , I'd suggest you start again. I've written my MMO scripts over 15 times and the last one looks clean and works good and I know how to make it again in less than a day...
|
|
|
Re: Server > Unique Client - [Help]
[Re: EpsiloN]
#223907
08/27/08 16:31
08/27/08 16:31
|
Joined: Mar 2003
Posts: 5,377 USofA
fastlane69
Senior Expert
|
Senior Expert
Joined: Mar 2003
Posts: 5,377
USofA
|
fastlane , I tought you used a plugin :P ? Nope. The only plugins we use are 1) a MySql plugin and 2) a number converter so we can store Vars accurate to .001 into MySql. Out client update routine is much like you described. We assign each client a unique id from a master table and we transmit that ID to all clients. Then, whenever a message is sent (by string), this unique ID helps to identify which client the message is for. We use this technique to help us only move the clients we want... so that if Clients b-d are moving close to Client A but not close to Clients e-z, then we send a string with the instructions and unique id's for clients a-d and thus only people near you move. No plugin needed for this, though a horrible pain to design and test to work.... which is why this is still tops on my list of "things the engine should do" since our system is nothing more than a bunch of lookup tables that we constantly have to reference.
|
|
|
Re: Server > Unique Client - [Help]
[Re: indiGLOW]
#223908
08/27/08 16:41
08/27/08 16:41
|
Joined: Mar 2003
Posts: 5,377 USofA
fastlane69
Senior Expert
|
Senior Expert
Joined: Mar 2003
Posts: 5,377
USofA
|
However. It's all achieved on a wing and a prayer.
* When clients disconnect the server has no clue who it was and so the clients entity stays resident.
When you event_disconnect is called, before you run ent_remove, reference the skill upon which you have the client_ID and then use that to remove all client_ID's from everywhere. * when running over internet, server crashes when more than 1 client joins
That is not normal. Your login routine is not stable yet. You are likely over-righting on the wrong array or net index when coming in causing the server to crash. You should be able to debug this with proficient use of the Diag() command and acklog_sv.txt file. * I am still getting my head around where and when these functions are running
That's a good thing to get your head around, especially with MMOG. I recommend (if you haven't already) you look into UML diagramming and start diagramming your code. Trust me, it will seem like a waste of time at first, but in time, as the code grows and dependencies develop, it will be an invaluable tool in putting it all together. * loads of un-needed stuff is being sent all the time
Again, with UML you can map out your network traffic. Make sure you are using the Dplay_ function to set your server and client clocks. As well, pay attention to the nosends (I like to do nosend_all myself). Finally, get a Packet Sniffer to read through the packets you are sending. This will help identify what is being put on the net and this will help you find where it's coming from. * I am still not convinced I am getting unique pointers to clients, or am able to send exclusive strings
Let's not use the word "pointer" here shall we since it already has meaning in the engine. Instead, stick to "unique ID". I'm surprised you are unable to send exclusive strings. This is something that A6 and A7 can do quite effortless. However, combining a unique client ID with sending strings can be confusing. In our case, we have a lookup table that converts our unique IDs into GS Handles. This way, whenever it comes time to put something on the network, we take the lookup the handle for a unique ID, use handle_to_pointer to get the pointer, and then use the pointer to send on. Convoluted but aside from the extra conversion step, quite easy.
|
|
|
|