multithreading!!

Posted by: zenon

multithreading!! - 07/31/02 09:19 AM

Ok, I'm going to ask all the REAL C++ programmers
out there to answer this.. and give me some good
advice.
I'm programming an arcade game, probotector style, with flashy lights, lots of ammo, and sh*t.
This blended in with the all-mighty invaders feeling with ships moving downwards and changing direction and so... Now..

I have been reading on multithreading. (I have Turbo C++ 5.02 ) And the help that I find there is not very satisfactory! I have been reading till my eyeballs started to bleed, but it doesn't make any sense!I mean, god!!!
Can annyone here give a light-easy to understand-explanation of how to:
Start a new thread - and linking or putting in or whatever it's called functions into it.
Stopping the tread.
The compilation is suposed to be speciall with some parameters.. that's no problem...

[Shit]
Posted by: SilentRage

Re: multithreading!! - 07/31/02 01:45 PM

Real C++ programmers huh? Well, how 'bout a fake C++ programmer giving you a heads up. Go to planetsourcecode.com and search for Base64. While looking around for example code in C for decoding/encoding Base64 algorithms, I found somebody had made a dll which supports both syncronus and asyncronus functions. I'm sure you know what that means and yes, it uses multithreading. I've looked through the code and found things quite interesting - and understandable enough.

*grumbles under his breath about what makes so-called 'real' C++ programmers...*

If ya was a little less cocky there, I would've looked for and got ya a direct link and/or learned the process real quick so that I could teach ya. It wouldn't be the first time. Consider yourself fortunate that I remembered that much off the top of my head to steer ya in the right direction. Like hell I'd go search for the answer for ya like I normally would.
Posted by: zenon

Re: multithreading!! - 07/31/02 11:07 PM

SilentRage, with 'real programmer', i'm refering to the guys that know what theyr'e talking about. Not the showoff boardgliders that oftenly get their nowses into discutions that they haven't got a clue about just to look cool. And I'm sure that you don't fit into THAT category =)

Thanx a lot for the 'directioning', if it doesn't work out i'll let ya know.
Posted by: SilentRage

Re: multithreading!! - 08/01/02 05:02 AM

well, if you said 'real programmer' I probably wouldn't have said anything cause I consider myself a real programmer (I place a lot of meaning to 'real programmers'). however, you said 'REAL C++ programmers' and I do not code in C++ at all. My hold on C is patchy at best - learning only what I need to learn to do a given project or answer a given question.

So I was a bit miffed that even though I wasn't a 'REAL C++ programmer' that you indicated that I couldn't be of any help to you at all.

But anyway, it was a moments irritation. I no longer care. You're coo'. And if you do still have issues, I'll learn it and give ya a detailed tut/example code on how to multi-thread.
Posted by: zenon

Re: multithreading!! - 08/02/02 09:25 AM

Well SilentRage, enlight me!
I'm sure that you will give me something better than the planetsourcecode. Honestly, I'm not good at reading other peep's code that doesn't have any good comments. I got lost in an example that I downloaded. I would really like you to show me some multithreading, not something complex. Just some basic, so that I can carry it on from there.
Example: a program that has 2 balls, ball no1's movement is calculated in one thread and ball no2's movement in another thread. =)
Thanx a lot [Thumb]
Posted by: zenon

Re: multithreading!! - 08/05/02 11:01 PM

Come on SilentRage, tell me...
Posted by: SilentRage

Re: multithreading!! - 08/06/02 05:49 AM

ah yes, thanks for reminding me. Last time I had searched for the example code that I had previous downloaded from planet source code and couldn't find it. Then I had given up and forgot to pursue other sources.

I found a tutorial by doing a google search:
http://www.flipcode.com/tutorials/tut_mthreading.shtml
http://www.flipcode.com/tutorials/tut_mthreading2.shtml

However, I was not entirely satisfied, and altered my search criteria at msdn.microsoft.com for "creating threads". Then i found a bundle of information which is what I myself would prefer to read if I wanted to make a multi-threading application. Here's the link that will take you through several pages of helpful information.

http://msdn.microsoft.com/library/en-us/dllproc/prothred_0t83.asp

Only after you've looked at all that and still can't get a grasp on what you need to do, will I take that information and round it out into a no-nonsense tutorial.
Posted by: zenon

Re: multithreading!! - 08/06/02 09:24 AM

Thanx man =)
If I would have chosen someone to be my
programming teacher, you would have been the
man,,, (if you are a man I really honestly don't
know).


[Thumb]
Posted by: Gremelin

Re: multithreading!! - 08/06/02 12:38 PM

BTW, sr, you're my hero :x...
Posted by: SilentRage

Re: multithreading!! - 08/06/02 01:12 PM

aw shucks. Such nice words.

Hey everybody, I found the secret to popularity. Learn how to search for info and give people links.
Posted by: zenon

Re: multithreading!! - 08/09/02 02:25 AM

Hmmm.. maybe I should refrace myself, yes I will
use the links you gave me when I get into
Visual C++, but now I wonder...

(the most classicall problem of all)
How do I do to make for example (in DOS) to
program the motion of the space ships in
"Invaders", and still be able to have the user
moving the spaceship at the same time?

Something like multithreading, but for DOS.
How?
Thanks...
Posted by: SilentRage

Re: multithreading!! - 08/09/02 05:37 AM

Er, I'm a windows programmer so I won't be much help here except in programming concepts. Your ship is controlled by a loop. Each iteration of the loop you move the ship another increment. You also check for keyboard input with each loop. If there's no keyboard input, move the ship in it's present course. If there is, then process the input THEN move the ship based upon it. If you want to see programming technique involving a constantly moving 'something' and keyboard input - then I suggest reading the QBasic code for Snakes. It would help bunches if you had QBasic and could step through the code. You wouldn't have to learn QBasic to see what things do.

I don't know if you can do "true" multithreading in DOS programming, but for sure you can divide your code's attention between many functions.
Posted by: zenon

Re: multithreading!! - 08/09/02 12:52 PM

For example.
How did they do Duke Numed 1, I mean, that's
for sure some DOS game.
How did they get the enviorment to function,
independently from the player?
Posted by: SilentRage

Re: multithreading!! - 08/10/02 04:26 AM

I have absolutely no idea. I suggest getting the Quake code, it's free for the public ya know. It runs under DOS I think.

For all I know, it's one helleva big loop. lol
Posted by: zenon

Re: multithreading!! - 08/10/02 12:19 PM

Was that suposed to be a joke or something?
[Sheep]
Posted by: SilentRage

Re: multithreading!! - 08/10/02 04:43 PM

well, no, I wasn't joking. But it would be hell trying to know what to do with quake's source - so I guess that isn't much help.
Posted by: Tantalus

Re: multithreading!! - 09/16/02 03:13 PM

Does Quake 1 use the opengl api? If it does, ogl would take care of everything.... But i guess being the first 3d game it didn't...

But at any rate you can use opengl for your game and it will take care of all of your problems... If there is a dos api... sorry ive only used it with win, never looked into a dos version. Maybe there is a port (from win to dos for opengl) on sourceforge....