EVENT_RECEIVE help

Posted By: ATOMIX

EVENT_RECEIVE help - 09/26/08 14:53

I have been able to trap the EVENT_RECEIVE event_type on the dedicated server (connection = 1). My question is:
Code:
if (event_type == EVENT_RECEIVE)
{
   // What does it receive????
}

Anybody know how to read what it receives?
Appreciate any help.
Posted By: Locoweed

Re: EVENT_RECEIVE help - 09/27/08 19:07

This event is triggered when the entity receives a skill sent by send_skill.

Code:
...
// on server/host
pEnt.HideMe = 1;
// send skill to client that created this ent and make invisible there only
send_skill(pEnt.HideMe,0); 
pEnt.HideMe = 0;
...

function receive_event()
{
  if (event_type == EVENT_RECEIVE)
 	{
            // hide me ?
            if(my.HideMe == 1)
            {
                my.HideMe = 0;
                set(my,INVISIBLE);
            }
            if(my.MakeMeGlow == 1)
            {
                my.MakeMeGlow = 0;
                Glow(my);
            }
 	}
} 

function LocalAction()
{
  // set local events
  my.ENABLE_RECEIVE = ON; // sensible for this event
  my.emask |= ENABLE_RECEIVE;
  my.event = receive_event;
}

action actPlayer()
{
  proc_client(my,LocalAction);  // set events to happen on client

  ...
  // Host action
  my.ENABLE_RECEIVE = ON; // sensible for this event
  my.emask |= ENABLE_RECEIVE;
  my.event = receive_event;
  ...
} 	


It doesn't really receive anything, it just lets you know that this entity just received a skill update by the send_skill() command. You will have to figure out which skill was sent like above. I am sure it might have it's uses, but I can't think of many. Maybe useful for sending a skill to only one client and starting a local effect on that client only through EVENT instead of a while(1)-wait(1) loop on the client, something like that, but not very useful really that I can see.

Loco
Posted By: ATOMIX

Re: EVENT_RECEIVE help - 09/29/08 16:44

@Locoweed: you are awesome! Love your logo! Great to hear from you. I have been using your multi-player code as the base for my online world. I will admit I have had some problems. Not with your code, but with trying to get some speed out of it. I am running on a fiber optic network in Eugene, Oregon at 21,941K down and 2,375K up with a static ip. Your Multi-Player code should be screaming, but it just creeps along. The latency is low at about 25, BPS is reasonable at around 250 - 300. So I have been trying to trap the variables/skills sent to the dedicated server and this event seemed to be the only way to trap them. Then I can use diag_var() to log what's happening. I tried doing that in your code at the function player_events() but when I tried to log the skills that were received I crashed. Arrrrgggg..... Probably because I don't really know what I am doing yet. I am just muddling along. This is a strange networking system, not what I am used to working with. This networking system doesn't seem to have been planned very well. Logging what a dedicated server is sending and receiving should be very simple. Adding a Master server to manage multiple dedicated servers (each running a different level) should also be very simple.
Another problem I have had is when the client disconnects everything seems to work fine but when you reconnect it really slows done to almost nothing. It's like the server never gets rid of the clients info.
Do you think the networking system in 3DGS needs to be replaced with another system like RakNet ($100.00 per title) or ENet (which is free)? I ask this because I will do it now rather than wait and have to recode later.
I have been meaning to communicate with you and ask how your project is going and is it multi-player? What kind of problems have you been having, if any?
By the way I have Pro 7.50 in case you wondered.
I greatly appreciate any input you have.
Posted By: Locoweed

Re: EVENT_RECEIVE help - 10/01/08 18:57

I would probably use RakNet.

Loco
© 2024 lite-C Forums