ID:138356
 
1. I have no experience of the multiplayer issues for BYOND and I was wondering how the variables src and usr work in that environment, for example if you had 200 players in your world, it seems to me that you are fairly quickly going to get the situation where 2 different procs are going to be executing at the same time - will the src become mixed up - particularly if both procs call another proc that uses src (e.g. two combat procs call a general purpose proc at the same time). Just a thought.

2. I'm still having a go at this generic code thing. I've taken what may seem an odd approach of coding procs into objects for the use of that object e.g. all my objects have pickedup(), dropped(), wielded() ... a total of about 8 procs per object (although some are for entire classes of object). I've done it like this because it makes it very easy to integrate objects into the world from other generic worlds. When you bump someone I do something like:
strikingmob.held:attack(striker,victim)
as all my objects have a proc called attack that expects striker and victim the control of the attack is contained within the object. I'm worried - this makes my objects large relative to what I consider normal BYOND objects - are there going to be serious performance problems (I mean mainly net traffic as opposed to cpu).
1. I have no experience of the multiplayer issues for BYOND and I was wondering how the variables src and usr work in that environment, for example if you had 200 players in your world, it seems to me that you are fairly quickly going to get the situation where 2 different procs are going to be executing at the same time - will the src become mixed up - particularly if both procs call another proc that uses src (e.g. two combat procs call a general purpose proc at the same time). Just a thought.

This shouldn't be a problem, because although the sleep() and spawn() commands might suggest that threads are being created, in reality the whole program executes sequentially-- i.e., two procs will *never* execute at exactly the same time (though you can, of course, call a proc from another proc). Behind the scenes, there's some kind of queue manager that keeps track of all the procs waiting around to be executed.


2. I'm still having a go at this generic code thing.

Hmm, it's too early in the morning... maybe I'll have a response later!
In response to Guy T.
On 10/10/00 7:08 am Guy T. wrote:
1. I have no experience of the multiplayer issues for BYOND and I was wondering how the variables src and usr work in that environment, for example if you had 200 players in your world, it seems to me that you are fairly quickly going to get the situation where 2 different procs are going to be executing at the same time - will the src become mixed up - particularly if both procs call another proc that uses src (e.g. two combat procs call a general purpose proc at the same time). Just a thought.

This shouldn't be a problem, because although the sleep() and spawn() commands might suggest that threads are being created, in reality the whole program executes sequentially-- i.e., two procs will *never* execute at exactly the same time (though you can, of course, call a proc from another proc). Behind the scenes, there's some kind of queue manager that keeps track of all the procs waiting around to be executed.


Guy is right -- in almost all cases, multi-player will "just work". BYOND has to be the only system I've ever seen where you have to do extra work not to have a networked multi-player game!

There is ONE consideration I have run into, and that is with usr. In a single-player environment, usr will pretty much always work as expected. But with multiple players, sometimes if you spawn some code for later execution, and that code contains references to usr, you might get unexpected results.

So in general I would not use usr except in cases where it's unavoidable or absolute -- such as in a verb where you haven't used spawn or sleep.