Computer Science Canada

Question of Procedure

Author:  GreenTiger [ Fri May 14, 2004 7:03 pm ]
Post subject:  Question of Procedure

Before I proceed in my programming, it would be good to know something, ie, what should my procedure of proceeding be, before I proceed?

What happens two differant proccesses call the same procedure? IE: what if I have a control process to catch all user inputs and a AI process to take care of AI commands. The controller sends commands to the person linked to the player, and the AI sens commands to the person linked to it. But then these persons call on the Isometric manager for math and positioning and stuff. Is there a danger that one will mess up the values for the other? I mean, if the processes are in the same proc at the same time, will they share the variables local to that proc or will they keep a hold on the proc's local variables so that you have two distinct pieces.

IE:
Two Processes, Controller and AI.
Controller moves his Player person, AI moves Baddie person
2 Differant Persons Classes Move...this sends it to the isometric module.

proc IsoDraw (stuffs : int)
var localvariables : int := stuffs
%Do funky stuff with localvariables, compare against stuffs and draw.
end IsoDraw

So will there be two differant "localvaribles" vars, one for each process, or will it get all forked up?

Author:  omni [ Fri May 14, 2004 7:40 pm ]
Post subject: 

well you shouldn't have your player input as processes.
but wow your question is hard...

Author:  GreenTiger [ Fri May 14, 2004 8:16 pm ]
Post subject: 

Not have input as proccess? How should I do animations then? How do enemies act in the background? Egads, how could you have it NOT be a proceess?

Author:  Tony [ Fri May 14, 2004 9:42 pm ]
Post subject: 

if you're using two+ processes, they will for sure screw over any common variables. But you shouldn't be using processes in the first place - there's no need for them.

Author:  Catalyst [ Fri May 14, 2004 10:56 pm ]
Post subject: 

tony absolutely right theres no need to use processes (in nearly every case)

but, to answer your question, no the local variables are separate as (based on a quick test i did) each function (or proc) receives it own local stack of memory


: