Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 730 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Preloading assets in the background [Re: jcl] #371364
05/20/11 13:16
05/20/11 13:16
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Okay, thanks for the info! That's extremely useful!

Any thoughts on session opening/connecting without requiring a level_load when dplay_entrate is -1?

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Preloading assets in the background [Re: JibbSmart] #371368
05/20/11 13:45
05/20/11 13:45
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
@JustSid: You call something trivial when you need linked lists, a thread that dynamically creates other threads and mutual exclusion ^^ You act like these things are explained in books like "C for dummies" on the second page ^^

Last edited by Dark_samurai; 05/20/11 13:45.

ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: Preloading assets in the background [Re: Dark_samurai] #371381
05/20/11 15:32
05/20/11 15:32
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Here's another request:
"Thread safe" would be really useful to include in the manual under each thread safe function. That way we can see if any function can be called in a separate thread, and we could even search "thread" in the manual to see all functions that are thread safe.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Preloading assets in the background [Re: Dark_samurai] #371399
05/20/11 20:08
05/20/11 20:08
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Dark_samurai
@JustSid: You call something trivial when you need linked lists, a thread that dynamically creates other threads and mutual exclusion ^^ You act like these things are explained in books like "C for dummies" on the second page ^^

Yes, its more trivial than the concept of wait() which is expected to be understood by everyone here. So yes, I consider this as trivial.

Question: Is anyone interested in a more general purpose solution for the Code that I posted above? So that it works with every engine type loadable from a file and written much cleaner?
Just asking because it looks like no one want this feature in real and everything seems to be about add_buffer() (not even the threadstarter seems to be interested which is imo a bit confusing)


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Preloading assets in the background [Re: WretchedSid] #371402
05/20/11 20:41
05/20/11 20:41
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
True, add_buffer's thread-safety is of little to no consequence as it's not what makes things slow. I'd be interested in what other functions are thread-safe. Your (JustSid's) example is great, but it'd be nice to be able to just use file_load in another thread, for example (as the add_buffer example in the manual shows).

@jcl:
I know I got carried away when TechMuc said "thread-safe" and jcl said "yes". Any info on the thread-safety of other A8 functions? Any chance this info can be included in the manual?
Originally Posted By: JustSid
Yes, its more trivial than the concept of wait() which is expected to be understood by everyone here. So yes, I consider this as trivial.
No, it's not. I'd bet most users only understand wait as "Leave the function for now and continue from here next frame". Many beginners can get by thinking it's just something you have to put at the end of while(1) loops. Most people here are C-Script/Lite-C programmers, not Windows C programmers.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Preloading assets in the background [Re: JibbSmart] #371405
05/20/11 20:52
05/20/11 20:52
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: JulzMighty
Originally Posted By: JustSid
Yes, its more trivial than the concept of wait() which is expected to be understood by everyone here. So yes, I consider this as trivial.
No, it's not. I'd bet most users only understand wait as "Leave the function for now and continue from here next frame". Many beginners can get by thinking it's just something you have to put at the end of while(1) loops. Most people here are C-Script/Lite-C programmers, not Windows C programmers.

Neither am I a Windows C programmer. A mutual exclusion is much easier to explain than "hey, it returns from the function but in the next frame it resumes the function". And a linked list is the easiest data structure available in C (yes, even simpler than arrays). They make sense in every way while wait() makes no sense to a beginner.

"Hey, you must add a wait(1); to you loop, otherwise your program will crash" and "I'm not sure, have you tried to add a wait(1)?" shows that most people don't really get what wait() is but its assumed to be the magic healing potion for code. wait() is NOT trivial. A linked-list-mutual-exclusion-thread-factory is, compared to wait(), trivial.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Preloading assets in the background [Re: WretchedSid] #371406
05/20/11 21:02
05/20/11 21:02
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
wait(1) problems are rare, even on the beginner forums. Please explain to me what a mutual exclusion is -- I can get by with multi-threading, but am still unfamiliar with mutexes. And then explain it and linked lists (which I doubt many Lite-C users try without mastering wait(1) first) and multi-threading more trivially than your own explanation for wait().

Whether or not something is trivial is relative to one's own experience. To say wait() is not trivial gives enough frame of reference to say that implementing your example on one's own is not trivial.

Anyway, whether or not it's trivial is not important. Maybe it is the other way around for someone who's a competent C programmer first before starting with Lite-C. I won't say any more on the matter here. But I'd still like you to explain mutexes to me, please laugh

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Preloading assets in the background [Re: JibbSmart] #371407
05/20/11 21:10
05/20/11 21:10
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
I missed this:
Originally Posted By: JustSid
Just asking because it looks like no one want this feature in real and everything seems to be about add_buffer() (not even the threadstarter seems to be interested which is imo a bit confusing)
Originally Posted By: Jibb (Me)
Okay, thanks for the info! That's extremely useful!
I didn't quote anyone when I wrote that because it was in response to more than one person: You, jcl, Richi007 and TechMuc (I didn't know about add_buffer, and thought when they mentioned it that add_buffer was indeed what needed to be thread-safe, because I assumed it was what loaded the file). I had your example in mind especially when I wrote the latter half. I just didn't name names because it was a thanks to everyone who had contributed towards the idea that this could indeed already be done.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Preloading assets in the background [Re: JibbSmart] #371432
05/21/11 09:06
05/21/11 09:06
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
Quote:
True, add_buffer's thread-safety is of little to no consequence as it's not what makes things slow. I'd be interested in what other functions are thread-safe. Your (JustSid's) example is great, but it'd be nice to be able to just use file_load in another thread, for example (as the add_buffer example in the manual shows).


Just for your undrstanding: File_Load only reads a complete file from harddisk and stores it into the memory.. as long as the method does not contain any strange references to engine-functions they should be thread-safe..

And even if not: Just read the file by yourself via fopen/fread/fclose (methods which are threads safe)

Re: Preloading assets in the background [Re: TechMuc] #371434
05/21/11 09:11
05/21/11 09:11
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
I took the time to write a more generic loader for assets in the background. It uses the same approach as my sample code posted above, but is a bit more cleaner and robust.
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=371433&#Post371433


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Page 2 of 3 1 2 3

Moderated by  aztec, Spirit 

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