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.

AppGameKit Classic Chat / Can I create the new Thread (tier2-windows) to LoadVideo for example?

Author
Message
Alex_Peres
AGK Master
14
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 4th Jun 2013 19:47
I'm using tier2 with Windows. And I have a problem.
AGK allows me to load just ONE video at ones.
When I load one of my video during the game is running it's stopping all game (animations) for a couple of seconds and it's really disturbing me!

Can I create the new Thread (tier2-windows) to LoadVideo for example?
Thanks in advance!
Alex_Peres
AGK Master
14
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 4th Jun 2013 20:23
Now I just try this and it works, but when I Play the video - I hear only sound from this video it's invisible! Can you help me please?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Jun 2013 10:46
Video is streamed, so only one at a time makes sense.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Jun 2013 13:16
about invisible,black?
maybe wrong video format.

playing some videos at the same time is no problem for a windows pc
but for old mobile devices one is enough.
Alex_Peres
AGK Master
14
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 5th Jun 2013 14:17
I think you didn't understand me guys!

I just want to load ONE video but during game is playing!
The only problem is EVERITHING IS PAUSED when video is loading!

So I've used this command to create a new thread


and it loads video on the "second" processor core I think.
But when I play this video I hear only sounds from video it doesn't appear at all!
* Without thread creation it works fine!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Jun 2013 14:34
hmm, i think you have no luck with threads because
the rest of the akg lib is not made for this.

what about if you "load" the video before game and
play it if you need.
Alex_Peres
AGK Master
14
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 5th Jun 2013 14:48
It's impossible for me because I use many other videos and AppGameKit allows me to load just one!
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Jun 2013 15:15
The video display probably needs to be on the main thread. That's normal.

Why do you want to load more than one video?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Jun 2013 15:16 Edited at: 5th Jun 2013 15:18
hmmm, maybe you can put all videos in one file and play from-to

@JimHawkins
we think about because loading delay/pause in game.
loading before and play one of it if needed, because its a stream, should possible.
Alex_Peres
AGK Master
14
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 5th Jun 2013 15:26
Quote: "hmmm, maybe you can put all videos in one file and play from-to"

If I could to change video position it might be fine! But...
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Jun 2013 15:39
hmmm, ok , make a new feature request
i don't have the docu in front of me.
what about motion jpeg?
each frame a jpeg load/show/load/show/...
i never try it
fog
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 5th Jun 2013 16:00
AGK has it's own thread class although I've never tried using it.

The only details I have is a copy of a post from Paul (IIRC). Should be enough info to give it a try though.

Quote: "If you are in tier 2 you can inherit the AGKThread class and implement the UINT Run(); method, anything in that function will run on a thread and when that function returns the thread quits. Then create an instance of your class and call the Start(); method, that will start the thread and return immediately. There is also a cLock class with cLock::Acquire() and cLock::Release() if you want some synchronisation.

Note that the AppGameKit functions themselves are NOT thread safe, for example updating a sprite in one thread whilst another is syncing will cause problems. "


JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Jun 2013 16:54
Using threads is actually slower on single-core processors, and as fog quotes there can be massive non-thread-safe synchronisation problems.

I'd put up a "Loading" message(and possibly a frame-grab) and let it do its thing. Less grief.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Alex_Peres
AGK Master
14
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 5th Jun 2013 16:54
Can anyone help with an example of AGKThread? I'm not sure that I understand how to do this...
The Zoq2
14
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 6th Jun 2013 15:47
I don't think AppGameKit has built in thread support that we can use, but I did some experiments with threads a week ago. I used boost for that but there was one major issue that I experienced. I could not create a thread with in the agk loop (app::Loop) without the app crashing. The only way I could get it to work was to call the joinAll command within the same frame as I started the thread. However, that forced the AppGameKit loop to wait for all threads to finish and I was unable to call the sync command from within the thread.

Login to post a reply

Server time is: 2024-05-03 03:23:59
Your offset time is: 2024-05-03 03:23:59