Plugin: ags_theora Video Player

Started by scotch, Tue 24/06/2008 14:48:58

Previous topic - Next topic

xenogia

#40
Here you go:

Code: ags


int FMVX; // x co-ordinate of video
int FMVY; // y co-ordinate of video
int VideoCut; // tells AGS when the video needs to be played

function repeatedly_execute_always()
{
     if (VideoCut == 1) { // Play FMV
	if (video) {
		if (!video.ended) {
			video.Draw(DsOverlay, FMVX, FMVY, RtScreenPixels);
			video.NextFrame ();
		}
              else {
                 VideoCut = 0;
         }

     }
}

function item_interact()
{
               SetGameSpeed (24);
		Wait (10);
	       VideoCut = 1;
		FMVX = 70;
		FMVY = 130;
		video = Theora.Open("assets/vid.ogv");
		video.loop = false;
						
		while (VideoCut != 2) Wait (1);
		video = null;
		Wait (10);
		SetGameSpeed (40);



All this code is the room, nowhere else.

Willdon

Quote from: Xenogia on Wed 21/04/2010 22:12:03
Here you go:

Code: ags


int FMVX; // x co-ordinate of video
int FMVY; // y co-ordinate of video
int VideoCut; // tells AGS when the video needs to be played

function repeatedly_execute_always()
{
     if (VideoCut == 1) { // Play FMV
	if (video) {
		if (!video.ended) {
			video.Draw(DsOverlay, FMVX, FMVY, RtScreenPixels);
			video.NextFrame ();
		}
              else {
                 VideoCut = 0;
         }

     }
}

function item_interact()
{
     SetGameSpeed (24);
		Wait (10);
	       VideoCut = 1;
		FMVX = 70;
		FMVY = 130;
		video = Theora.Open("assets/vid.ogv");
		video.loop = false;
						
		while (VideoCut != 2) Wait (1);
		video = null;
		Wait (10);
		SetGameSpeed (40);



All this code is the room, nowhere else.

:)  You just made my day! Thank you so much! 


How's your game going?

theo

I'm currently experimenting with this plugin to draw animated backdrops for chapter two of The Journey Down, and am experiencing two issues, I was hoping someone here might be able to shed some light on these:

* No matter what method I use to crate my .ogv files, the game ALWAYS starts out by rendering the first frame 100% pink. Once it's looping, it's gone. Just the very, very first frame of the first time. Any thoughts on this?

* As Willdon (I think) stated, walk-behinds override the animation, is there any way to work around this problem?

-

Is this plugin perhaps not the way for me to go? Are there any alternatives?

Sorry for digging up this old thread. I realize this may cause some confusion but this was the obvious place to post my questions.

goodohman

Hi there.

Thank you very much for the great plugin.

Could you help me?
I can't make sense of the x,y coords!!
They don't seem to correspond to the room coords, no matter what kind of relativity I choose.

Thanks!

goodohman

no response yet, but another problem suddenly popped up - and maybe they are related in a way?
Theora *vid=open() will always return null if inside the editor. it won't regardless of debug/non-debug mode!
BUT (and it's a big one) - if I compile an EXE, it does load the video.
Anything?
I checked Dx5 and D3D and original DLL and ? and?

Khris

My guess is that hitting both F5 and Strg+F5 in the editor will run the exe in the Debug folder. For every command related to files, AGS correctly uses the Compiled path, maybe with the exception of Theora commands?
Try copying the video(s) to the Debug folder.

goodohman


Thanks for the reply Khris,
However it's a "new" behavior.. it was working and then *pop*...
Also, I didn't use the keyboard to run it (just pressed the menu items), so...

Do you have any idea regarding the x,y position problem?

Thanks!

goodohman

Scotch,
Could you please take a look and help me here?

Thanks!!!

Monsieur OUXX

Sorry for digging out the thread. I was considering PM'ing only scotch, but I thought maybe someone else could help.

Whatever values I enter in "scale", the video always appeared scaled up in the background. I used the source of the demo and copy-pasted it in my own game, I only changed the "scalex" and "scale" values.

I think I have AGS 3.1.2. I just replaced the name of the file with the name of my own video. My video's resolution (900 something by 600 something) is larger than my game's resolution (320x240), that's why I need to scale it down.

By the way, my computer doesn't enable hardware acceleration for some reason (I've got a sublaptop).

Sidenote: I don't understand why the coordinates and scale values used in the "hardware acceleration" instruction of the demo are not the same as the values used in the "no hardware acceleration"? Surely the hardware acceleration doesn't change the size in pixels of the game?
 

Monsieur OUXX

Bump. Nobody's using this plugin? Scotch doesn't answer either. :'-(
 

Dualnames

I was sure that I replied to this. Well, I am but I never tried scaling. I tried like once or twice,it worked,but I'm not currently using anything will scale. I will however look into this and try to scale. Just for you.

PS: If I manage to scale it, you must find me a bride. m0ds or Calin plx.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Monsieur OUXX

Quote from: Dualnames on Fri 11/03/2011 10:00:03
Just for you.

Oh Dual, what's happening to us?

Quote from: Dualnames on Fri 11/03/2011 10:00:03
m0ds or Calin plx.

You just ruined it. Stop playing with my feelings.

More seriously: I suspect it has somethingt o do with the fact I have no hardware acceleration. To be sure that you're in the same situation, use the function to test that in the sample code.

Also, I'm scaling *down* (that is: I use a scaling factor < 1.0). I don't think it should have any impact, since it's all DirectX 3D floating variables with "1.0f"=="100%", but just in case.

 

Dualnames

Awwww, cute.

Now, as I recalled, scaling (up or down), unfortunately works only on Direct3D.
So, yep that pretty much sums it up.

Now.

BRIDE!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Monsieur OUXX

Quote from: Dualnames on Fri 11/03/2011 11:57:06
Now.

BRIDE!

You don't deserve one.

Quote from: Dualnames on Fri 11/03/2011 11:57:06
Now, as I recalled, scaling works only on Direct3D.

But that doesn't make any sense, as inside the demo code the DrawEx instruction has scale factors different fom 1.0 even in its non-accelerated version.

First things first: Are we talking about 2 different things when we chat about hardware acceleration? (1/DX5 vs. D3D, 2/if(System.HardwareAcceleration) {...})
 

xerca

I have a problem with this module. There is a room which has a video as background (and which we don't see the player character). When the player goes into that room and leaves, the flipped sprites become invisible. At first, I didn't understand why the player character becomes invisible while walking but I realised that only the flipped frames are invisible. Is there a solution to this?

mode7

Switch to Direct Draw.
However, depending on the resolution and use of alpha blended sprites in your game this might not be the perfect solution.

xerca

I read that it needs to be D3D mode for scaling, and I use that. Also I use lots of high resolution sprites, some with alpha blending. Thanks for the advice anyway.

mode7

Well you could of course flip the sprites beforehand in Photoshop or something

xerca

Quote from: mode7 on Mon 23/05/2011 19:48:53
Well you could of course flip the sprites beforehand in Photoshop or something
Okay, I'll do this if I can't find any other method. It would take a really long time and would be a waste of memory though. Maybe I can just give up and delete that room..

Monsieur OUXX

HELP!

When I use video.DrawEx (to draw the video's frame on the background) and THEN draw a sprite manually onto the background, the video is still on top.

Is it the expected behavior? How can I draw stuff on top of the video?
This is rather blocking for my game...

Code: ags

      if(System.HardwareAcceleration) {
        //the game is not designed to take advantage of hardware acceleration
      } else {
        video.DrawEx(DsBackground,   160.0, 150.0,   1.0,  1.0,  0.0, RtScreen);
      }
      
      video.NextFrame();

    
      //overwrite something
      DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
      surface.DrawImage(0, 0,  bg.Graphic,  0,  320,  156);
      surface.Release(); 


As you can see in both cases I target the background : DsBackground, GetDrawingSurfaceForBackground.
 

SMF spam blocked by CleanTalk