Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Question of Procedure
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GreenTiger




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
omni




PostPosted: Fri May 14, 2004 7:40 pm   Post subject: (No subject)

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




PostPosted: Fri May 14, 2004 8:16 pm   Post subject: (No 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?
Tony




PostPosted: Fri May 14, 2004 9:42 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Catalyst




PostPosted: Fri May 14, 2004 10:56 pm   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: