ID:107414
 
Keywords: fun, game, programming, work, yay
Posted here: http://www.byond.com/developer/forum/?id=772705

Haven't been using DM for a while so i'm a bit unfamiliar.

If I have a world/proc. When I call that procedure multiple times, is it ran simultaneously? or does it stack and run sequentially?

If it does run simultaneously is there any way to make it run sequentially? The system i'm working on has to do with accessing items quickly but if the same item gets accessed by two separate mobs bugs are bound to occur.
Simultaneously.
To make it run sequentially you'd have to write/use some sort of event handler.
*sigh* That does throw a wrench in things...
Without knowing what you're trying to do here, it's a bit hard to help.
Couldn't you just check if the world proc is running before calling it again?
It's a object recycle system.

Instead of abusing new() and del() objects for things like attacks which there will be more than plenty of in BR and DBOII i'll only use new() when all other attack objects are being used and otherwise recycle them.
Why does it take more than 1 tick?
Huh? No, but i'm pretty sure that when people are using techniques their procedures will try to manipulate the same object since they have been accessed simultaneously...
I really have no idea what your world proc is doing, and I'm definitely unsure of whether you will see any gain (or even loss) of performance when using such a system.
Couldn't your proc just return an object from a list of unused ones? It would then immediately remove it from the list, and no further calls to the proc, even on the same tick, would accidentally return the same projectile until it is re-added to the list.
Is that how you're doing it?
Basically, you'll be fine. Providing your proc doesn't sleep, they'll be stacked and computed sequentially.
DM isn't multithreaded, so as long as you don't sleep() or spawn() you shouldn't have to worry about 'race conditions'. I don't think Murrawhip knows what he's talking about.
Vermolius wrote:
DM isn't multithreaded, so as long as you don't sleep() or spawn() you shouldn't have to worry about 'race conditions'. I don't think Murrawhip knows what he's talking about.

Murrawhip wrote:
Basically, you'll be fine. Providing your proc doesn't sleep, they'll be stacked and computed sequentially.
Alright, thanks i'll probably post again if I run into any issues.
@Murrawhip, ahh, yeah I didn't read what you wrote after you said simultaneously. I just made the assumption you thought you knew what you were talking about, but were wrong.
Wow... If it's as followed it would run in sequence...

mob/verb/RunWhatever()
world.Whatever()
world.Whatever()

in order to make two things run at once you need some sort of spawn. such as...

mob/verb/RunWhatever()
spawn(){world.Whatever()}
world.Whatever()

Note, using spawn breaks off and continues on it's own and pretty much is no longer effected by the current(verb) in this case. So if the first proc is supposed to do something to the second proc such as change a variable or whatever you MIGHT want to add a delay. You could always run a quick test incase I'm wrong.