Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (dr_panther, VoroneTZ, AndrewAMD), 834 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 4 1 2 3 4
Re: boost up you game... (use multithreading!) [Re: EvilSOB] #258240
03/28/09 19:46
03/28/09 19:46
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Originally Posted By: EvilSOB
...
directx vertex manipulations and entity texture changes(ent_setskin)?

Originally Posted By: TechMuc
you can NOT use engine functions in other threads



3333333333
Re: boost up you game... (use multithreading!) [Re: Quad] #258243
03/28/09 20:08
03/28/09 20:08
Joined: Jun 2008
Posts: 151
Ukraine
XD1v0 Offline
Member
XD1v0  Offline
Member

Joined: Jun 2008
Posts: 151
Ukraine
Quadraxas did you know is jcl testing multithreading on Lite-C?
Quote:
you can NOT use engine functions in other threads

But how about ditectx functions(d3d9.h), can I use this functions?

Last edited by XD1v0; 03/28/09 21:26.

A7 Commercial cool
Celeron 1700, GeForce 5500 FX 256mb, 1 Gb Ram
Re: boost up you game... (use multithreading!) [Re: XD1v0] #258254
03/28/09 22:32
03/28/09 22:32
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
i just did quoted techMuc. you can read the rest of his message. he was talking about engines current state wink


3333333333
Re: boost up you game... (use multithreading!) [Re: Quad] #258274
03/29/09 12:24
03/29/09 12:24
Joined: Jun 2008
Posts: 151
Ukraine
XD1v0 Offline
Member
XD1v0  Offline
Member

Joined: Jun 2008
Posts: 151
Ukraine
Quadraxas on this forum easily confused laugh


A7 Commercial cool
Celeron 1700, GeForce 5500 FX 256mb, 1 Gb Ram
Re: boost up you game... (use multithreading!) [Re: Quad] #258385
03/30/09 06:40
03/30/09 06:40

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



Quote:
Is multithreading integrated in Lite-c,I do not understand can I use multithreading in every system and any processor? Or multithreading may crash in some systems.


multithreading is a technique of the operating system (windows, unix, ...)
I can't speak for all types of systems/processors but every Intel(r) compatible prozessor (Intel/AMD) and all Windows(r) operating systems from Windows 98 support multithreading.

Since 3DGS only supports Windows(r) multithreading will run on every clients target plattform (with different performance).

But there is a difference between multithreading-support of the engine and lite-c!
The engine actually DON'T use multithreading but you're able to create multithreading applications with lite-c (see the example) yourself.

The main challenge of multithreading applications is the synchronisation of the results of the different threads but once your concept works well the benefit could be extensive (especially with the new generation of multi-core processor systems!)

I discovered that I/O-handling (file/video/sound) in more than one thread ends in a crash (and more!*) especial in multi-core-systems.


mercuryus


*) backup your system before playing with multithreading programming!

Re: boost up you game... (use multithreading!) [Re: ] #258406
03/30/09 13:14
03/30/09 13:14
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Quote:
so CreateThread just... works? that's interesting, i haven't thought that lite-c was that much compatible to native c code.

You can take a peek in windows.h in your gamestudio folder and see what other hidden miracles are available wink.

Multithreading is a must for calling a database realtime, if you don't want any stuttering. I think Lite-C simply ports it from your windows.h, together with alot of other useful functions.

Great contribution Mercuryus!

Regards,
Joozey


Click and join the 3dgs irc community!
Room: #3dgs
Re: boost up you game... (use multithreading!) [Re: Joozey] #258481
03/30/09 21:39
03/30/09 21:39
Joined: Oct 2006
Posts: 175
G
Gumby22don Offline
Member
Gumby22don  Offline
Member
G

Joined: Oct 2006
Posts: 175
so with using lite-c functions for database in parallel, would I want to set up a global flag for data_locked, while the 2nd, nth threads are working, then get them to set it to unlocked when the database data is placed back into variables?

Is this the simplest sort of setup so that I can avoid crashes / mishmashed data?

(I'd think I would want multiple threads for database access, AI, network chat (reliable checks) and the like.)

Don
have a great day

Re: boost up you game... (use multithreading!) [Re: Gumby22don] #258490
03/31/09 01:29
03/31/09 01:29
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
You can only have a maximum of X many threads on windows systems. The default virtual space a thread consumes is 1Meg, and if you're not careful, your pc could end up being very busy for a long time. I suggest you create as few threads as possible, only use them when there's no way around, such as a database query. But even so you only need one extra thread for an unlimited amount of database connection. Pending queries may be stacked. I'm not sure what you mean with "data_locked", AFAIK you don't need to lock anything.

Last edited by Joozey; 03/31/09 01:35.

Click and join the 3dgs irc community!
Room: #3dgs
Re: boost up you game... (use multithreading!) [Re: Joozey] #258613
03/31/09 21:31
03/31/09 21:31
Joined: Oct 2006
Posts: 175
G
Gumby22don Offline
Member
Gumby22don  Offline
Member
G

Joined: Oct 2006
Posts: 175
I guess I was thinking that when a 2nd thread was running an update query, I wouldn't want my main thread to be trying to read any of that data. I doubt I'll be using it in the very near future though, or without a bit more research. Thanks for the response smile

Re: boost up you game... (use multithreading!) [Re: Gumby22don] #258626
03/31/09 23:13
03/31/09 23:13
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
To gain the data in the main thread, you need to pass a pointer to the second thread to store the data in, then keep checking the pointer in the main thread for valid data.


Click and join the 3dgs irc community!
Room: #3dgs
Page 2 of 4 1 2 3 4

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1