944,072 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 5782
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
May 19th, 2007
0

How to multitask?

Expand Post »
This may come off as a rather broad question, but I need to learn how to multitask in c++.
I am developing a game, and to do so I need to learn how to program applications to run in realtime.
(I want multiple characters to do things at the same time, rather than having a turn based game as I currently have.)
For those of you who may 'know' me, I have progressed quite a large amount in the last few weeks so I will have a reasonably larger grasp on what you have to say... By this I mean I won't sit there like "what, huh... I wish you guys could explain things good" (I said that about ancient dragon once over such a simple subject as RECTs)
Well thanks for any help, and P.S. - I use Bloodshed (gcc compiler) NOT visual c++, therefore I would appreciate any code to be compatible with bloodshed.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
Brent.tc is offline Offline
90 posts
since Oct 2006
May 19th, 2007
0

Re: How to multitask?

I've been sent here by the gods of compilers with this message.

http://msdn.microsoft.com/vstudio/express/downloads/

You will now "fit in" with the rest.

But in all honesty, I really can't say enough about the 2005 express editions of visual studio. They truly are amazing. And not only that, but it's as close to the real world as you'll ever get with home development.

Now onto your question:

Game programming consists of 3 core functions (how people actually write the game differs, but in reality, these 3 steps are taken in every game).

1. Initialization.
2. Update.
3. Shutdown.

Pretty self explanatory. What you're looking for is going to be in step #2, the Update methods of the game. In here you'll have the game update objects on the screen/collision/physics/death/movement etc...

For more specific examples, you'd of course need some more specific questions, but this is what i figured you'd be looking for with that broad of a question, so hope it helps.
Reputation Points: 11
Solved Threads: 17
Junior Poster
mariocatch is offline Offline
103 posts
since Apr 2007
May 20th, 2007
0

Re: How to multitask?

>> need to learn how to multitask in c++.

Its called multi-threading. Here are more information.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,957 posts
since Aug 2005
May 20th, 2007
0

Re: How to multitask?

he's not talking about threading im sure. as he wants to know how to update objects on the screen at the same time, which would be updating a game, not threading, so refer to my previous post Brent.tc
Reputation Points: 11
Solved Threads: 17
Junior Poster
mariocatch is offline Offline
103 posts
since Apr 2007
May 20th, 2007
0

Re: How to multitask?

> he's not talking about threading im sure.
For a small scale project, yes, but for real games, multi threading is what he is looking for. Games almost always make use of multi threading.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
May 20th, 2007
0

Re: How to multitask?

he wants to know how to update objects on a screen... lets not complicate him with things such as multi threading.
Reputation Points: 11
Solved Threads: 17
Junior Poster
mariocatch is offline Offline
103 posts
since Apr 2007
May 21st, 2007
0

Re: How to multitask?

I've only made graphical games on GBA, but the principals are probably the same.
In your main gane loop, you'll have one (or more) function(s) that update a character's or whatever's position, and then once all of those functions have been run through, you update the screen.
Reputation Points: 17
Solved Threads: 3
Newbie Poster
fatnickc is offline Offline
15 posts
since May 2007
May 21st, 2007
0

Re: How to multitask?

Click to Expand / Collapse  Quote originally posted by mariocatch ...
he wants to know how to update objects on a screen... lets not complicate him with things such as multi threading.
I agree with this poster.
Suggesting multi-threading to a beginner programmer is like giving a gun to a 3 year old. And since we're talking C++ here you can be damn sure he'd reuse the bullets!

What needs to be conveyed to the original poster is what design patterns can be used to achieve the desired effect.
Last edited by iMalc; May 21st, 2007 at 6:01 am.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
iMalc is offline Offline
6 posts
since Apr 2007
May 21st, 2007
0

Re: How to multitask?

Click to Expand / Collapse  Quote originally posted by iMalc ...
I agree with this poster.
Suggesting multi-threading to a beginner programmer is like giving a gun to a 3 year old. And since we're talking C++ here you can be damn sure he'd reuse the bullets!

What needs to be conveyed to the original poster is what design patterns can be used to achieve the desired effect.
Don't shoot the messenger! Brent asked about multi-threading, so I pointed him in that direction. I won't pretend to know his skills or read his mind.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,957 posts
since Aug 2005
May 22nd, 2007
0

Re: How to multitask?

I agree with Ancient Dragon as well as the rest. Yes, I am quite the beginner, but I am eager to learn, so thanks all. Oh and mariocatch, if you honestly think I have not looked into vc++ and the other microsoft products you are wrong... I actually have a copy of the Visual C++ ISO, but i have been using Bloodshed since I started, and with bloodshed I am capable of compiling (Even if compilation with VC++ is possible, I will continue to use Bloodshed)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
So, multitasking is a more simple concept of multithreading? or are they completely different?
I will look into the links in your posts (perhaps something I should have done already) and get back to you.

Ohh, by the way, next year I will be in highschool which will allow me to take classes in this order where G = grade and S = semester and C = classname (G-S C)
10-1 Visual basic
10 - 2 C++
11 - 1 Java
11 - 2 Web Development (php and whatnot)
12 - 1 Advanced (I assume C# and perhaps ASM)
12 - 1 (Same as 12 - 2)
*-*-*-*-*-*-*-*-*-*-*-*
I assume that microsofts products will be used in school so I'll "fit in" soon enough.
Last edited by Brent.tc; May 22nd, 2007 at 7:55 pm. Reason: It looked funny :)
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
Brent.tc is offline Offline
90 posts
since Oct 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: last homework :) assign structure???
Next Thread in C++ Forum Timeline: cant paint in mFC





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC