[MUD-Dev] CORBA, RMI, threads
Caliban Tiresias Darklock
caliban at darklock.com
Sat Jan 24 22:32:26 New Zealand Daylight Time 1998
Vadim Tkachenko wrote:
> Marc Eyrignoux wrote:
> > In fact, I intend to make the monsters act every 15 seconds. A thread
> > that would sleep for 15
> > seconds and acts according to the situation at the moment it wakes up
> > seems to be a good way
> > for doing this.
> Once again, why 15? Why not 14 or 16?
12 | (<unique object reference number> & 3) would work. Give the appearance of
randomness and 1-second resolution, without bogging the CPU by using all the
threads at once. Using appropriate bit shifting and arbitrary fragments of
statistics and whatnot, you can do a really fast calculation that would change
over time and keep things separated a good deal. Sure, you might end up with a
pathological case, but that would be rare and it wouldn't be any worse than
scheduling all the threads at once.
There are, of course, much more efficient methods that could be pulled up by
people who are much more experienced in this sort of programming than I am.
Hell, I'm from a single-process single-task world, and I'm only just getting out
of this crap where all I get to do is run networks... now that I'm back to
writing code again, I should get a good background in this stuff over the next
couple of months.
=+[caliban at darklock.com]=+=+=+=+=+=+=+=+=+=+=[http://www.darklock.com/]+=
"It must be remembered that there is nothing more difficult to plan, more
doubtful of success, nor more dangerous to manage than the creation of a
new system. For the initiator has the enmity of all who would profit by
the preservation of the old institution, and merely lukewarm defenders in
those who would gain by the new one." -- Machiavelli
=+=+=+[We are the music makers and we are the dreamers of dreams]+=+=+=+=
More information about the MUD-Dev