Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / DarkBasic Multi Threaded, etc.?

Author
Message
cmate
21
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 17th Jul 2003 01:42
Im looking into DarkBasic Pro, and was wondering - does it multi task/multi thread?

Like how do you handle several things happening at the same time - say a thread to do AI, a thread to do screen updates, a thread to do data loading/saving, or whatever...?

Im just trying to get an overview before I decide to purchase this thing...
Carlitos
21
Years of Service
User Offline
Joined: 8th Jul 2003
Location: United States
Posted: 17th Jul 2003 01:49
Welcome to the Forums cmate!!

well, I really don't know what a thread is other than this section of the forum where in.

However, I think your talking about the use of functions. Yes functions are a big part of orgnizing a program. The code for it is
FUNCTION functionname(parameters)
...
ENDFUNCTION

With that code you can load up other functions from other programs entirely so you wont have to duplicate a function. Most useful indeed. If you have any other questions, just post.

--carlitos
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 17th Jul 2003 01:53
also, you can #include functions from other .dba's

---Mattman
DID YOU KNOW THAT ???
cmate
21
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 17th Jul 2003 03:14
Thanks. But what I mean by threads for example, is the ability to have TWO functions running at the same time.

So one function might sit there looping and might process data while another function does something else. Each function goes to sleep every so often - thats how they 'share' time.

Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 17th Jul 2003 03:17
its called gosub and return being used in a loop

At first glance, I'm a mediocre mech pilot. Look again and you will see my battlemech's computer code rushing through my eyes. My Mech And I Are One!
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 17th Jul 2003 03:55
CMATE

the answer is NO
DB is Basic... this is linear... i mean..step by step ...like QuickBasic......and many other....

sorry...
but i already red some..post on simulating..multi thread...
heartbone
22
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 17th Jul 2003 06:18
DarkBASIC applications run under Windows OS. Windows OS multitasks.

DarkBASIC does not create multi-threaded processes.

The more you see, the more you know.
The more you know, the more you see.
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 17th Jul 2003 07:43
yeah, I was just thinking about this topic, and you're all right, it is no. Even if you make a function, really when you call a custom fuction, it just plays the commands you wrote for it in order. Maybe if you made a custom dll...

At first glance, I'm a mediocre mech pilot. Look again and you will see my battlemech's computer code rushing through my eyes. My Mech And I Are One!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 17th Jul 2003 11:07
talking to mike a while back, he mentioned that newer PC cpus will have a dual instruction channels, quad etc.. later on.

Windows will harness this and it will be apart of the DirectX core functionality I would imagine.

A simple approach might be to channel music and sounds down one and the rest of the game down another.

ai and gfx instructions would be excellent to divide up.

Its kind of happening already now tho as your graphics card is partly a cpu in disguise.

A lot of this would be underlying in DirectX and perhaps you could get access to it with a good knowledge to the dx sdk that can manage it.

In the meantime theres no real major use of it as most pcs are not set up this way just yet.




To improve speed always reducing the amount of actions per main game loop always helps.

Using timers can alleviate many checks per round.

You could emulate a threading aspect by basing actions performed in your main loop with timers.

instead of checking for the player controls every loop you could reduce it by half with a timer, things of this nature if fine tuned is not noticable to the user and helps with speed and control flow of your main loop.

DB is a linear syntax with a basic foundation so it might be hard to emulate actual threading.

It does have access to types so its not so data daunting with larger strucutres.

freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 17th Jul 2003 13:08
I don't think its that hard to do multi-threading...

just call the different things you want to do in a main loop...
when you have - for example - a certain number of gosubs which you want to function at the same time, you can't use do-loop statements within these routines... otherwise the pc will be busy with only one loop at that time
you can easily avoid this using variables and if statements if you want one of your gosubs do a repeated action

[href]www.bernardfrancois.com[/href]
8truths
22
Years of Service
User Offline
Joined: 10th May 2003
Location: United States
Posted: 20th Jul 2003 10:43
Was reading, and needed to jump in here.

Some of the guys are missing the distinct features of multithreading.

Here's an example of the difference:

Running two functions at once is a far cry from multi-threading or multi-processing. If one of those calls got caught in an infinite loop, the other one is screwed, because DB is procedural and could not get out of the loop to run the second function.

With two processes truly running, the second process should be safe (as long as it does not depend on the first one) if the first process gets caught in an infinite loop.

Some forms of programming utterly depend on multithreading -- particularly CGI. Imagine how easy it would be to wreck a web server if it couldn't handle more than one process at a time?!

The only BASIC that multithreads is Visual BASIC. I think (but I don't specifically recall) that Pure BASIC might also be able to do the same deal.

We can't stop here! This is bat country!

Login to post a reply

Server time is: 2025-05-19 10:09:40
Your offset time is: 2025-05-19 10:09:40